From 4552e02624c22d7f6935e519a14a22a4a4bb65f4 Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Fri, 25 Sep 2009 18:29:07 +0100 Subject: [PATCH] made inline_gc a VM_C_API function --- basis/cpu/x86/32/32.factor | 13 +++++++++++++ basis/cpu/x86/64/64.factor | 10 ++++++++++ basis/cpu/x86/x86.factor | 10 ---------- vm/data_gc.cpp | 2 +- vm/data_gc.hpp | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index 34d508fcf2..a687c9d6b0 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -311,6 +311,19 @@ M: x86.32 %callback-return ( n -- ) [ drop 0 ] } cond RET ; +M:: x86.32 %call-gc ( gc-root-count -- ) + EAX gc-root-base param@ LEA + 12 [ + push-vm-ptr + ! Pass number of roots as second parameter + temp-reg gc-root-count MOV + temp-reg PUSH + ! Pass pointer to start of GC roots as first parameter + EAX PUSH + ! Call GC + "inline_gc" f %alien-invoke + ] with-aligned-stack ; + M: x86.32 dummy-stack-params? f ; M: x86.32 dummy-int-params? f ; diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index 8363f7a18b..cf90a47c0f 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -233,6 +233,16 @@ M:: x86.64 %binary-float-function ( dst src1 src2 func -- ) func f %alien-invoke dst float-function-return ; +M:: x86.64 %call-gc ( gc-root-count -- ) + ! Pass pointer to start of GC roots as first parameter + 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 parameter + param-reg-3 0 MOV rc-absolute-cell rt-vm rel-fixup + ! Call GC + "inline_gc" f %alien-invoke ; + ! The result of reading 4 bytes from memory is a fixnum on ! x86-64. enable-alien-4-intrinsics diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 25dca527f6..1d3125d997 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -828,16 +828,6 @@ M: x86 %save-gc-root ( gc-root register -- ) [ gc-root@ ] dip MOV ; M: x86 %load-gc-root ( gc-root register -- ) swap gc-root@ MOV ; -M:: x86 %call-gc ( gc-root-count -- ) - ! Pass pointer to start of GC roots as first parameter - 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" 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 590000611a..0c0b995732 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_OVERFLOW void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm) +VM_C_API 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 4ef89c2327..87c66f2433 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_OVERFLOW void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm); +VM_C_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm); } -- 2.34.1