[pypy-svn] r77786 - in pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem: . test

arigo at codespeak.net arigo at codespeak.net
Mon Oct 11 14:36:10 CEST 2010


Author: arigo
Date: Mon Oct 11 14:36:08 2010
New Revision: 77786

Modified:
   pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rffi.py
   pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/test/test_rffi.py
Log:
Test and fix.


Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/rffi.py	Mon Oct 11 14:36:08 2010
@@ -796,6 +796,8 @@
             size = llmemory.sizeof(tp)    # a symbolic result in this case
         return size
     if isinstance(tp, lltype.Ptr):
+        if tp == llmemory.HiddenGcRef32:
+            return 4
         tp = ULONG     # XXX!
     if tp is lltype.Char or tp is lltype.Bool:
         return 1
@@ -805,8 +807,6 @@
         return 8
     if tp is lltype.SingleFloat:
         return 4
-    if tp is llmemory.HiddenGcRef32:
-        return 4
     assert isinstance(tp, lltype.Number)
     if tp is lltype.Signed:
         return ULONG._type.BITS/8

Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/test/test_rffi.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/test/test_rffi.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/test/test_rffi.py	Mon Oct 11 14:36:08 2010
@@ -750,6 +750,9 @@
         assert offsetof(S, "c_b") == struct.calcsize("hi") - struct.calcsize("i")
         assert offsetof(S, "c_c") == struct.calcsize("hii") - struct.calcsize("i")
 
+    def test_rffi_sizeof_hiddengcref(self):
+        assert sizeof(llmemory.HiddenGcRef32) == 4   # even on 64-bit platforms
+
 ARRAY_OF_CHAR = lltype.Array(CHAR, hints={'nolength': True})
 
 def test_ptradd():



More information about the Pypy-commit mailing list