: link-reg ( -- reg ) EBX ;
: fixnum>slot@ ( -- ) temp0 2 SAR ;
: rex-length ( -- n ) 0 ;
+: red-zone-size ( -- n ) 0 ;
: jit-call ( name -- )
0 CALL f rc-relative rel-dlsym ;
:: jit-signal-handler-prolog ( -- frame-size )
stack-frame-size 8 bootstrap-cells + :> frame-size
- ESP frame-size bootstrap-cell - SUB ! minus a cell for return address
+ ! 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
ESP [] EAX MOV
ESP 1 bootstrap-cells [+] ECX MOV
ESP 2 bootstrap-cells [+] EDX MOV
ESP 4 bootstrap-cells [+] EBP MOV
ESP 5 bootstrap-cells [+] ESI MOV
ESP 6 bootstrap-cells [+] EDI MOV
+ PUSHF
ESP frame-size 3 bootstrap-cells - [+] 0 MOV rc-absolute-cell rel-this
ESP frame-size 2 bootstrap-cells - [+] frame-size MOV
! subprimitive definition assumes vm's been loaded
frame-size ;
:: jit-signal-handler-epilog ( frame-size -- )
+ POPF
EAX ESP [] MOV
ECX ESP 1 bootstrap-cells [+] MOV
EDX ESP 2 bootstrap-cells [+] MOV
EBP ESP 4 bootstrap-cells [+] MOV
ESI ESP 5 bootstrap-cells [+] MOV
EDI ESP 6 bootstrap-cells [+] MOV
- ESP frame-size bootstrap-cell - ADD ;
+ ESP ESP frame-size 2 bootstrap-cells - [+] LEA ;
[
EAX ds-reg [] MOV
jit-load-context
jit-restore-context
+ ! clear the fault flag
+ vm-reg vm-fault-flag-offset [+] 0 MOV
+
! Windows-specific setup
ctx-reg jit-update-seh
\ lazy-jit-compile define-combinator-primitive
[
- temp1 HEX: ffffffff CMP f rc-absolute-cell rel-literal
+ temp1 0xffffffff CMP f rc-absolute-cell rel-literal
] pic-check-tuple jit-define
! Inline cache miss entry points
EAX EDX [] MOV
jit-jump-quot ;
-: jit-safepoint ( -- )
- 0 EAX MOVABS rc-absolute rel-safepoint ;
+[
+ 0 EAX MOVABS rc-absolute rel-safepoint
+] \ jit-safepoint jit-define
[
jit-start-context-and-delete