cpu.x86: get rid of this extra-stack-space nonsense

db4
Slava Pestov 2010-05-17 02:14:44 -04:00
parent 3f8e13bf66
commit 7ff309d50e
7 changed files with 11 additions and 15 deletions

View File

@ -21,7 +21,7 @@ M: ##stack-frame compute-stack-frame*
: vm-frame-required ( -- )
frame-required
stack-frame new t >>calls-vm? request-stack-frame ;
stack-frame new vm-stack-space >>params request-stack-frame ;
M: ##call-gc compute-stack-frame* drop vm-frame-required ;
M: ##box compute-stack-frame* drop vm-frame-required ;

View File

@ -96,8 +96,7 @@ M: array dlsym-valid? '[ _ dlsym ] any? ;
: <alien-stack-frame> ( stack-size return -- stack-frame )
stack-frame new
swap return-size >>return
swap >>params
t >>calls-vm? ;
swap >>params ;
: emit-stack-frame ( stack-size params -- )
[ return>> ] [ abi>> ] bi

View File

@ -9,8 +9,7 @@ TUPLE: stack-frame
{ params integer }
{ return integer }
{ spill-area-size integer }
{ total-size integer }
{ calls-vm? boolean } ;
{ total-size integer } ;
! Stack frame utilities
: return-offset ( -- offset )
@ -28,5 +27,4 @@ TUPLE: stack-frame
[ [ params>> ] bi@ max >>params ]
[ [ return>> ] bi@ max >>return ]
[ [ spill-area-size>> ] bi@ max >>spill-area-size ]
[ [ calls-vm?>> ] bi@ or >>calls-vm? ]
} 2cleave ;

View File

@ -215,6 +215,11 @@ HOOK: machine-registers cpu ( -- assoc )
! Callbacks are not allowed to clobber this
HOOK: frame-reg cpu ( -- reg )
! Parameter space to reserve in anything making VM calls
HOOK: vm-stack-space cpu ( -- n )
M: object vm-stack-space 0 ;
! Specifies if %slot, %set-slot and %write-barrier accept the
! 'scale' and 'tag' parameters, and if %load-memory and
! %store-memory work

View File

@ -39,8 +39,6 @@ M: x86.32 %set-vm-field ( dst field -- )
M: x86.32 %vm-field-ptr ( dst field -- )
[ 0 MOV ] dip rc-absolute-cell rel-vm ;
M: x86.32 extra-stack-space calls-vm?>> 16 0 ? ;
M: x86.32 %mark-card
drop HEX: ffffffff [+] card-mark <byte> MOV
building get pop
@ -71,6 +69,8 @@ M: x86.32 pic-tail-reg EDX ;
M: x86.32 reserved-stack-space 0 ;
M: x86.32 vm-stack-space 16 ;
: save-vm-ptr ( n -- )
stack@ 0 MOV 0 rc-absolute-cell rel-vm ;

View File

@ -31,8 +31,6 @@ M: x86.64 rs-reg R15 ;
M: x86.64 stack-reg RSP ;
M: x86.64 frame-reg RBP ;
M: x86.64 extra-stack-space drop 0 ;
M: x86.64 machine-registers
{
{ int-regs { RAX RCX RDX RBX RBP RSI RDI R8 R9 R10 R11 R12 } }

View File

@ -28,12 +28,9 @@ HOOK: stack-reg cpu ( -- reg )
HOOK: reserved-stack-space cpu ( -- n )
HOOK: extra-stack-space cpu ( stack-frame -- n )
: stack@ ( n -- op ) stack-reg swap [+] ;
: special-offset ( m -- n )
stack-frame get extra-stack-space +
reserved-stack-space + ;
: spill@ ( n -- op ) spill-offset special-offset stack@ ;
@ -50,8 +47,7 @@ HOOK: extra-stack-space cpu ( stack-frame -- n )
: align-stack ( n -- n' ) 16 align ;
M: x86 stack-frame-size ( stack-frame -- i )
[ (stack-frame-size) ]
[ extra-stack-space ] bi +
(stack-frame-size)
reserved-stack-space +
3 cells +
align-stack ;