add fastcall functions to ffi tests
parent
9d3326658c
commit
fca8ba3d0a
|
@ -22,6 +22,8 @@ IN: compiler.tests.alien
|
||||||
"f-cdecl" libfactor-ffi-tests-path cdecl add-library
|
"f-cdecl" libfactor-ffi-tests-path cdecl add-library
|
||||||
|
|
||||||
"f-stdcall" libfactor-ffi-tests-path stdcall add-library
|
"f-stdcall" libfactor-ffi-tests-path stdcall add-library
|
||||||
|
|
||||||
|
"f-fastcall" libfactor-ffi-tests-path fastcall add-library
|
||||||
>>
|
>>
|
||||||
|
|
||||||
LIBRARY: f-cdecl
|
LIBRARY: f-cdecl
|
||||||
|
@ -603,3 +605,23 @@ FUNCTION: void this_does_not_exist ( ) ;
|
||||||
: assembly-test-1 ( -- ) void { } cdecl [ ] alien-assembly ;
|
: assembly-test-1 ( -- ) void { } cdecl [ ] alien-assembly ;
|
||||||
|
|
||||||
[ ] [ assembly-test-1 ] unit-test
|
[ ] [ assembly-test-1 ] unit-test
|
||||||
|
|
||||||
|
LIBRARY: f-fastcall
|
||||||
|
|
||||||
|
FUNCTION: int ffi_test_49 ( int x ) ;
|
||||||
|
FUNCTION: int ffi_test_50 ( int x, int y ) ;
|
||||||
|
FUNCTION: int ffi_test_51 ( int x, int y, int z ) ;
|
||||||
|
FUNCTION: int ffi_test_52 ( int x, float y, int z ) ;
|
||||||
|
FUNCTION: int ffi_test_53 ( int x, float y, int z, int w ) ;
|
||||||
|
FUNCTION: int ffi_test_54 ( test-struct-11 x, int y ) ;
|
||||||
|
FUNCTION: int ffi_test_55 ( int x, int y, int z ) ;
|
||||||
|
FUNCTION: int ffi_test_56 ( int x, int y, int z ) ;
|
||||||
|
|
||||||
|
[ 4 ] [ 3 ffi_test_49 ] unit-test
|
||||||
|
[ 8 ] [ 3 4 ffi_test_50 ] unit-test
|
||||||
|
[ 13 ] [ 3 4 5 ffi_test_51 ] unit-test
|
||||||
|
[ 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 <struct> 5 ffi_test_54 ] unit-test
|
||||||
|
[ 19 ] [ 3 4 test-struct-11 <struct> 5 6 ffi_test_55 ] unit-test
|
||||||
|
[ 26 ] [ 3 4 test-struct-11 <struct> 5 6 7 ffi_test_56 ] unit-test
|
||||||
|
|
|
@ -329,3 +329,27 @@ short ffi_test_48(struct bool_field_test x)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_49(int x) { return x + 1; }
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_50(int x, int y) { return x + y + 1; }
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_51(int x, int y, int z) { return x + y + z + 1; }
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_52(int x, float y, int z) { return x + y + z + 1; }
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_53(int x, float y, int z, int w)
|
||||||
|
{
|
||||||
|
return x + y + z + w + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_54(test_struct_11 x, int y)
|
||||||
|
{
|
||||||
|
return x.x + x.y + y + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_55(test_struct_11 x, int y, int z)
|
||||||
|
{
|
||||||
|
return x.x + x.y + y + z + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FACTOR_FASTCALL(int) ffi_test_56(test_struct_11 x, int y, int z, int w)
|
||||||
|
{
|
||||||
|
return x.x + x.y + y + z + w + 1;
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#define FACTOR_STDCALL(return_type) return_type __stdcall
|
#define FACTOR_STDCALL(return_type) return_type __stdcall
|
||||||
|
#define FACTOR_FASTCALL(return_type) return_type __fastcall
|
||||||
#elif defined(i386) || defined(__i386) || defined(__i386__)
|
#elif defined(i386) || defined(__i386) || defined(__i386__)
|
||||||
#define FACTOR_STDCALL(return_type) __attribute__((stdcall)) return_type
|
#define FACTOR_STDCALL(return_type) __attribute__((stdcall)) return_type
|
||||||
|
#define FACTOR_FASTCALL(return_type) __attribute__((fastcall)) return_type
|
||||||
#else
|
#else
|
||||||
#define FACTOR_STDCALL(return_type) return_type
|
#define FACTOR_STDCALL(return_type) return_type
|
||||||
|
#define FACTOR_FASTCALL(return_type) return_type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
@ -119,3 +122,12 @@ struct bool_field_test {
|
||||||
FACTOR_EXPORT short ffi_test_48(struct bool_field_test x);
|
FACTOR_EXPORT short ffi_test_48(struct bool_field_test x);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_49(int x);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_50(int x, int y);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_51(int x, int y, int z);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_52(int x, float y, int z);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_53(int x, float y, int z, int w);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_54(test_struct_11 x, int y);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_55(test_struct_11 x, int y, int z);
|
||||||
|
FACTOR_EXPORT FACTOR_FASTCALL(int) ffi_test_56(test_struct_11 x, int y, int z, int w);
|
||||||
|
|
Loading…
Reference in New Issue