From f5c70d4ad774fcf816f4378cf0dce2906b6ac4fe Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Thu, 24 Sep 2009 21:45:56 +0100 Subject: [PATCH] make inline_gc regparm(3) and cleaned up %call-gc stack alignment --- basis/cpu/x86/32/32.factor | 1 + basis/cpu/x86/64/64.factor | 2 +- basis/cpu/x86/x86.factor | 5 ++++- vm/data_gc.cpp | 2 +- vm/data_gc.hpp | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) 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/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); }