[pypy-commit] pypy ffi-backend: Fixes for x86/test/test_fficall.py

arigo noreply at buildbot.pypy.org
Fri Aug 3 13:15:42 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r56558:909c2f199602
Date: 2012-08-03 13:15 +0200
http://bitbucket.org/pypy/pypy/changeset/909c2f199602/

Log:	Fixes for x86/test/test_fficall.py

diff --git a/pypy/jit/backend/llsupport/ffisupport.py b/pypy/jit/backend/llsupport/ffisupport.py
--- a/pypy/jit/backend/llsupport/ffisupport.py
+++ b/pypy/jit/backend/llsupport/ffisupport.py
@@ -11,8 +11,8 @@
     ffi_result = cif_description.rtype
     try:
         reskind = get_ffi_type_kind(cpu, ffi_result)
-        argkinds = [get_ffi_type_kind(cpu, atype)
-                    for atype in cif_description.atypes]
+        argkinds = [get_ffi_type_kind(cpu, cif_description.atypes[i])
+                    for i in range(cif_description.nargs)]
     except UnsupportedKind:
         return None
     if reskind == 'v':
diff --git a/pypy/jit/backend/x86/test/test_fficall.py b/pypy/jit/backend/x86/test/test_fficall.py
--- a/pypy/jit/backend/x86/test/test_fficall.py
+++ b/pypy/jit/backend/x86/test/test_fficall.py
@@ -2,7 +2,7 @@
 from pypy.jit.metainterp.test import test_fficall
 from pypy.jit.backend.x86.test.test_basic import Jit386Mixin
 
-class TestFfiLookups(Jit386Mixin, test_fficall.FfiLookupTests):
+class TestFfiCall(Jit386Mixin, test_fficall.FfiCallTests):
     # for the individual tests see
     # ====> ../../../metainterp/test/test_fficall.py
-    supports_all = True
+    pass
diff --git a/pypy/rlib/jit_libffi.py b/pypy/rlib/jit_libffi.py
--- a/pypy/rlib/jit_libffi.py
+++ b/pypy/rlib/jit_libffi.py
@@ -8,6 +8,7 @@
 FFI_TYPE_P = clibffi.FFI_TYPE_P
 FFI_TYPE_PP = clibffi.FFI_TYPE_PP
 FFI_ABI = clibffi.FFI_ABI
+FFI_TYPE_STRUCT = clibffi.FFI_TYPE_STRUCT
 SIZE_OF_FFI_ARG = rffi.sizeof(clibffi.ffi_arg)
 
 # "cif_description" is a block of raw memory describing how to do the call.
@@ -89,30 +90,30 @@
         'u' for unsigned integer, 'S' for singlefloat, 'L' for long long
         integer (signed or unsigned), or '*' for struct.
         """
-        if   ffi_type is types.void:    return 'v'
-        elif ffi_type is types.double:  return 'f'
-        elif ffi_type is types.float:   return 'S'
-        elif ffi_type is types.pointer: return 'i'
+        if   ffi_type == types.void:    return 'v'
+        elif ffi_type == types.double:  return 'f'
+        elif ffi_type == types.float:   return 'S'
+        elif ffi_type == types.pointer: return 'i'
         #
-        elif ffi_type is types.schar:   return 'i'
-        elif ffi_type is types.uchar:   return 'u'
-        elif ffi_type is types.sshort:  return 'i'
-        elif ffi_type is types.ushort:  return 'u'
-        elif ffi_type is types.sint:    return 'i'
-        elif ffi_type is types.uint:    return 'u'
-        elif ffi_type is types.slong:   return 'i'
-        elif ffi_type is types.ulong:   return 'u'
+        elif ffi_type == types.schar:   return 'i'
+        elif ffi_type == types.uchar:   return 'u'
+        elif ffi_type == types.sshort:  return 'i'
+        elif ffi_type == types.ushort:  return 'u'
+        elif ffi_type == types.sint:    return 'i'
+        elif ffi_type == types.uint:    return 'u'
+        elif ffi_type == types.slong:   return 'i'
+        elif ffi_type == types.ulong:   return 'u'
         #
-        elif ffi_type is types.sint8:   return 'i'
-        elif ffi_type is types.uint8:   return 'u'
-        elif ffi_type is types.sint16:  return 'i'
-        elif ffi_type is types.uint16:  return 'u'
-        elif ffi_type is types.sint32:  return 'i'
-        elif ffi_type is types.uint32:  return 'u'
-        ## (note that on 64-bit platforms, types.sint64 is types.slong and the
-        ## case is caught above)
-        elif ffi_type is types.sint64:  return 'L'
-        elif ffi_type is types.uint64:  return 'L'
+        elif ffi_type == types.sint8:   return 'i'
+        elif ffi_type == types.uint8:   return 'u'
+        elif ffi_type == types.sint16:  return 'i'
+        elif ffi_type == types.uint16:  return 'u'
+        elif ffi_type == types.sint32:  return 'i'
+        elif ffi_type == types.uint32:  return 'u'
+        ## (note that on 64-bit platforms, types.sint64 == types.slong and the
+        ## case == caught above)
+        elif ffi_type == types.sint64:  return 'L'
+        elif ffi_type == types.uint64:  return 'L'
         #
         elif types.is_struct(ffi_type): return '*'
         raise KeyError
@@ -120,6 +121,6 @@
     @staticmethod
     @jit.elidable
     def is_struct(ffi_type):
-        return intmask(ffi_type.c_type) == FFI_TYPE_STRUCT
+        return rffi.getintfield(ffi_type, 'c_type') == FFI_TYPE_STRUCT
 
 types._import()


More information about the pypy-commit mailing list