]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.x86.64: callback prologue was clobbering 5th parameter register on x86-64
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 23 May 2010 07:00:53 +0000 (03:00 -0400)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 23 May 2010 07:00:53 +0000 (03:00 -0400)
basis/compiler/tests/alien.factor
basis/cpu/x86/64/64.factor
basis/cpu/x86/64/unix/unix.factor
basis/cpu/x86/64/winnt/winnt.factor

index 7045e64928d5efc1ea58cd4252c82a5afbf3f731..476e6da39e0757da0043ef66da344d4dfd4a3a29 100755 (executable)
@@ -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 ;
 
index ad4fc626f15d3d92f7eeca2cae25aaaf9a7eec10..bde0507af971b746dde6b9139788e889641c0250 100644 (file)
@@ -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
index c25cfa19ec433522a16e56f84a8a50cff0d1fd4a..2ce959d29a85c2de7bb4d41e6fd0e8fd91709974 100644 (file)
@@ -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 ;
index 011de59ccb885a595fca99e6726b1b65399d706b..7f1f29a6037b19ca463b82aee34df87b1d535730 100644 (file)
@@ -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 ;