diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index 7a7d1befd9..34d508fcf2 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -40,6 +40,7 @@ M:: x86.32 %dispatch ( src temp -- ) ! Registers for fastcall M: x86.32 param-reg-1 EAX ; M: x86.32 param-reg-2 EDX ; +M: x86.32 param-reg-3 ECX ; M: x86.32 pic-tail-reg EBX ; diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index c33368fc91..8363f7a18b 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -38,7 +38,7 @@ M:: x86.64 %dispatch ( src temp -- ) M: x86.64 param-reg-1 int-regs param-regs first ; M: x86.64 param-reg-2 int-regs param-regs second ; -: param-reg-3 ( -- reg ) int-regs param-regs third ; inline +M: x86.64 param-reg-3 int-regs param-regs third ; M: x86.64 pic-tail-reg RBX ; diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 8585dfa697..25dca527f6 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -55,6 +55,7 @@ HOOK: temp-reg cpu ( -- reg ) ! Fastcall calling convention HOOK: param-reg-1 cpu ( -- reg ) HOOK: param-reg-2 cpu ( -- reg ) +HOOK: param-reg-3 cpu ( -- reg ) HOOK: pic-tail-reg cpu ( -- reg ) @@ -832,8 +833,10 @@ M:: x86 %call-gc ( gc-root-count -- ) param-reg-1 gc-root-base param@ LEA ! Pass number of roots as second parameter param-reg-2 gc-root-count MOV + ! Pass vm as third argument + param-reg-3 0 MOV rc-absolute-cell rt-vm rel-fixup ! Call GC - "inline_gc" %vm-invoke-3rd-arg ; + "inline_gc" f %alien-invoke ; M: x86 %alien-global ( dst symbol library -- ) [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ; diff --git a/vm/cpu-x86.32.S b/vm/cpu-x86.32.S index 3a5907cc78..3eeb798093 100644 --- a/vm/cpu-x86.32.S +++ b/vm/cpu-x86.32.S @@ -94,12 +94,10 @@ DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to, void *vm)): jmp *QUOT_XT_OFFSET(ARG0) DEF(F_FASTCALL void,lazy_jit_compile,(CELL quot, void *vm)): - mov ARG1,NV_TEMP_REG /* stash vm ptr */ + mov ARG1,ARG2 mov STACK_REG,ARG1 /* Save stack pointer */ sub $STACK_PADDING,STACK_REG - push NV_TEMP_REG /* push vm ptr as arg3 */ call MANGLE(lazy_jit_compile_impl) - pop NV_TEMP_REG mov RETURN_REG,ARG0 /* No-op on 32-bit */ add $STACK_PADDING,STACK_REG jmp *QUOT_XT_OFFSET(ARG0) /* Call the quotation */ diff --git a/vm/cpu-x86.S b/vm/cpu-x86.S index 93c1da6430..e9116f8f65 100644 --- a/vm/cpu-x86.S +++ b/vm/cpu-x86.S @@ -48,9 +48,7 @@ DEF(F_FASTCALL void,c_to_factor,(CELL quot, void *vm)): /* Save stack pointer */ lea -CELL_SIZE(STACK_REG),ARG0 - push ARG1 /* save vm ptr */ call MANGLE(save_callstack_bottom) - pop ARG1 /* Call quot-xt */ mov NV_TEMP_REG,ARG0 diff --git a/vm/data_gc.cpp b/vm/data_gc.cpp index 8766cc8c7c..590000611a 100755 --- a/vm/data_gc.cpp +++ b/vm/data_gc.cpp @@ -681,7 +681,7 @@ void factor_vm::inline_gc(cell *gc_roots_base, cell gc_roots_size) gc_locals.pop_back(); } -VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm) +VM_ASM_API_OVERFLOW void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm) { ASSERTVM(); VM_PTR->inline_gc(gc_roots_base,gc_roots_size); diff --git a/vm/data_gc.hpp b/vm/data_gc.hpp index 411c4d19fe..4ef89c2327 100755 --- a/vm/data_gc.hpp +++ b/vm/data_gc.hpp @@ -20,6 +20,6 @@ PRIMITIVE(gc_stats); PRIMITIVE(clear_gc_stats); PRIMITIVE(become); struct factor_vm; -VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm); +VM_ASM_API_OVERFLOW void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm); } diff --git a/vm/quotations.cpp b/vm/quotations.cpp index 1bc6240481..e5a2a53f86 100755 --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -368,7 +368,7 @@ cell factor_vm::lazy_jit_compile_impl(cell quot_, stack_frame *stack) return quot.value(); } -VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factor_vm *myvm) +VM_ASM_API_OVERFLOW cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factor_vm *myvm) { ASSERTVM(); return VM_PTR->lazy_jit_compile_impl(quot_,stack); diff --git a/vm/quotations.hpp b/vm/quotations.hpp index b21884a35b..43beb05112 100755 --- a/vm/quotations.hpp +++ b/vm/quotations.hpp @@ -27,7 +27,7 @@ PRIMITIVE(jit_compile); PRIMITIVE(array_to_quotation); PRIMITIVE(quotation_xt); -VM_ASM_API cell lazy_jit_compile_impl(cell quot, stack_frame *stack, factor_vm *myvm); +VM_ASM_API_OVERFLOW cell lazy_jit_compile_impl(cell quot, stack_frame *stack, factor_vm *myvm); PRIMITIVE(quot_compiled_p);