diff options
Diffstat (limited to 'ext/ffi_c/libffi/src/s390/ffi.c')
-rw-r--r-- | ext/ffi_c/libffi/src/s390/ffi.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/ext/ffi_c/libffi/src/s390/ffi.c b/ext/ffi_c/libffi/src/s390/ffi.c index ca2675b..520ec7c 100644 --- a/ext/ffi_c/libffi/src/s390/ffi.c +++ b/ext/ffi_c/libffi/src/s390/ffi.c @@ -215,9 +215,12 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif) #endif /* Check how a structure type is passed. */ - if (type == FFI_TYPE_STRUCT) + if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX) { - type = ffi_check_struct_type (*ptr); + if (type == FFI_TYPE_COMPLEX) + type = FFI_TYPE_POINTER; + else + type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, copy the data. */ if (type == FFI_TYPE_POINTER) @@ -356,8 +359,9 @@ ffi_prep_cif_machdep(ffi_cif *cif) cif->flags = FFI390_RET_VOID; break; - /* Structures are returned via a hidden pointer. */ + /* Structures and complex are returned via a hidden pointer. */ case FFI_TYPE_STRUCT: + case FFI_TYPE_COMPLEX: cif->flags = FFI390_RET_STRUCT; n_gpr++; /* We need one GPR to pass the pointer. */ break; @@ -420,9 +424,12 @@ ffi_prep_cif_machdep(ffi_cif *cif) #endif /* Check how a structure type is passed. */ - if (type == FFI_TYPE_STRUCT) + if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX) { - type = ffi_check_struct_type (*ptr); + if (type == FFI_TYPE_COMPLEX) + type = FFI_TYPE_POINTER; + else + type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, we must reserve space to copy its data for proper call-by-value semantics. */ @@ -588,9 +595,12 @@ ffi_closure_helper_SYSV (ffi_closure *closure, #endif /* Check how a structure type is passed. */ - if (type == FFI_TYPE_STRUCT) + if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX) { - type = ffi_check_struct_type (*ptr); + if (type == FFI_TYPE_COMPLEX) + type = FFI_TYPE_POINTER; + else + type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, remember to retrieve the pointer later. */ @@ -687,6 +697,7 @@ ffi_closure_helper_SYSV (ffi_closure *closure, /* Void is easy, and so is struct. */ case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: + case FFI_TYPE_COMPLEX: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif @@ -750,7 +761,8 @@ ffi_prep_closure_loc (ffi_closure *closure, void *user_data, void *codeloc) { - FFI_ASSERT (cif->abi == FFI_SYSV); + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; #ifndef __s390x__ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ |