]> gitweb.factorcode.org Git - factor.git/commitdiff
added vm ptr to x86.32 boxing asm
authorPhil Dawes <phil@phildawes.net>
Sat, 22 Aug 2009 09:21:32 +0000 (10:21 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:33 +0000 (08:16 +0100)
basis/cpu/x86/32/32.factor

index 306771a4b54470c559cb405834f9918b65ffb217..adddc4c5b207e863ff397971e414a2766c71814f 100755 (executable)
@@ -47,9 +47,12 @@ M: x86.32 reserved-area-size 0 ;
 
 M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ;
 
-M: x86.32 %vm-invoke ( function -- )
+: push-vm-ptr ( -- )
     temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument
-    temp-reg PUSH
+    temp-reg PUSH ;
+
+M: x86.32 %vm-invoke ( function -- )
+    push-vm-ptr
     f %alien-invoke
     temp-reg POP ;
 
@@ -109,9 +112,12 @@ M: x86.32 %save-param-reg 3drop ;
     #! parameter being passed to a callback from C.
     over [ load-return-reg ] [ 2drop ] if ;
 
+CONSTANT: vm-ptr-size 4
+
 M:: x86.32 %box ( n rep func -- )
     n rep (%box)
-    rep rep-size [
+    rep rep-size vm-ptr-size + [
+        push-vm-ptr
         rep push-return-reg
         func f %alien-invoke
     ] with-aligned-stack ;
@@ -164,9 +170,8 @@ M: x86.32 %prepare-unbox ( -- )
 
 : call-unbox-func ( func -- )
     8 [
-        ! push vm ptr
-        temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument
-        temp-reg PUSH
+        ! push the vm ptr as an argument
+        push-vm-ptr
         ! Push parameter
         EAX PUSH
         ! Call the unboxer