Fix bug with large structs passed by value on x86.64
parent
7ef777c3ad
commit
a3d1379b8c
|
@ -325,12 +325,16 @@ M: single-float-regs reg-size drop 4 ;
|
|||
|
||||
M: double-float-regs reg-size drop 8 ;
|
||||
|
||||
M: stack-params reg-size drop "void*" heap-size ;
|
||||
|
||||
GENERIC: reg-class-variable ( register-class -- symbol )
|
||||
|
||||
M: reg-class reg-class-variable ;
|
||||
|
||||
M: float-regs reg-class-variable drop float-regs ;
|
||||
|
||||
M: stack-params reg-class-variable drop stack-params ;
|
||||
|
||||
GENERIC: inc-reg-class ( register-class -- )
|
||||
|
||||
M: reg-class inc-reg-class
|
||||
|
|
|
@ -279,7 +279,7 @@ FUNCTION: double ffi_test_35 test-struct-11 x int y ;
|
|||
|
||||
C-STRUCT: test-struct-12 { "int" "a" } { "double" "x" } ;
|
||||
|
||||
: make-struct-12
|
||||
: make-struct-12 ( x -- alien )
|
||||
"test-struct-12" <c-object>
|
||||
[ set-test-struct-12-x ] keep ;
|
||||
|
||||
|
@ -380,3 +380,24 @@ FUNCTION: int ffi_test_37 ( void* func ) ;
|
|||
[ 1 ] [ callback-9 ffi_test_37 ] unit-test
|
||||
|
||||
[ 7 ] [ callback-9 ffi_test_37 ] unit-test
|
||||
|
||||
C-STRUCT: test_struct_13
|
||||
{ "float" "x1" }
|
||||
{ "float" "x2" }
|
||||
{ "float" "x3" }
|
||||
{ "float" "x4" }
|
||||
{ "float" "x5" }
|
||||
{ "float" "x6" } ;
|
||||
|
||||
: make-test-struct-13 ( -- alien )
|
||||
"test_struct_13" <c-object>
|
||||
1.0 over set-test_struct_13-x1
|
||||
2.0 over set-test_struct_13-x2
|
||||
3.0 over set-test_struct_13-x3
|
||||
4.0 over set-test_struct_13-x4
|
||||
5.0 over set-test_struct_13-x5
|
||||
6.0 over set-test_struct_13-x6 ;
|
||||
|
||||
FUNCTION: int ffi_test_39 ( long a, long b, test_struct_13 s ) ;
|
||||
|
||||
[ 21 ] [ 12347 12347 make-test-struct-13 ffi_test_39 ] unit-test
|
||||
|
|
|
@ -150,6 +150,8 @@ HOOK: %alien-indirect cpu ( -- )
|
|||
|
||||
M: stack-params param-reg drop ;
|
||||
|
||||
M: stack-params param-regs drop f ;
|
||||
|
||||
GENERIC: v>operand ( obj -- operand )
|
||||
|
||||
M: integer v>operand tag-fixnum ;
|
||||
|
|
|
@ -274,4 +274,9 @@ unsigned long long ffi_test_38(unsigned long long x, unsigned long long y)
|
|||
return x * y;
|
||||
}
|
||||
|
||||
|
||||
int ffi_test_39(long a, long b, struct test_struct_13 s)
|
||||
{
|
||||
printf("ffi_test_39(%ld,%ld,%f,%f,%f,%f,%f,%f)\n",a,b,s.x1,s.x2,s.x3,s.x4,s.x5,s.x6);
|
||||
if(a != b) abort();
|
||||
return s.x1 + s.x2 + s.x3 + s.x4 + s.x5 + s.x6;
|
||||
}
|
||||
|
|
|
@ -67,3 +67,7 @@ DLLEXPORT void ffi_test_36_point_5(void);
|
|||
DLLEXPORT int ffi_test_37(int (*f)(int, int, int));
|
||||
|
||||
DLLEXPORT unsigned long long ffi_test_38(unsigned long long x, unsigned long long y);
|
||||
|
||||
struct test_struct_13 { float x1, x2, x3, x4, x5, x6; };
|
||||
|
||||
DLLEXPORT int ffi_test_39(long a, long b, struct test_struct_13 s);
|
||||
|
|
Loading…
Reference in New Issue