x86: Remove some conditional compilation
Removal of ifdefs made possible to due to ffi_abi unification.
This commit is contained in:
@@ -217,32 +217,23 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|||||||
|
|
||||||
case FFI_TYPE_STRUCT:
|
case FFI_TYPE_STRUCT:
|
||||||
#ifndef X86
|
#ifndef X86
|
||||||
|
/* ??? This should be a different ABI rather than an ifdef. */
|
||||||
if (cif->rtype->size == 1)
|
if (cif->rtype->size == 1)
|
||||||
{
|
|
||||||
cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */
|
cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */
|
||||||
}
|
|
||||||
else if (cif->rtype->size == 2)
|
else if (cif->rtype->size == 2)
|
||||||
{
|
|
||||||
cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */
|
cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */
|
||||||
}
|
|
||||||
else if (cif->rtype->size == 4)
|
else if (cif->rtype->size == 4)
|
||||||
{
|
|
||||||
cif->flags = FFI_TYPE_INT; /* same as int type */
|
cif->flags = FFI_TYPE_INT; /* same as int type */
|
||||||
}
|
|
||||||
else if (cif->rtype->size == 8)
|
else if (cif->rtype->size == 8)
|
||||||
{
|
|
||||||
cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
|
cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef X86_WIN32
|
|
||||||
if (cif->abi == FFI_MS_CDECL)
|
if (cif->abi == FFI_MS_CDECL)
|
||||||
cif->flags = FFI_TYPE_MS_STRUCT;
|
cif->flags = FFI_TYPE_MS_STRUCT;
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
cif->flags = FFI_TYPE_STRUCT;
|
cif->flags = FFI_TYPE_STRUCT;
|
||||||
/* allocate space for return value pointer */
|
/* Allocate space for return value pointer. */
|
||||||
cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
|
cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -259,10 +250,8 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|||||||
cif->bytes += (unsigned)ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
|
cif->bytes += (unsigned)ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef X86_WIN32
|
|
||||||
if (cif->abi == FFI_SYSV)
|
if (cif->abi == FFI_SYSV)
|
||||||
cif->bytes = (cif->bytes + 15) & ~0xF;
|
cif->bytes = ALIGN (cif->bytes, 15);
|
||||||
#endif
|
|
||||||
|
|
||||||
return FFI_OK;
|
return FFI_OK;
|
||||||
}
|
}
|
||||||
@@ -577,14 +566,12 @@ ffi_prep_closure_loc (ffi_closure* closure,
|
|||||||
&ffi_closure_STDCALL,
|
&ffi_closure_STDCALL,
|
||||||
(void*)codeloc);
|
(void*)codeloc);
|
||||||
}
|
}
|
||||||
#ifdef X86_WIN32
|
|
||||||
else if (cif->abi == FFI_MS_CDECL)
|
else if (cif->abi == FFI_MS_CDECL)
|
||||||
{
|
{
|
||||||
FFI_INIT_TRAMPOLINE (&closure->tramp[0],
|
FFI_INIT_TRAMPOLINE (&closure->tramp[0],
|
||||||
&ffi_closure_SYSV,
|
&ffi_closure_SYSV,
|
||||||
(void*)codeloc);
|
(void*)codeloc);
|
||||||
}
|
}
|
||||||
#endif /* X86_WIN32 */
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return FFI_BAD_ABI;
|
return FFI_BAD_ABI;
|
||||||
@@ -610,40 +597,36 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (cif->abi != FFI_SYSV
|
/* We currently don't support certain kinds of arguments for raw
|
||||||
#ifdef X86_WIN32
|
|
||||||
&& cif->abi != FFI_THISCALL
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
return FFI_BAD_ABI;
|
|
||||||
|
|
||||||
/* we currently don't support certain kinds of arguments for raw
|
|
||||||
closures. This should be implemented by a separate assembly
|
closures. This should be implemented by a separate assembly
|
||||||
language routine, since it would require argument processing,
|
language routine, since it would require argument processing,
|
||||||
something we don't do now for performance. */
|
something we don't do now for performance. */
|
||||||
|
|
||||||
for (i = cif->nargs-1; i >= 0; i--)
|
for (i = cif->nargs-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT);
|
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT);
|
||||||
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
|
FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X86_WIN32
|
switch (cif->abi)
|
||||||
if (cif->abi == FFI_SYSV)
|
|
||||||
{
|
{
|
||||||
|
#ifdef X86_WIN32
|
||||||
|
case FFI_THISCALL:
|
||||||
|
FFI_INIT_TRAMPOLINE_RAW_THISCALL (&closure->tramp[0],
|
||||||
|
&ffi_closure_raw_THISCALL,
|
||||||
|
codeloc, cif->bytes);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case FFI_SYSV:
|
||||||
FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
|
FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV,
|
||||||
codeloc);
|
codeloc);
|
||||||
#ifdef X86_WIN32
|
break;
|
||||||
|
default:
|
||||||
|
return FFI_BAD_ABI;
|
||||||
}
|
}
|
||||||
else if (cif->abi == FFI_THISCALL)
|
|
||||||
{
|
|
||||||
FFI_INIT_TRAMPOLINE_RAW_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, codeloc, cif->bytes);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
closure->cif = cif;
|
closure->cif = cif;
|
||||||
closure->user_data = user_data;
|
|
||||||
closure->fun = fun;
|
closure->fun = fun;
|
||||||
|
closure->user_data = user_data;
|
||||||
|
|
||||||
return FFI_OK;
|
return FFI_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user