[pypy-svn] r77615 - in pypy/branch/32ptr-on-64bit/pypy/rpython: . lltypesystem memory/gc

arigo at codespeak.net arigo at codespeak.net
Tue Oct 5 18:26:52 CEST 2010


Author: arigo
Date: Tue Oct  5 18:26:50 2010
New Revision: 77615

Modified:
   pypy/branch/32ptr-on-64bit/pypy/rpython/llinterp.py
   pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/llmemory.py
   pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/base.py
   pypy/branch/32ptr-on-64bit/pypy/rpython/rtyper.py
Log:
Figured that I don't need "addr.hiddengcref32[0]" after all.


Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/llinterp.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/llinterp.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/llinterp.py	Tue Oct  5 18:26:50 2010
@@ -1025,22 +1025,14 @@
 
     def op_raw_load(self, addr, typ, offset):
         checkadr(addr)
-        if typ == llmemory.HiddenGcRef32:
-            name = 'hiddengcref32'
-        else:
-            name = str(typ).lower()
-        value = getattr(addr, name)[offset]
+        value = getattr(addr, str(typ).lower())[offset]
         assert lltype.typeOf(value) == typ
         return value
 
     def op_raw_store(self, addr, typ, offset, value):
         checkadr(addr)
-        if typ == llmemory.HiddenGcRef32:
-            name = 'hiddengcref32'
-        else:
-            name = str(typ).lower()
         assert lltype.typeOf(value) == typ
-        getattr(addr, name)[offset] = value
+        getattr(addr, str(typ).lower())[offset] = value
 
     def op_stack_malloc(self, size): # mmh
         raise NotImplementedError("backend only")

Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/llmemory.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/llmemory.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/lltypesystem/llmemory.py	Tue Oct  5 18:26:50 2010
@@ -669,22 +669,17 @@
             raise TypeError(TARGETTYPE)
         ptr[0] = value
 
-class _hiddengcref32_fakeaccessor(_fakeaccessor):
-    TYPE = HiddenGcRef32
-
 supported_access_types = {"signed":    lltype.Signed,
                           "unsigned":  lltype.Unsigned,
                           "char":      lltype.Char,
                           "address":   Address,
                           "float":     lltype.Float,
-                          "hiddengcref32": HiddenGcRef32,
                           }
 
 fakeaddress.signed = property(_signed_fakeaccessor)
 fakeaddress.float = property(_float_fakeaccessor)
 fakeaddress.char = property(_char_fakeaccessor)
 fakeaddress.address = property(_address_fakeaccessor)
-fakeaddress.hiddengcref32 = property(_hiddengcref32_fakeaccessor)
 fakeaddress._TYPE = Address
 
 # the obtained address will not keep the object alive. e.g. if the object is

Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/base.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/base.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gc/base.py	Tue Oct  5 18:26:50 2010
@@ -13,6 +13,8 @@
                              ('links', lltype.Array(lltype.Signed)))
 ARRAY_TYPEID_MAP = lltype.GcArray(lltype.Ptr(TYPEID_MAP))
 
+HIDDENGCREFFIELD = lltype.FixedSizeArray(llmemory.HiddenGcRef32, 1)
+
 class GCBase(object):
     _alloc_flavor_ = "raw"
     moving_gc = False
@@ -212,13 +214,13 @@
             # special handling of HiddenGcRef32 on 64-bit platforms
             ofs = llmemory.remove_odd_value_marker(ofs)
             item = obj + ofs
-            address = llop.show_from_adr32(
-                llmemory.Address, item.hiddengcref32[0])
+            item = llmemory.cast_adr_to_ptr(item, lltype.Ptr(HIDDENGCREFFIELD))
+            address = llop.show_from_adr32(llmemory.Address, item[0])
             if self.is_valid_gc_object(address):
                 newaddr = callback(address, arg)
                 if newaddr is not None:
-                    item.hiddengcref32[0] = llop.hide_into_adr32(
-                        llmemory.HiddenGcRef32, newaddr)
+                    item[0] = llop.hide_into_adr32(llmemory.HiddenGcRef32,
+                                                   newaddr)
         else:
             # common case
             item = obj + ofs

Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/rtyper.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/rtyper.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/rtyper.py	Tue Oct  5 18:26:50 2010
@@ -100,8 +100,7 @@
             return self.primitive_to_repr[lltype]
         except KeyError:
             pass
-        from pypy.rpython.lltypesystem import llmemory
-        if isinstance(lltype, Primitive) or lltype == llmemory.HiddenGcRef32:
+        if isinstance(lltype, Primitive):
             repr = self.primitive_to_repr[lltype] = self.getrepr(annmodel.lltype_to_annotation(lltype))
             return repr
         raise TyperError('There is no primitive repr for %r'%(lltype,))



More information about the Pypy-commit mailing list