No reason to go through a safepoint in unwind-native-frames really.
: vm-context-offset ( -- n ) 0 bootstrap-cells ; inline
: vm-spare-context-offset ( -- n ) 1 bootstrap-cells ; inline
: vm-signal-handler-addr-offset ( -- n ) 8 bootstrap-cells ; inline
+: vm-fault-flag-offset ( -- n ) 9 bootstrap-cells ; inline
: context-callstack-top-offset ( -- n ) 0 bootstrap-cells ; inline
: context-callstack-bottom-offset ( -- n ) 1 bootstrap-cells ; inline
: context-datastack-offset ( -- n ) 2 bootstrap-cells ; inline
[ jit-jump-quot ]
\ (call) define-combinator-primitive
-: (jit-safepoint) ( -- )
- 0 EAX MOVABS rc-absolute rel-safepoint ;
[
! Load ds and rs registers
jit-load-vm
jit-load-context
jit-restore-context
- ! Safepoint to clear the faulting flag in the VM
- (jit-safepoint)
+ ! clear the fault flag
+ vm-reg vm-fault-flag-offset [+] 0 MOV
! Windows-specific setup
ctx-reg jit-update-seh
EAX EDX [] MOV
jit-jump-quot ;
-[ (jit-safepoint) ] \ jit-safepoint jit-define
+[
+ 0 EAX MOVABS rc-absolute rel-safepoint
+] \ jit-safepoint jit-define
[
jit-start-context-and-delete
[ jit-jump-quot ]
\ (call) define-combinator-primitive
-: (jit-safepoint)
- 0 [RIP+] EAX MOV rc-relative rel-safepoint ;
-
[
! Unwind stack frames
RSP arg2 MOV
jit-load-context
jit-restore-context
- ! Safepoint to clear the faulting flag in the VM
- (jit-safepoint)
+ ! Clear the fault flag
+ vm-reg vm-fault-flag-offset [+] 0 MOV
! Call quotation
jit-jump-quot
jit-push-param
jit-jump-quot ;
-[ (jit-safepoint) ] \ jit-safepoint jit-define
+[
+ 0 [RIP+] EAX MOV rc-relative rel-safepoint
+] \ jit-safepoint jit-define
[
jit-start-context-and-delete
{ cards-offset cell }
{ decks-offset cell }
{ signal-handler-addr cell }
+{ faulting? cell }
{ special-objects cell[special-object-count] } ;
: vm-field-offset ( field -- offset ) vm offset-of ; inline
ctx->push(error_object);
- /* Guard the safepoint, which will clear faulting_p if unwind-native-frames
- succeeds */
- code->guard_safepoint();
+ /* The unwind-native-frames subprimitive will clear faulting_p
+ if it was successfully reached. */
unwind_native_frames(special_objects[ERROR_HANDLER_QUOT],
ctx->callstack_top);
}
/* cdecl signal handler address, used by signal handler subprimitives */
cell signal_handler_addr;
+ /* are we handling a memory error? used to detect double faults */
+ cell faulting_p;
+
/* Various special objects, accessed by special-object and
set-special-object primitives */
cell special_objects[special_object_count];
segment *signal_callstack_seg;
/* Are we already handling a fault? Used to catch double memory faults */
- bool faulting_p;
static bool fatal_erroring_p;
/* Safepoint state */