32 #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG)
37 static ffi_status initialize_aggregate(ffi_type *
arg)
42 return FFI_BAD_TYPEDEF;
50 return FFI_BAD_TYPEDEF;
55 && (initialize_aggregate((*
ptr)) != FFI_OK)))
56 return FFI_BAD_TYPEDEF;
62 arg->size += (*ptr)->size;
64 arg->alignment = (
arg->alignment > (*ptr)->alignment) ?
65 arg->alignment : (*ptr)->alignment;
81 #ifdef FFI_AGGREGATE_ALIGNMENT
87 return FFI_BAD_TYPEDEF;
108 unsigned int isvariadic,
109 unsigned int nfixedargs,
110 unsigned int ntotalargs,
111 ffi_type *rtype, ffi_type **atypes)
118 FFI_ASSERT((!isvariadic) || (nfixedargs >= 1));
125 cif->arg_types = atypes;
126 cif->nargs = ntotalargs;
131 #if HAVE_LONG_DOUBLE_VARIANT
132 ffi_prep_types (abi);
136 if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK))
137 return FFI_BAD_TYPEDEF;
139 #ifndef FFI_TARGET_HAS_COMPLEX_TYPE
140 if (rtype->type == FFI_TYPE_COMPLEX)
147 #if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
149 if (cif->rtype->type == FFI_TYPE_STRUCT
151 && (cif->abi !=
FFI_V9 || cif->rtype->size > 32)
157 && (cif->rtype->size > 16)
160 && (cif->rtype->size > 8)
166 for (
ptr = cif->arg_types,
i = cif->nargs;
i > 0;
i--,
ptr++)
170 if (((*ptr)->size == 0) && (initialize_aggregate((*
ptr)) != FFI_OK))
171 return FFI_BAD_TYPEDEF;
173 #ifndef FFI_TARGET_HAS_COMPLEX_TYPE
174 if ((*ptr)->type == FFI_TYPE_COMPLEX)
181 #if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION
183 if (((*ptr)->type == FFI_TYPE_STRUCT
184 && ((*ptr)->size > 16 || cif->abi !=
FFI_V9))
187 bytes +=
sizeof(
void*);
192 if (((*ptr)->alignment - 1) & bytes)
193 bytes = (
unsigned)
ALIGN(bytes, (*ptr)->alignment);
217 #ifdef FFI_TARGET_SPECIFIC_VARIADIC
227 ffi_type *rtype, ffi_type **atypes)
234 unsigned int nfixedargs,
235 unsigned int ntotalargs,
245 ffi_prep_closure (ffi_closure* closure,
247 void (*fun)(ffi_cif*,
void*,
void**,
void*),