added vm ptr to x86.32 boxing asm

Phil Dawes 2009-08-22 10:21:32 +01:00
parent 780415b159
commit 6c046ec5bf
1 changed files with 11 additions and 6 deletions

View File

@ -47,9 +47,12 @@ M: x86.32 reserved-area-size 0 ;
M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ; M: x86.32 %alien-invoke 0 CALL rc-relative rel-dlsym ;
M: x86.32 %vm-invoke ( function -- ) : push-vm-ptr ( -- )
temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument
temp-reg PUSH temp-reg PUSH ;
M: x86.32 %vm-invoke ( function -- )
push-vm-ptr
f %alien-invoke f %alien-invoke
temp-reg POP ; temp-reg POP ;
@ -109,9 +112,12 @@ M: x86.32 %save-param-reg 3drop ;
#! parameter being passed to a callback from C. #! parameter being passed to a callback from C.
over [ load-return-reg ] [ 2drop ] if ; over [ load-return-reg ] [ 2drop ] if ;
CONSTANT: vm-ptr-size 4
M:: x86.32 %box ( n rep func -- ) M:: x86.32 %box ( n rep func -- )
n rep (%box) n rep (%box)
rep rep-size [ rep rep-size vm-ptr-size + [
push-vm-ptr
rep push-return-reg rep push-return-reg
func f %alien-invoke func f %alien-invoke
] with-aligned-stack ; ] with-aligned-stack ;
@ -164,9 +170,8 @@ M: x86.32 %prepare-unbox ( -- )
: call-unbox-func ( func -- ) : call-unbox-func ( func -- )
8 [ 8 [
! push vm ptr ! push the vm ptr as an argument
temp-reg 0 MOV rc-absolute-cell rt-vm rel-fixup ! push the vm ptr as an argument push-vm-ptr
temp-reg PUSH
! Push parameter ! Push parameter
EAX PUSH EAX PUSH
! Call the unboxer ! Call the unboxer