diff --git a/basis/compiler/tests/alien.factor b/basis/compiler/tests/alien.factor index d4dd1f6eb8..fdbcf6948e 100755 --- a/basis/compiler/tests/alien.factor +++ b/basis/compiler/tests/alien.factor @@ -653,12 +653,20 @@ FUNCTION: void this_does_not_exist ( ) ; : ffi_test_56 ( x y z w -- int ) int "f-fastcall" "ffi_test_56" { test-struct-11 int int int } alien-invoke gc ; +: ffi_test_57 ( x y -- test-struct-11 ) + test-struct-11 "f-fastcall" "ffi_test_57" { int int } + alien-invoke gc ; +: ffi_test_58 ( x y z -- test-struct-11 ) + test-struct-11 "f-fastcall" "ffi_test_58" { int int int } + alien-invoke gc ; [ 13 ] [ 3 4.0 5 ffi_test_52 ] unit-test [ 19 ] [ 3 4.0 5 6 ffi_test_53 ] unit-test [ 13 ] [ 3 4 test-struct-11 5 ffi_test_54 ] unit-test [ 19 ] [ 3 4 test-struct-11 5 6 ffi_test_55 ] unit-test [ 26 ] [ 3 4 test-struct-11 5 6 7 ffi_test_56 ] unit-test +[ S{ test-struct-11 f 7 -1 } ] [ 3 4 ffi_test_57 ] unit-test +[ S{ test-struct-11 f 7 -3 } ] [ 3 4 7 ffi_test_58 ] unit-test : fastcall-ii-indirect ( x y ptr -- result ) int { int int } fastcall alien-indirect ; @@ -667,3 +675,4 @@ FUNCTION: void this_does_not_exist ( ) ; [ 8 ] [ 3 4 &: ffi_test_50 fastcall-ii-indirect ] unit-test [ 13 ] [ 3 4.0 5 &: ffi_test_52 fastcall-ifi-indirect ] unit-test + diff --git a/vm/ffi_test.c b/vm/ffi_test.c index d45a08cf8b..993ca18fa3 100755 --- a/vm/ffi_test.c +++ b/vm/ffi_test.c @@ -353,3 +353,15 @@ FACTOR_FASTCALL(int) ffi_test_56(struct test_struct_11 x, int y, int z, int w) { return x.x + x.y + y + z + w + 1; } + +FACTOR_FASTCALL(struct test_struct_11) ffi_test_57(int x, int y) +{ + struct test_struct_11 r = { x + y, x - y }; + return r; +} + +FACTOR_FASTCALL(struct test_struct_11) ffi_test_58(int x, int y, int z) +{ + struct test_struct_11 r = { x + y, y - z }; + return r; +} diff --git a/vm/ffi_test.h b/vm/ffi_test.h index 6fe35fdb42..08b8f95c39 100755 --- a/vm/ffi_test.h +++ b/vm/ffi_test.h @@ -131,3 +131,5 @@ FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_53(int x, float y, int z, int w); FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_54(struct test_struct_11 x, int y); FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_55(struct test_struct_11 x, int y, int z); FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_56(struct test_struct_11 x, int y, int z, int w); +FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) ffi_test_57(int x, int y); +FACTOR_EXPORT FACTOR_FASTCALL(struct test_struct_11) ffi_test_58(int x, int y, int z);