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 ;
! 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
:: 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
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 } ;
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 } ;
#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;
}
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;
}
}
/* 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));
relocation.elements.value(),
parameters.elements.value(),
literals.elements.value(),
- JIT_FRAME_SIZE);
+ frame_size);
}
}
}
- code_block *to_code_block();
+ code_block *to_code_block(cell frame_size);
private:
jit(const jit&);
#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;
}
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;
}
#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;
}
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);