cpu.x86.64: callback prologue was clobbering 5th parameter register on x86-64
							parent
							
								
									6fb91a042e
								
							
						
					
					
						commit
						c9ad0856d5
					
				| 
						 | 
				
			
			@ -763,6 +763,14 @@ mingw? [
 | 
			
		|||
[ S{ test-struct-11 f 7 -3 } ]
 | 
			
		||||
[ 3 4 7 fastcall-struct-return-iii-callback fastcall-struct-return-iii-indirect ] unit-test
 | 
			
		||||
 | 
			
		||||
: x64-regression-1 ( -- c )
 | 
			
		||||
    int { int int int int int } cdecl [ + + + + ] alien-callback ;
 | 
			
		||||
 | 
			
		||||
: x64-regression-2 ( x x x x x c -- y )
 | 
			
		||||
    int { int int int int int } cdecl alien-indirect ; inline
 | 
			
		||||
 | 
			
		||||
[ 661 ] [ 100 500 50 10 1 x64-regression-1 x64-regression-2 ] unit-test
 | 
			
		||||
 | 
			
		||||
! Stack allocation
 | 
			
		||||
: blah ( -- x ) { RECT } [ 1.5 >>x 2.0 >>y [ x>> ] [ y>> ] bi * >fixnum ] with-scoped-allocation ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,14 +58,10 @@ M: x86.64 %set-vm-field ( src offset -- )
 | 
			
		|||
M: x86.64 %vm-field-ptr ( dst offset -- )
 | 
			
		||||
    [ vm-reg ] dip [+] LEA ;
 | 
			
		||||
 | 
			
		||||
! Must be a volatile register not used for parameter passing or
 | 
			
		||||
! integer return
 | 
			
		||||
HOOK: temp-reg cpu ( -- reg )
 | 
			
		||||
 | 
			
		||||
M: x86.64 %prologue ( n -- )
 | 
			
		||||
    temp-reg -7 [RIP+] LEA
 | 
			
		||||
    R11 -7 [RIP+] LEA
 | 
			
		||||
    dup PUSH
 | 
			
		||||
    temp-reg PUSH
 | 
			
		||||
    R11 PUSH
 | 
			
		||||
    stack-reg swap 3 cells - SUB ;
 | 
			
		||||
 | 
			
		||||
M: x86.64 %prepare-jump
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,4 @@ M: x86.64 dummy-int-params? f ;
 | 
			
		|||
 | 
			
		||||
M: x86.64 dummy-fp-params? f ;
 | 
			
		||||
 | 
			
		||||
M: x86.64 temp-reg R8 ;
 | 
			
		||||
 | 
			
		||||
M: x86.64 %prepare-var-args RAX RAX XOR ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,5 +23,3 @@ M: x86.64 dummy-stack-params? f ;
 | 
			
		|||
M: x86.64 dummy-int-params? t ;
 | 
			
		||||
 | 
			
		||||
M: x86.64 dummy-fp-params? t ;
 | 
			
		||||
 | 
			
		||||
M: x86.64 temp-reg R11 ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue