int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void * code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_uint64;
cl_arg_types[1] = &ffi_type_sint;
cl_arg_types[2] = &ffi_type_uint64;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type0)pcl))
+ res = (*((closure_test_type0)code))
(1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13,
19, 21, 1);
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_float;
cl_arg_types[1] = &ffi_type_float;
cl_arg_types[2] = &ffi_type_float;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type1)pcl))
+ res = (*((closure_test_type1)code))
(1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13,
19, 21, 1);
/* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_double;
cl_arg_types[1] = &ffi_type_double;
cl_arg_types[2] = &ffi_type_double;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn2,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type2)pcl))
+ res = (*((closure_test_type2)code))
(1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13,
19.0, 21, 1);
/* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_float;
cl_arg_types[1] = &ffi_type_float;
cl_arg_types[2] = &ffi_type_float;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn3,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type3)pcl))
+ res = (*((closure_test_type3)code))
(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13,
19.19, 21.21, 1);
/* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int i, res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
for (i = 0; i < 15; i++) {
cl_arg_types[i] = &ffi_type_uint64;
}
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type0)pcl))
+ res = (*((closure_test_type0)code))
(1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL,
13LL, 19LL, 21LL, 1);
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int i, res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
for (i = 0; i < 10; i++) {
cl_arg_types[i] = &ffi_type_uint64;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn5,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type0)pcl))
+ res = (*((closure_test_type0)code))
(1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL,
13LL, 19LL, 21LL, 1);
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_uint64;
cl_arg_types[1] = &ffi_type_uint64;
cl_arg_types[2] = &ffi_type_uint64;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn0,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0,
+ (void *) 3 /* userdata */, code) == FFI_OK);
- res = (*((closure_test_type0)pcl))
+ res = (*((closure_test_type0)code))
(1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13,
19, 21., 1.);
/* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
int res;
void* sp_pre;
void* sp_post;
char buf[1024];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_uint;
cl_arg_types[1] = &ffi_type_uint;
cl_arg_types[2] = &ffi_type_uint;
CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_stdcall,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall,
+ (void *) 3 /* userdata */, code) == FFI_OK);
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
- res = (*(closure_test_type0)pcl)(0, 1, 2, 3);
+ res = (*(closure_test_type0)code)(0, 1, 2, 3);
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
/* { dg-output "0 1 2 3: 9" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 8 9 12" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_12byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK);
res_dbl.a = 0;
res_dbl.b = 0;
res_dbl.c = 0;
- res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(pcl))(h_dbl, j_dbl);
+ res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl);
/* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 8 9 12" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.b = 0.0;
res_dbl.c = 0;
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_16byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(pcl))(h_dbl, j_dbl);
+ res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl);
/* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */
printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 8 17 12" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[5];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 5 252 250 8" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_18byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */
printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 5 252 250 8" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[6];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.d, res_dbl.e);
/* { dg-output "\nres: 5 252 250 8 239" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_19byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */
printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[2];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d\n", res_dbl.a);
/* { dg-output "\nres: 190" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_1_1byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 178: 190" } */
printf("res: %d\n", res_dbl.a);
/* { dg-output "\nres: 190" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 5 7 10" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */
printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 5 7 10" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 5 7 10" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */
printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 5 7 10" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 22 15 17 25" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_24byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK);
res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte,
cls_struct_24byte,
cls_struct_24byte,
cls_struct_24byte))
- (pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ (code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */
printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 22 15 17 25" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 13 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_2byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 127 1 13: 13 140" } */
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 13 140" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 190 192 194" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3_1byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 190 192 194" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 13 134" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 119 1 15: 13 134" } */
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 13 134" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 24 144" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn1, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl);
/* { dg-output "\n15 125 9 19: 24 144" } */
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 24 144" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 190 192 194 196" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4_1byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 190 192 194 196" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 139 248" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 12 128: 139 248" } */
printf("res: %d %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 139 248" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[6];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.d = 0;
res_dbl.e = 0;
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */
printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.b = 0;
res_dbl.c = 0;
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 139 248 10" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[9];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h);
/* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_64byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK);
res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte,
cls_struct_64byte,
cls_struct_64byte,
cls_struct_64byte))
- (pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ (code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n22 15 17 25 6 13 19 18" } */
printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[7];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.e = 0;
res_dbl.f = 0;
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_6byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */
printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e, res_dbl.f);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 139 248 10 255" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_6byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 139 248 10 255" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[8];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.f = 0;
res_dbl.g = 0;
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_7byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */
printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 139 248 10 509" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_7byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 139 248 10 509" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
/* { dg-output "1 2 4 5: 5 7" } */
printf("res: %d %g\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 5 7" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_8byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 2 4 5: 5 7" } */
printf("res: %d %g\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 5 7" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %g\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 8 17" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl);
+ res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl);
/* { dg-output "\n7 8 1 9: 8 17" } */
printf("res: %d %g\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 8 17" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
/* { dg-output "\nres: 8 17" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl);
+ res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl);
/* { dg-output "\n7 8 1 9: 8 17" } */
printf("res: %g %d\n", res_dbl.a, res_dbl.b);
/* { dg-output "\nres: 8 17" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run } */
#include "ffitest.h"
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
PR: none.
Originator: <hos@tamanegi.org> 20031203 */
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h"
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[8];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
/* { dg-output "\nres: 9 11 13 15 17 19 21" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */
printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b,
res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
Originator: Blake Chaffin 6/18/2007
*/
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h"
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[8];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
/* { dg-output "\nres: 9 11 13 15 17 19 21" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */
printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b,
res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g);
exit(0);
}
+
+
+
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
result.b = a1.b + a2.b;
result.c = a1.c + a2.c;
- printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
+ printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
return result;
}
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
/* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
- printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+ printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
- printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+ printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
exit(0);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
result.b = a1.b + a2.b;
result.c = a1.c + a2.c;
- printf("%d %lld %d %d %lld %d: %d %lld %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
+ printf("%d %" PRId64 " %d %d %" PRId64 " %d: %d %" PRId64 " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c);
return result;
}
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[4];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl);
/* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */
- printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+ printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK);
- res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl);
+ res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl);
/* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */
- printf("res: %d %lld %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
+ printf("res: %d %" PRId64 " %d\n", res_dbl.a, res_dbl.b, res_dbl.c);
/* { dg-output "\nres: 13 14271 140" } */
exit(0);
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
-
- ffi_closure* pcl;
+ void *code;
+ ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type* cl_arg_types[1];
-#ifdef USING_MMAP
- pcl = allocate_mmap(sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
ffi_type ts1_type;
ffi_type* ts1_type_elements[4];
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_void, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK);
- ((void*(*)(Dbls))(pcl))(arg);
+ ((void*(*)(Dbls))(code))(arg);
/* { dg-output "1.0 2.0\n" { xfail x86_64-*-linux-* } } */
closure_test_fn(arg);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
double res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_double;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_double, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_double_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_double)pcl))(21474.789);
+ res = (*((cls_ret_double)code))(21474.789);
/* { dg-output "21474.789000: 21474.789000" } */
printf("res: %.6f\n", res);
/* { dg-output "\nres: 21474.789000" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3];
ffi_type* arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap(sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
char* format = "%.1f\n";
double doubleArg = 7;
ffi_arg res = 0;
printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" }
- CHECK(ffi_prep_closure(pcl, &cif, cls_double_va_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK);
- res = ((int(*)(char*, double))(pcl))(format, doubleArg);
+ res = ((int(*)(char*, double))(code))(format, doubleArg);
// { dg-output "\n7.0" }
printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" }
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
float res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
-
cl_arg_types[0] = &ffi_type_float;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_float, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_float_fn, NULL) == FFI_OK);
- res = ((((cls_ret_float)pcl)(-2122.12)));
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK);
+ res = ((((cls_ret_float)code)(-2122.12)));
/* { dg-output "\\-2122.12: \\-2122.12" } */
printf("res: %.6f\n", res);
/* { dg-output "\nres: \-2122.120117" } */
PR: none.
Originator: Blake Chaffin */
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h"
int main(void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure* pcl;
+ void* code;
+ ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[9];
ffi_type* arg_types[9];
long double res = 0;
-#ifdef USING_MMAP
- pcl = allocate_mmap(sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
long double arg1 = 1;
long double arg2 = 2;
long double arg3 = 3;
printf("res: %Lg\n", res);
/* { dg-output "\nres: 36" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_ldouble_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK);
res = ((long double(*)(long double, long double, long double, long double,
- long double, long double, long double, long double))(pcl))(arg1, arg2,
+ long double, long double, long double, long double))(code))(arg1, arg2,
arg3, arg4, arg5, arg6, arg7, arg8);
/* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */
printf("res: %Lg\n", res);
PR: none.
Originator: Blake Chaffin 6/6/2007 */
-/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* } } */
#include "ffitest.h"
static void
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3];
ffi_type* arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
char* format = "%L.1f\n";
long double ldArg = 7;
ffi_arg res = 0;
printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" { xfail i*86-*-linux-* x86_64-*-linux-* } }
- CHECK(ffi_prep_closure(pcl, &cif, cls_longdouble_va_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK);
- res = ((int(*)(char*, long double))(pcl))(format, ldArg);
+ res = ((int(*)(char*, long double))(code))(format, ldArg);
// { dg-output "\n7.0" }
printf("res: %d\n", (int) res);
// { dg-output "\nres: 4" }
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void * args_dbl[3];
ffi_type * cl_arg_types[3];
ffi_arg res_call;
signed char a, b, res_closure;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
a = 2;
b = 125;
printf("res: %d\n", (signed char)res_call);
/* { dg-output "\nres: 127" } */
- CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
- res_closure = (*((test_type)pcl))(2, 125);
+ res_closure = (*((test_type)code))(2, 125);
/* { dg-output "\n2 125: 127" } */
printf("res: %d\n", res_closure);
/* { dg-output "\nres: 127" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void * args_dbl[3];
ffi_type * cl_arg_types[3];
ffi_arg res_call;
unsigned short a, b, res_closure;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
a = 2;
b = 32765;
printf("res: %d\n", (unsigned short)res_call);
/* { dg-output "\nres: 32767" } */
- CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
- res_closure = (*((test_type)pcl))(2, 32765);
+ res_closure = (*((test_type)code))(2, 32765);
/* { dg-output "\n2 32765: 32767" } */
printf("res: %d\n", res_closure);
/* { dg-output "\nres: 32767" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void * args_dbl[5];
ffi_type * cl_arg_types[5];
ffi_arg res_call;
signed char a, c;
signed short b, d, res_closure;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
a = 1;
b = 32765;
c = 127;
printf("res: %d\n", (signed short)res_call);
/* { dg-output "\nres: 32765" } */
- CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
- res_closure = (*((test_type)pcl))(1, 32765, 127, -128);
+ res_closure = (*((test_type)code))(1, 32765, 127, -128);
/* { dg-output "\n1 32765 127 -128: 32765" } */
printf("res: %d\n", res_closure);
/* { dg-output "\nres: 32765" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void * args_dbl[5];
ffi_type * cl_arg_types[5];
ffi_arg res_call;
unsigned char a, b, c, d, res_closure;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
a = 1;
b = 2;
c = 127;
printf("res: %d\n", (unsigned char)res_call);
/* { dg-output "\nres: 255" } */
- CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
- res_closure = (*((test_type)pcl))(1, 2, 127, 125);
+ res_closure = (*((test_type)code))(1, 2, 127, 125);
/* { dg-output "\n1 2 127 125: 255" } */
printf("res: %d\n", res_closure);
/* { dg-output "\nres: 255" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void * args_dbl[3];
ffi_type * cl_arg_types[3];
ffi_arg res_call;
unsigned short a, b, res_closure;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
a = 2;
b = 32765;
printf("res: %d\n", (unsigned short)res_call);
/* { dg-output "\nres: 32767" } */
- CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
- res_closure = (*((test_type)pcl))(2, 32765);
+ res_closure = (*((test_type)code))(2, 32765);
/* { dg-output "\n2 32765: 32767" } */
printf("res: %d\n", res_closure);
/* { dg-output "\nres: 32767" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void * args_dbl[5];
ffi_type * cl_arg_types[5];
ffi_arg res_call;
unsigned char a, c;
unsigned short b, d, res_closure;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
a = 1;
b = 2;
c = 127;
printf("res: %d\n", (unsigned short)res_call);
/* { dg-output "\nres: 258" } */
- CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK);
- res_closure = (*((test_type)pcl))(1, 2, 127, 128);
+ res_closure = (*((test_type)code))(1, 2, 127, 128);
/* { dg-output "\n1 2 127 128: 258" } */
printf("res: %d\n", res_closure);
/* { dg-output "\nres: 258" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure* pcl;
+ void *code;
+ ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3];
// ffi_type cls_pointer_type;
ffi_type* arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap(sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
/* cls_pointer_type.size = sizeof(void*);
cls_pointer_type.alignment = 0;
cls_pointer_type.type = FFI_TYPE_POINTER;
printf("res: 0x%08x\n", (unsigned int) res);
/* { dg-output "\nres: 0x9be02467" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK);
- res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2);
+ res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2);
/* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */
printf("res: 0x%08x\n", (unsigned int) res);
/* { dg-output "\nres: 0x9be02467" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure* pcl;
+ void *code;
+ ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[3];
// ffi_type cls_pointer_type;
ffi_type* arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap(sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
/* cls_pointer_type.size = sizeof(void*);
cls_pointer_type.alignment = 0;
cls_pointer_type.type = FFI_TYPE_POINTER;
// { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" }
// { dg-output "\nres: 0x8bf258bd" }
- CHECK(ffi_prep_closure(pcl, &cif, cls_pointer_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK);
- res = (ffi_arg)((void*(*)(void*, void*))(pcl))(arg1, arg2);
+ res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2);
printf("res: 0x%08x\n", (unsigned int) res);
// { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" }
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
signed char res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_schar;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_schar, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_schar_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_schar)pcl))(127);
+ res = (*((cls_ret_schar)code))(127);
/* { dg-output "127: 127" } */
printf("res: %d\n", res);
/* { dg-output "\nres: 127" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
signed int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_sint;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sint_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_sint)pcl))(65534);
+ res = (*((cls_ret_sint)code))(65534);
/* { dg-output "65534: 65534" } */
printf("res: %d\n",res);
/* { dg-output "\nres: 65534" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
signed short res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_sshort;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_sshort, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sshort_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_sshort)pcl))(255);
+ res = (*((cls_ret_sshort)code))(255);
/* { dg-output "255: 255" } */
printf("res: %d\n",res);
/* { dg-output "\nres: 255" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
unsigned char res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_uchar;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_uchar, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uchar_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_uchar)pcl))(127);
+ res = (*((cls_ret_uchar)code))(127);
/* { dg-output "127: 127" } */
printf("res: %d\n",res);
/* { dg-output "\nres: 127" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
unsigned int res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_uint;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_uint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_uint_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_uint)pcl))(2147483647);
+ res = (*((cls_ret_uint)code))(2147483647);
/* { dg-output "2147483647: 2147483647" } */
printf("res: %d\n",res);
/* { dg-output "\nres: 2147483647" } */
{
*(unsigned long long *)resp= *(unsigned long long *)args[0];
- printf("%llu: %llu\n",*(unsigned long long *)args[0],
+ printf("%" PRIu64 ": %" PRIu64 "\n",*(unsigned long long *)args[0],
*(unsigned long long *)(resp));
}
typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
unsigned long long res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_uint64;
cl_arg_types[1] = NULL;
/* Initialize the cif */
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_uint64, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ulonglong_fn, NULL) == FFI_OK);
- res = (*((cls_ret_ulonglong)pcl))(214LL);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK);
+ res = (*((cls_ret_ulonglong)code))(214LL);
/* { dg-output "214: 214" } */
- printf("res: %lld\n", res);
+ printf("res: %" PRId64 "\n", res);
/* { dg-output "\nres: 214" } */
- res = (*((cls_ret_ulonglong)pcl))(9223372035854775808LL);
+ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL);
/* { dg-output "\n9223372035854775808: 9223372035854775808" } */
- printf("res: %lld\n", res);
+ printf("res: %" PRId64 "\n", res);
/* { dg-output "\nres: 9223372035854775808" } */
exit(0);
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[2];
unsigned short res;
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cl_arg_types[0] = &ffi_type_ushort;
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_ushort, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ushort_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK);
- res = (*((cls_ret_ushort)pcl))(65535);
+ res = (*((cls_ret_ushort)code))(65535);
/* { dg-output "65535: 65535" } */
printf("res: %d\n",res);
/* { dg-output "\nres: 65535" } */
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[1];
ffi_type* arg_types[1];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
arg_types[0] = NULL;
args[0] = NULL;
cif.abi= 255;
- CHECK(ffi_prep_closure(pcl, &cif, dummy_fn, NULL) == FFI_BAD_ABI);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI);
exit(0);
}
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
ffi_type* arg_types[1];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
arg_types[0] = NULL;
ffi_type badType = ffi_type_void;
PR: none.
Originator: From the original ffitest.c */
-/* { dg-do run } */
+/* { dg-excess-errors { target x86_64-*-mingw* x86_64-*-cygwin* } } */
+/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h"
#include "float.h"
Originator: Blake Chaffin 6/18/2007
*/
+/* { dg-excess-errors { target x86_64-*-mingw* x86_64-*-cygwin* } } */
/* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
/* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
+/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include <stdint.h>
{
BigStruct retVal = {
ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1,
- ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((long)p_1 + 1),
+ ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1),
ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2,
- ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((long)p_2 + 2),
+ ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2),
ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3,
- ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((long)p_3 + 3),
+ ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3),
ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4,
- ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((long)p_4 + 4),
+ ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4),
ui8_5 + 5, si8_5 + 5};
- printf("%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd: "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n",
+ printf("%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd: "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd\n",
ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1,
ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2,
ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3,
}
static void
-cls_large_fn(ffi_cif* cif, void* resp, void** args, void* userdata)
+cls_large_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__)
{
uint8_t ui8_1 = *(uint8_t*)args[0];
int8_t si8_1 = *(int8_t*)args[1];
}
int
-main(int argc, const char** argv)
+main(int argc __UNUSED__, const char** argv __UNUSED__)
{
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
-
-#ifdef USING_MMAP
- pcl = allocate_mmap(sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_cif cif;
ffi_type* argTypes[51];
ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues);
// { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
- printf("res: %hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n",
+ printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd\n",
retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f,
retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l,
retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r,
retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, retVal.vv, retVal.ww, retVal.xx);
// { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
- CHECK(ffi_prep_closure(pcl, &cif, cls_large_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK);
retVal = ((BigStruct(*)(
uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*,
uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*,
uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*,
uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*,
- uint8_t, int8_t))(pcl))(
+ uint8_t, int8_t))(code))(
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
ui8, si8);
// { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
- printf("res: %hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p "
- "%hhu %hhd %hu %hd %u %d %llu %lld %.0f %.0f %L.0f %p %hhu %hhd\n",
+ printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p "
+ "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %L.0f %p %hhu %hhd\n",
retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f,
retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l,
retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r,
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type* cls_struct_fields1[5];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd));
CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff));
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_combined_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK);
res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1,
cls_struct_16byte2,
cls_struct_combined))
- (pcl))(e_dbl, f_dbl, g_dbl);
+ (code))(e_dbl, f_dbl, g_dbl);
/* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */
CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a));
CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type* cls_struct_fields1[5];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd));
CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff));
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_combined_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK);
res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1,
cls_struct_16byte2,
cls_struct_combined,
cls_struct_16byte1))
- (pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ (code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */
CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a));
CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[4];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[4];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+ res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
/* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+ res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+ res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+ res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+ res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[4];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+ res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
/* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+ res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[4];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+ res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
/* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[4];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2;
ffi_type* dbl_arg_types[4];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B, C))(pcl))(e_dbl, f_dbl, g_dbl);
+ res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl);
/* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e));
ffi_type* my_ffi_struct_fields[4];
ffi_type my_ffi_struct_type;
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args[4];
ffi_type* arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
struct my_ffi_struct g = { 1.0, 2.0, 3.0 };
struct my_ffi_struct f = { 1.0, 2.0, 3.0 };
struct my_ffi_struct res;
printf("res: %g %g %g\n", res.a, res.b, res.c);
/* { dg-output "\nres: 2 4 6" } */
- CHECK(ffi_prep_closure(pcl, &cif, stub, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK);
- res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(pcl))(g, f);
+ res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f);
/* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */
printf("res: %g %g %g\n", res.a, res.b, res.c);
/* { dg-output "\nres: 2 4 6" } */
PR: none.
Originator: <andreast@gcc.gnu.org> 20071113 */
-/* { dg-do run } */
+/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */
#include "ffitest.h"
static long double return_ldl(long double ldl)
ll2 = 11111111;
ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
- printf("res: %lld, %lld\n", rlonglong, ll0 + ll1 + ll2);
+ printf("res: %" PRId64 ", %" PRId64 "\n", rlonglong, ll0 + ll1 + ll2);
/* { dg-output "res: 11111133333222, 11111133333222" } */
exit(0);
}
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[15];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n);
/* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_108byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK);
res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte,
- struct_108byte, struct_108byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */
printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b,
res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i,
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[16];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o);
/* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_116byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK);
res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte,
- struct_116byte, struct_116byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */
printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b,
res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i,
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[10];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
/* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK);
res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte,
- struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n22 15 17 25 6 13 19 18 16" } */
printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
result.h = b0.h + b1.h + b2.h + b3.h;
result.i = b0.i + b1.i + b2.i + b3.i;
- printf("%g %g %g %g %g %g %g %g %lld\n", result.a, result.b, result.c,
+ printf("%g %g %g %g %g %g %g %g %" PRId64 "\n", result.a, result.b, result.c,
result.d, result.e, result.f, result.g, result.h, result.i);
return result;
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[10];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl);
/* { dg-output "22 15 17 25 6 13 19 18 16" } */
- printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c,
+ printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
/* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
- CHECK(ffi_prep_closure(pcl, &cif, cls_struct_72byte_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK);
res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte,
- struct_72byte, struct_72byte))(pcl))(e_dbl, f_dbl, g_dbl, h_dbl);
+ struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl);
/* { dg-output "\n22 15 17 25 6 13 19 18 16" } */
- printf("res: %g %g %g %g %g %g %g %g %lld\n", res_dbl.a, res_dbl.b, res_dbl.c,
+ printf("res: %g %g %g %g %g %g %g %g %" PRId64 "\n", res_dbl.a, res_dbl.b, res_dbl.c,
res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i);
/* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */
(int)(*(double*)args[8]) + (int)*(int *)args[9] +
(int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
(int)*(int *)args[12] + (int)(*(int *)args[13]) +
- (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
+ (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata;
printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
(int)*(float *)args[0], (int)(*(float *)args[1]),
(int)(*(int *)args[10]), (int)(*(float *)args[11]),
(int)*(int *)args[12], (int)(*(int *)args[13]),
(int)(*(int *)args[14]), *(int *)args[15],
- (int)(long)userdata, (int)*(ffi_arg*)resp);
+ (int)(intptr_t)userdata, (int)*(ffi_arg*)resp);
throw (int)*(ffi_arg*)resp;
}
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code);
ffi_type * cl_arg_types[17];
-#ifdef USING_MMAP
- pcl = (ffi_closure *) allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
{
cl_arg_types[1] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0,
&ffi_type_void, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK);
try
{
- (*((closure_test_type)(pcl)))();
+ (*((closure_test_type)(code)))();
} catch (int exception_code)
{
CHECK(exception_code == 9);
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
&ffi_type_sint, cl_arg_types) == FFI_OK);
- CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1,
- (void *) 3 /* userdata */) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1,
+ (void *) 3 /* userdata */, code) == FFI_OK);
try
{
- (*((closure_test_type1)pcl))
+ (*((closure_test_type1)code))
(1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13,
19, 21, 1);
/* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */