[Python-checkins] r60960 - python/branches/libffi3-branch/Modules/_ctypes/libffi/src/prep_cif.c
thomas.heller
python-checkins at python.org
Fri Feb 22 16:05:57 CET 2008
Author: thomas.heller
Date: Fri Feb 22 16:05:57 2008
New Revision: 60960
Modified:
python/branches/libffi3-branch/Modules/_ctypes/libffi/src/prep_cif.c
Log:
Another file from libffi-3.0.2.
Tested on OS X g4 (is this POWERPC_DARWIN?).
Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/prep_cif.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/prep_cif.c (original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/prep_cif.c Fri Feb 22 16:05:57 2008
@@ -53,29 +53,11 @@
/* Perform a sanity check on the argument type */
FFI_ASSERT_VALID_TYPE(*ptr);
-#ifdef POWERPC_DARWIN
- {
- int curalign;
-
- curalign = (*ptr)->alignment;
- if (ptr != &(arg->elements[0])) {
- if (curalign > 4 && curalign != 16) {
- curalign = 4;
- }
- }
- arg->size = ALIGN(arg->size, curalign);
- arg->size += (*ptr)->size;
-
- arg->alignment = (arg->alignment > curalign) ?
- arg->alignment : curalign;
- }
-#else
arg->size = ALIGN(arg->size, (*ptr)->alignment);
arg->size += (*ptr)->size;
arg->alignment = (arg->alignment > (*ptr)->alignment) ?
arg->alignment : (*ptr)->alignment;
-#endif
ptr++;
}
@@ -103,19 +85,6 @@
/* Perform machine independent ffi_cif preparation, then call
machine dependent routine. */
-#ifdef X86_DARWIN
-static inline int struct_on_stack(int size)
-{
- if (size > 8) return 1;
- /* This is not what the ABI says, but is what is really implemented */
- switch (size) {
- case 1: case 2: case 4: case 8: return 0;
- }
- return 1;
-}
-#endif
-
-
ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs,
ffi_type *rtype, ffi_type **atypes)
{
@@ -148,8 +117,7 @@
&& (cif->abi != FFI_V9 || cif->rtype->size > 32)
#endif
#ifdef X86_DARWIN
-
- && (struct_on_stack(cif->rtype->size))
+ && (cif->rtype->size > 8)
#endif
)
bytes = STACK_ARG_SIZE(sizeof(void*));
@@ -166,16 +134,7 @@
check after the initialization. */
FFI_ASSERT_VALID_TYPE(*ptr);
-#if defined(X86_DARWIN)
- {
- int align = (*ptr)->alignment;
- if (align > 4) align = 4;
- if ((align - 1) & bytes)
- bytes = ALIGN(bytes, align);
- bytes += STACK_ARG_SIZE((*ptr)->size);
- }
-
-#elif !defined __x86_64__ && !defined S390 && !defined PA
+#if !defined __x86_64__ && !defined S390 && !defined PA
#ifdef SPARC
if (((*ptr)->type == FFI_TYPE_STRUCT
&& ((*ptr)->size > 16 || cif->abi != FFI_V9))
More information about the Python-checkins
mailing list