Fix Joe Groff's x86-64 structs/callbacks bug

db4
Slava Pestov 2008-09-12 04:02:32 -05:00
parent 0eb8b5609c
commit 6d050a61a7
3 changed files with 6 additions and 7 deletions

View File

@ -173,6 +173,9 @@ M: x86.32 %box-long-long ( n func -- )
[ (%box-long-long) ] [ f %alien-invoke ] bi*
] with-aligned-stack ;
: struct-return@ ( size n -- n )
[ stack-frame* cell + + ] [ \ stack-frame get swap - ] ?if ;
M: x86.32 %box-large-struct ( n size -- )
! Compute destination address
[ swap struct-return@ ] keep

View File

@ -116,6 +116,9 @@ M: x86.64 %box-small-struct ( size -- )
RDX swap MOV
"box_small_struct" f %alien-invoke ;
: struct-return@ ( size n -- n )
[ ] [ \ stack-frame get swap - ] ?if ;
M: x86.64 %box-large-struct ( n size -- )
! Struct size is parameter 2
RSI over MOV

View File

@ -141,13 +141,6 @@ M: x86 small-enough? ( n -- ? )
: temp@ ( n -- op ) stack-reg \ stack-frame get rot - [+] ;
: struct-return@ ( size n -- n )
[
stack-frame* cell + +
] [
\ stack-frame get swap -
] ?if ;
HOOK: %unbox-struct-1 cpu ( -- )
HOOK: %unbox-struct-2 cpu ( -- )