]> gitweb.factorcode.org Git - factor.git/commitdiff
vm pointer passed to nest_stacks and unnest_stacks (win32)
authorPhil Dawes <phil@phildawes.net>
Sun, 23 Aug 2009 19:04:05 +0000 (20:04 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:17:26 +0000 (08:17 +0100)
basis/compiler/codegen/codegen.factor
basis/cpu/x86/32/32.factor
basis/cpu/x86/x86.factor
vm/contexts.cpp

index de15cda21c45c9c0d42bae0e0f0f12afb3d6cf5d..6d43adf9330fabecd19e11ebda1ba6f8d04ccfd5 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" f %alien-invoke
+        "nest_stacks" %vm-invoke
         box-parameters
     ] with-param-regs ;
 
@@ -475,7 +475,7 @@ TUPLE: callback-context ;
         [ callback-context new do-callback ] %
     ] [ ] make ;
 
-: %unnest-stacks ( -- ) "unnest_stacks" f %alien-invoke ;
+: %unnest-stacks ( -- ) "unnest_stacks" %vm-invoke ;
 
 M: ##callback-return generate-insn
     #! All the extra book-keeping for %unwind is only for x86.
index fe365f2e502f0a334f61a0b299dd90b11f281329..9499df7aafa7f67c902470706ef5e2f0170a2828 100755 (executable)
@@ -257,13 +257,13 @@ M: x86.32 %callback-value ( ctype -- )
     ESP 12 SUB
     ! Save top of data stack in non-volatile register
     %prepare-unbox
-    push-vm-ptr
     EAX PUSH
+    push-vm-ptr
     ! Restore data/call/retain stacks
     "unnest_stacks" f %alien-invoke
     ! Place top of data stack in EAX
-    EAX POP
     temp-reg POP
+    EAX POP
     ! Restore C stack
     ESP 12 ADD
     ! Unbox EAX
index da4e7d5286d7a6f021843a248a4ce44d2449e5e9..9ac787a02769347cf5b6ac00231b52df9bc14d8c 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 ;
+    "inline_gc" %vm-invoke ; ! (PHIL) TODO: vm-invoke won't work with ppc or x86.64. need %vm-invoke-3rd
 
 M: x86 %alien-global ( dst symbol library -- )
     [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;    
index 26197a4863290d47610a699247d4dc7cad0866e1..5acb7d5090dd61f013beac9dded7371519f8a57f 100644 (file)
@@ -92,8 +92,8 @@ void factorvm::nest_stacks()
 
 void nest_stacks(factorvm *myvm)
 {
-       printf("PHIL nest_stacks %d %d\n",vm,myvm);fflush(stdout);
-       return vm->nest_stacks();
+       ASSERTVM();
+       return VM_PTR->nest_stacks();
 }
 
 /* called when leaving a compiled callback */
@@ -113,8 +113,8 @@ void factorvm::unnest_stacks()
 
 void unnest_stacks(factorvm *myvm)
 {
-       printf("PHIL unnest_stacks %d %d\n",vm,myvm);fflush(stdout);
-       return vm->unnest_stacks();
+       ASSERTVM();
+       return VM_PTR->unnest_stacks();
 }
 
 /* called on startup */