[pypy-svn] r73645 - pypy/trunk/pypy/rpython/memory/gctransform

benjamin at codespeak.net benjamin at codespeak.net
Sun Apr 11 18:10:56 CEST 2010


Author: benjamin
Date: Sun Apr 11 18:10:54 2010
New Revision: 73645

Modified:
   pypy/trunk/pypy/rpython/memory/gctransform/framework.py
Log:
simplify setting of prebuilt hash

Modified: pypy/trunk/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/trunk/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/trunk/pypy/rpython/memory/gctransform/framework.py	Sun Apr 11 18:10:54 2010
@@ -472,17 +472,15 @@
         hdr = self.gcdata.gc.gcheaderbuilder.header_of_object(obj)
         HDR = self.HDR
         withhash, flag = self.gcdata.gc.withhash_flag_is_in_field
-        for fldname in HDR._names:
-            if fldname == withhash:
-                x = getattr(hdr, fldname)
-                TYPE = lltype.typeOf(x)
-                x = lltype.cast_primitive(lltype.Signed, x)
-                if needs_hash:
-                    x |= flag       # set the flag in the header
-                else:
-                    x &= ~flag      # clear the flag in the header
-                x = lltype.cast_primitive(TYPE, x)
-                setattr(hdr, fldname, x)
+        x = getattr(hdr, withhash)
+        TYPE = lltype.typeOf(x)
+        x = lltype.cast_primitive(lltype.Signed, x)
+        if needs_hash:
+            x |= flag       # set the flag in the header
+        else:
+            x &= ~flag      # clear the flag in the header
+        x = lltype.cast_primitive(TYPE, x)
+        setattr(hdr, withhash, x)
         return hdr
 
     def get_hash_offset(self, T):



More information about the Pypy-commit mailing list