]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.x86.bootstrap: simplify leaf-signal-handler
authorJoe Groff <arcata@gmail.com>
Sun, 30 Oct 2011 01:13:22 +0000 (18:13 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 20:23:08 +0000 (13:23 -0700)
We can use RET (stack-frame-size - cell) instead of doing stack gymnastics.

basis/cpu/x86/bootstrap.factor

index 480b0efa90aa020373109bc1348b5e7ea24229d6..e0d1ef9bf77a00a3182b17c8ab9d29fe346e2d80 100644 (file)
@@ -119,19 +119,9 @@ big-endian off
     jit-save-context
     temp0 vm-reg vm-signal-handler-addr-offset [+] MOV
     temp0 CALL
-    ! Stack at this point has a fake stack frame set up to represent the
-    ! leaf procedure we interrupted. We must tear down that frame in
-    ! addition to our own before resuming.
-    ! Grab our frame's return address and place it just underneath the leaf proc's
-    ! return address, since we can't touch any registers once they've been
-    ! restored. If we got this far there should be no faults here and we
-    ! can get away with corrupting the stack frame.
-    temp0 stack-reg frame-size bootstrap-cell - [+] MOV
-    stack-reg frame-size stack-frame-size + 2 bootstrap-cells - [+] temp0 MOV
-
-    ! Pop enough of the fake frame to leave the resume address at the top of the
-    ! stack when we RET.
-    frame-size stack-frame-size + bootstrap-cell - jit-signal-handler-epilog
+    frame-size jit-signal-handler-epilog
+    ! Pop the fake leaf frame along with our return address
+    stack-frame-size cell - RET
 ] \ leaf-signal-handler define-sub-primitive
 
 [