vm: frame size for signal handler code blocks
parent
0b94018d9f
commit
1911905c6b
|
@ -10,6 +10,7 @@ IN: bootstrap.x86
|
|||
4 \ cell set
|
||||
|
||||
: leaf-stack-frame-size ( -- n ) 4 bootstrap-cells ;
|
||||
: signal-handler-stack-frame-size ( -- n ) 12 bootstrap-cells ;
|
||||
: stack-frame-size ( -- n ) 8 bootstrap-cells ;
|
||||
: shift-arg ( -- reg ) ECX ;
|
||||
: div-arg ( -- reg ) EAX ;
|
||||
|
@ -104,7 +105,7 @@ IN: bootstrap.x86
|
|||
! peform their own prolog/epilog preserving registers.
|
||||
|
||||
:: jit-signal-handler-prolog ( -- frame-size )
|
||||
stack-frame-size 8 bootstrap-cells + :> frame-size
|
||||
signal-handler-stack-frame-size :> frame-size
|
||||
! minus a cell each for flags and return address
|
||||
! use LEA so we don't dirty flags
|
||||
ESP ESP frame-size 2 bootstrap-cells - neg [+] LEA
|
||||
|
|
|
@ -97,6 +97,8 @@ IN: bootstrap.x86
|
|||
:: jit-signal-handler-prolog ( -- frame-size )
|
||||
signal-handler-save-regs :> save-regs
|
||||
save-regs length 1 + bootstrap-cells 16 align stack-frame-size + :> frame-size
|
||||
frame-size signal-handler-stack-frame-size =
|
||||
[ "unexpected signal handler frame size" throw ] unless
|
||||
! minus a cell each for flags, return address
|
||||
! use LEA so we don't dirty flags
|
||||
RSP RSP frame-size 2 bootstrap-cells - neg [+] LEA
|
||||
|
|
|
@ -6,6 +6,7 @@ sequences system vocabs ;
|
|||
IN: bootstrap.x86
|
||||
|
||||
: leaf-stack-frame-size ( -- n ) 4 bootstrap-cells ;
|
||||
: signal-handler-stack-frame-size ( -- n ) 20 bootstrap-cells ;
|
||||
: stack-frame-size ( -- n ) 4 bootstrap-cells ;
|
||||
: nv-regs ( -- seq ) { RBX R12 R13 R14 R15 } ;
|
||||
: volatile-regs ( -- seq ) { RAX RCX RDX RSI RDI R8 R9 R10 R11 } ;
|
||||
|
|
|
@ -8,6 +8,7 @@ IN: bootstrap.x86
|
|||
DEFER: stack-reg
|
||||
|
||||
: leaf-stack-frame-size ( -- n ) 4 bootstrap-cells ;
|
||||
: signal-handler-stack-frame-size ( -- n ) 24 bootstrap-cells ;
|
||||
: stack-frame-size ( -- n ) 8 bootstrap-cells ;
|
||||
: nv-regs ( -- seq ) { RBX RSI RDI R12 R13 R14 R15 } ;
|
||||
: volatile-regs ( -- seq ) { RAX RCX RDX R8 R9 R10 R11 } ;
|
||||
|
|
|
@ -3,9 +3,10 @@ namespace factor
|
|||
|
||||
#define FACTOR_CPU_STRING "x86.32"
|
||||
|
||||
/* Must match the leaf-stack-frame-size stack-frame-size constants in
|
||||
cpu/x86/32/bootstrap.factor */
|
||||
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
|
||||
and stack-frame-size constants in cpu/x86/32/bootstrap.factor */
|
||||
static const unsigned LEAF_FRAME_SIZE = 16;
|
||||
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 48;
|
||||
static const unsigned JIT_FRAME_SIZE = 32;
|
||||
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ code_block *factor_vm::compile_inline_cache(fixnum index,
|
|||
methods.value(),
|
||||
cache_entries.value(),
|
||||
tail_call_p);
|
||||
code_block *code = jit.to_code_block();
|
||||
code_block *code = jit.to_code_block(JIT_FRAME_SIZE);
|
||||
initialize_code_block(code);
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ void jit::compute_position(cell offset_)
|
|||
}
|
||||
|
||||
/* Allocates memory */
|
||||
code_block *jit::to_code_block()
|
||||
code_block *jit::to_code_block(cell frame_size)
|
||||
{
|
||||
/* Emit dummy GC info */
|
||||
code.grow_bytes(alignment_for(code.count + 4,data_alignment));
|
||||
|
@ -144,7 +144,7 @@ code_block *jit::to_code_block()
|
|||
relocation.elements.value(),
|
||||
parameters.elements.value(),
|
||||
literals.elements.value(),
|
||||
JIT_FRAME_SIZE);
|
||||
frame_size);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ struct jit {
|
|||
}
|
||||
|
||||
|
||||
code_block *to_code_block();
|
||||
code_block *to_code_block(cell frame_size);
|
||||
|
||||
private:
|
||||
jit(const jit&);
|
||||
|
|
|
@ -28,9 +28,10 @@ inline static void uap_clear_fpu_status(void *uap)
|
|||
|
||||
#define UAP_STACK_POINTER_TYPE greg_t
|
||||
|
||||
/* Must match the leaf-stack-frame-size and stack-frame-size constants
|
||||
in basis/cpu/x86/64/unix/bootstrap.factor */
|
||||
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
|
||||
and stack-frame-size constants in basis/cpu/x86/64/unix/bootstrap.factor */
|
||||
static const unsigned LEAF_FRAME_SIZE = 32;
|
||||
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160;
|
||||
static const unsigned JIT_FRAME_SIZE = 32;
|
||||
|
||||
}
|
||||
|
|
|
@ -73,9 +73,10 @@ inline static void uap_clear_fpu_status(void *uap)
|
|||
mach_clear_fpu_status(UAP_FS(uap));
|
||||
}
|
||||
|
||||
/* Must match the leaf-stack-frame-size and stack-frame-size constants
|
||||
in basis/cpu/x86/64/unix/bootstrap.factor */
|
||||
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
|
||||
and stack-frame-size constants in basis/cpu/x86/64/unix/bootstrap.factor */
|
||||
static const unsigned LEAF_FRAME_SIZE = 32;
|
||||
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160;
|
||||
static const unsigned JIT_FRAME_SIZE = 32;
|
||||
|
||||
}
|
||||
|
|
|
@ -8,9 +8,10 @@ namespace factor
|
|||
|
||||
#define MXCSR(ctx) (ctx)->MxCsr
|
||||
|
||||
/* Must match the leaf-stack-frame-size and stack-frame-size constants
|
||||
in basis/cpu/x86/64/windows/bootstrap.factor */
|
||||
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
|
||||
and stack-frame-size constants in basis/cpu/x86/64/windows/bootstrap.factor */
|
||||
|
||||
static const unsigned LEAF_FRAME_SIZE = 32;
|
||||
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 192;
|
||||
static const unsigned JIT_FRAME_SIZE = 64;
|
||||
}
|
||||
|
|
|
@ -319,7 +319,11 @@ code_block *factor_vm::jit_compile_quot(cell owner_, cell quot_, bool relocating
|
|||
compiler.init_quotation(quot.value());
|
||||
compiler.iterate_quotation();
|
||||
|
||||
code_block *compiled = compiler.to_code_block();
|
||||
cell frame_size = compiler.special_subprimitive_p(owner_)
|
||||
? SIGNAL_HANDLER_STACK_FRAME_SIZE
|
||||
: JIT_FRAME_SIZE;
|
||||
|
||||
code_block *compiled = compiler.to_code_block(frame_size);
|
||||
|
||||
if(relocating) initialize_code_block(compiled);
|
||||
|
||||
|
|
Loading…
Reference in New Issue