]> gitweb.factorcode.org Git - factor.git/commitdiff
separated vm-1st-arg and vm-3rd-arg asm invoke words (needed for ppc & x86.64)
authorPhil Dawes <phil@phildawes.net>
Tue, 25 Aug 2009 05:41:37 +0000 (06:41 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:20:09 +0000 (08:20 +0100)
basis/compiler/codegen/codegen.factor
basis/cpu/architecture/architecture.factor
basis/cpu/ppc/ppc.factor
basis/cpu/x86/32/32.factor
basis/cpu/x86/64/64.factor
basis/cpu/x86/x86.factor

index 6d43adf9330fabecd19e11ebda1ba6f8d04ccfd5..f41bc853b53f507dfde54a6e6ac3266c218453ec 100755 (executable)
@@ -437,7 +437,7 @@ M: ##alien-indirect generate-insn
     ! Generate code for boxing input parameters in a callback.
     [
         dup \ %save-param-reg move-parameters
-        "nest_stacks" %vm-invoke
+        "nest_stacks" %vm-invoke-1st-arg
         box-parameters
     ] with-param-regs ;
 
@@ -475,7 +475,7 @@ TUPLE: callback-context ;
         [ callback-context new do-callback ] %
     ] [ ] make ;
 
-: %unnest-stacks ( -- ) "unnest_stacks" %vm-invoke ;
+: %unnest-stacks ( -- ) "unnest_stacks" %vm-invoke-1st-arg ;
 
 M: ##callback-return generate-insn
     #! All the extra book-keeping for %unwind is only for x86.
index 6d88944881b50f5153e546e5454d1a28e74dd2ee..fbec9f697a785744cbc548f9e219fc671aac7d1f 100644 (file)
@@ -298,7 +298,8 @@ M: object %prepare-var-args ;
 
 HOOK: %alien-invoke cpu ( function library -- )
 
-HOOK: %vm-invoke cpu ( function -- )
+HOOK: %vm-invoke-1st-arg cpu ( function -- )
+HOOK: %vm-invoke-3rd-arg cpu ( function -- )
 
 HOOK: %cleanup cpu ( params -- )
 
index fc6a1221018392b75d86505794622c6a3982c8cb..83f1bc9a74357f043c8bbd55ef020d45a58bd9a5 100644 (file)
@@ -38,6 +38,9 @@ enable-float-intrinsics
 
 M: ppc %vm-field-ptr ( dst field -- ) %load-vm-field-addr ;
 
+M: ppc %vm-invoke-1st-arg ( function -- ) f %alien-invoke ;
+M: ppc %vm-invoke-3rd-arg ( function -- ) f %alien-invoke ;
+
 M: ppc machine-registers
     {
         { int-regs $[ 2 12 [a,b] 15 29 [a,b] append ] }
index 9499df7aafa7f67c902470706ef5e2f0170a2828..f711455fa3f8d168ad62bab5a18498b93288900a 100755 (executable)
@@ -51,11 +51,14 @@ M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ;
     temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument
     temp-reg PUSH ;
 
-M: x86.32 %vm-invoke ( function -- )
+M: x86.32 %vm-invoke-1st-arg ( function -- )
     push-vm-ptr
     f %alien-invoke
     temp-reg POP ;
 
+M: x86.32 %vm-invoke-3rd-arg ( function -- )
+    %vm-invoke-1st-arg ;    ! first 2 args are regs, 3rd is stack so vm-invoke-1st-arg works here
+
 M: x86.32 return-struct-in-registers? ( c-type -- ? )
     c-type
     [ return-in-registers?>> ]
index 06592078d8a0f6022ee748cddd1b5b14b2eba761..8c713eac8b8f3dd63000cb48fe15cd3d7ac6530e 100644 (file)
@@ -172,7 +172,9 @@ M: x86.64 %alien-invoke
     rc-absolute-cell rel-dlsym
     R11 CALL ;
 
-M: x86.64 %vm-invoke ( function -- ) f %alien-invoke ;
+M: x86.64 %vm-invoke-1st-arg ( function -- ) f %alien-invoke ;
+
+M: x86.64 %vm-invoke-3rd-arg ( function -- ) f %alien-invoke ;
 
 M: x86.64 %prepare-alien-indirect ( -- )
     "unbox_alien" f %alien-invoke
index 9ac787a02769347cf5b6ac00231b52df9bc14d8c..91705efec6d46a39e367d90a6a15bde6bdff46b6 100644 (file)
@@ -615,7 +615,7 @@ M:: x86 %call-gc ( gc-root-count -- )
     ! Pass number of roots as second parameter
     param-reg-2 gc-root-count MOV
     ! Call GC
-    "inline_gc" %vm-invoke ; ! (PHIL) TODO: vm-invoke won't work with ppc or x86.64. need %vm-invoke-3rd
+    "inline_gc" %vm-invoke-3rd-arg ; 
 
 M: x86 %alien-global ( dst symbol library -- )
     [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;