Stack alignment fixes

slava 2006-07-06 05:01:05 +00:00
parent ca7acc29df
commit 200dbc4edd
2 changed files with 12 additions and 4 deletions

View File

@ -76,15 +76,19 @@ USING: assembler kernel kernel-internals math namespaces ;
"run_callback" f %alien-invoke
] with-aligned-stack ;
: align-callback-value ( reg-class -- reg n )
ESP 16 rot reg-size - ;
: %callback-value ( reg-class func -- )
f %alien-invoke ! Call the unboxer
ESP 12 ADD
! Call the unboxer
f %alien-invoke
dup align-callback-value SUB
! Save return register
dup push-return-reg
! Restore data/call/retain stacks
"unnest_stacks" f %alien-invoke
! Restore return register
pop-return-reg
ESP 12 SUB ;
dup pop-return-reg
align-callback-value ADD ;
: %cleanup ( n -- ) drop ;

View File

@ -222,10 +222,14 @@ IN: compiler
! There was an overflow, so make ECX into a bignum. we must
! save EDX since its volatile.
remainder-reg PUSH
! Align the stack -- only needed on Mac OS X
ESP 12 SUB
"s48_long_to_bignum" f
"y" operand 1array compile-c-call*
! An untagged pointer to the bignum is now in EAX; tag it
T{ int-regs } return-reg bignum-tag OR
! Align the stack -- only needed on Mac OS X
ESP 12 ADD
! the remainder is now in EDX
remainder-reg POP
"end" get save-xt ;