From 005549ba43bae34eae3166ea1e1f418a38259d1e Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Sun, 23 Aug 2009 20:04:05 +0100 Subject: [PATCH] vm pointer passed to nest_stacks and unnest_stacks (win32) --- basis/compiler/codegen/codegen.factor | 4 ++-- basis/cpu/x86/32/32.factor | 4 ++-- basis/cpu/x86/x86.factor | 2 +- vm/contexts.cpp | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index de15cda21c..6d43adf933 100755 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -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. diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index fe365f2e50..9499df7aaf 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -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 diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index da4e7d5286..9ac787a027 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -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 ; diff --git a/vm/contexts.cpp b/vm/contexts.cpp index 26197a4863..5acb7d5090 100644 --- a/vm/contexts.cpp +++ b/vm/contexts.cpp @@ -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 */ -- 2.34.1