[pypy-svn] r77619 - pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Tue Oct 5 18:54:25 CEST 2010


Author: arigo
Date: Tue Oct  5 18:54:23 2010
New Revision: 77619

Modified:
   pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gctransform/framework.py
Log:
Fix: confusion between addresses and pointers.


Modified: pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gctransform/framework.py	(original)
+++ pypy/branch/32ptr-on-64bit/pypy/rpython/memory/gctransform/framework.py	Tue Oct  5 18:54:23 2010
@@ -1031,7 +1031,8 @@
             # a constant won't be ok
             return
         if v_newvalue.concretetype == llmemory.HiddenGcRef32:
-            v_newvalue = self._fetch_unpacked_pointer(hop, v_newvalue)
+            v_newvalue = self._fetch_unpacked_address(hop, v_newvalue)
+            assert v_newvalue.concretetype == llmemory.Address
             if isinstance(v_newvalue, Constant):
                 # comes from a Constant -- skip
                 return
@@ -1057,12 +1058,16 @@
                                       v_newvalue,
                                       v_structaddr])
 
-    def _fetch_unpacked_pointer(self, hop, v_value):
+    def _fetch_unpacked_address(self, hop, v_value):
         # optimization for the common case where this setfield is preceded
         # by v_value = hide_into_adr32(v_normal_pointer)
         for op in hop.llops[::-1]:
             if op.opname == 'hide_into_adr32' and op.result == v_value:
-                return op.args[0]
+                v_value = op.args[0]
+                if v_value.concretetype != llmemory.Address:
+                    v_value = hop.genop("cast_ptr_to_adr", [v_value],
+                                        resulttype = llmemory.Address)
+                return v_value
         else:
             return hop.genop("show_from_adr32", [v_value],
                              resulttype = llmemory.Address)



More information about the Pypy-commit mailing list