From: Phil Dawes Date: Tue, 25 Aug 2009 05:41:37 +0000 (+0100) Subject: separated vm-1st-arg and vm-3rd-arg asm invoke words (needed for ppc & x86.64) X-Git-Tag: 0.97~5502^2~2^2~39 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=0bc7c0c1d0cadbead754ebaa4bbe32a981a7f374 separated vm-1st-arg and vm-3rd-arg asm invoke words (needed for ppc & x86.64) --- diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index 6d43adf933..f41bc853b5 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" %vm-invoke + "nest_stacks" %vm-invoke-1st-arg box-parameters ] with-param-regs ; @@ -475,7 +475,7 @@ TUPLE: callback-context ; [ callback-context new do-callback ] % ] [ ] make ; -: %unnest-stacks ( -- ) "unnest_stacks" %vm-invoke ; +: %unnest-stacks ( -- ) "unnest_stacks" %vm-invoke-1st-arg ; M: ##callback-return generate-insn #! All the extra book-keeping for %unwind is only for x86. diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index 6d88944881..fbec9f697a 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -298,7 +298,8 @@ M: object %prepare-var-args ; HOOK: %alien-invoke cpu ( function library -- ) -HOOK: %vm-invoke cpu ( function -- ) +HOOK: %vm-invoke-1st-arg cpu ( function -- ) +HOOK: %vm-invoke-3rd-arg cpu ( function -- ) HOOK: %cleanup cpu ( params -- ) diff --git a/basis/cpu/ppc/ppc.factor b/basis/cpu/ppc/ppc.factor index fc6a122101..83f1bc9a74 100644 --- a/basis/cpu/ppc/ppc.factor +++ b/basis/cpu/ppc/ppc.factor @@ -38,6 +38,9 @@ enable-float-intrinsics M: ppc %vm-field-ptr ( dst field -- ) %load-vm-field-addr ; +M: ppc %vm-invoke-1st-arg ( function -- ) f %alien-invoke ; +M: ppc %vm-invoke-3rd-arg ( function -- ) f %alien-invoke ; + M: ppc machine-registers { { int-regs $[ 2 12 [a,b] 15 29 [a,b] append ] } diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index 9499df7aaf..f711455fa3 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -51,11 +51,14 @@ M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ; temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument temp-reg PUSH ; -M: x86.32 %vm-invoke ( function -- ) +M: x86.32 %vm-invoke-1st-arg ( function -- ) push-vm-ptr f %alien-invoke temp-reg POP ; +M: x86.32 %vm-invoke-3rd-arg ( function -- ) + %vm-invoke-1st-arg ; ! first 2 args are regs, 3rd is stack so vm-invoke-1st-arg works here + M: x86.32 return-struct-in-registers? ( c-type -- ? ) c-type [ return-in-registers?>> ] diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index 06592078d8..8c713eac8b 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -172,7 +172,9 @@ M: x86.64 %alien-invoke rc-absolute-cell rel-dlsym R11 CALL ; -M: x86.64 %vm-invoke ( function -- ) f %alien-invoke ; +M: x86.64 %vm-invoke-1st-arg ( function -- ) f %alien-invoke ; + +M: x86.64 %vm-invoke-3rd-arg ( function -- ) f %alien-invoke ; M: x86.64 %prepare-alien-indirect ( -- ) "unbox_alien" f %alien-invoke diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index 9ac787a027..91705efec6 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 ; ! (PHIL) TODO: vm-invoke won't work with ppc or x86.64. need %vm-invoke-3rd + "inline_gc" %vm-invoke-3rd-arg ; M: x86 %alien-global ( dst symbol library -- ) [ 0 MOV ] 2dip rc-absolute-cell rel-dlsym ;