]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.x86.64: eliminate useless instruction from primitive call sequence for a marginal...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 31 Mar 2010 21:06:50 +0000 (17:06 -0400)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 31 Mar 2010 23:32:36 +0000 (19:32 -0400)
basis/cpu/x86/32/bootstrap.factor
basis/cpu/x86/64/bootstrap.factor

index 15a7dc1c2970026145e8f724fb5445a86a78f57a..a428a66ace0775c072a5a3666bcdedba0de003be 100644 (file)
@@ -63,12 +63,13 @@ IN: bootstrap.x86
     rs-reg ctx-reg context-retainstack-offset [+] MOV ;
 
 [
+    ! ctx-reg is preserved across the call because it is non-volatile
+    ! in the C ABI
     jit-load-vm
     jit-save-context
     ! call the primitive
     ESP [] vm-reg MOV
     0 CALL rc-relative rt-dlsym jit-rel
-    ! restore ds, rs registers
     jit-restore-context
 ] jit-primitive jit-define
 
index 2f03823d45677457b287c34f5b430a5a13ff02ca..4cd2d8104b904b55a5eb648c5daa3371e300f47d 100644 (file)
@@ -57,11 +57,12 @@ IN: bootstrap.x86
     ctx-reg context-retainstack-offset [+] rs-reg MOV ;
 
 : jit-restore-context ( -- )
-    jit-load-context
     ds-reg ctx-reg context-datastack-offset [+] MOV
     rs-reg ctx-reg context-retainstack-offset [+] MOV ;
 
 [
+    ! ctx-reg is preserved across the call because it is non-volatile
+    ! in the C ABI
     jit-save-context
     ! call the primitive
     arg1 vm-reg MOV
@@ -80,6 +81,7 @@ IN: bootstrap.x86
     arg1 vm-reg MOV
     "begin_callback" jit-call
 
+    jit-load-context
     jit-restore-context
 
     ! call the quotation
@@ -115,6 +117,7 @@ IN: bootstrap.x86
     vm-reg 0 MOV 0 rc-absolute-cell jit-vm
 
     ! Load ds and rs registers
+    jit-load-context
     jit-restore-context
 
     ! Call quotation
@@ -168,6 +171,7 @@ IN: bootstrap.x86
     arg1 RBX MOV
     arg2 vm-reg MOV
     "inline_cache_miss" jit-call
+    jit-load-context
     jit-restore-context ;
 
 [ jit-load-return-address jit-inline-cache-miss ]