[pypy-svn] r67251 - pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp

antocuni at codespeak.net antocuni at codespeak.net
Thu Aug 27 16:53:09 CEST 2009


Author: antocuni
Date: Thu Aug 27 16:53:08 2009
New Revision: 67251

Modified:
   pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/optimizeopt.py
   pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/typesystem.py
Log:
remove one more "if is_oo" by introducing a helper method in ts


Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/optimizeopt.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/optimizeopt.py	(original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/optimizeopt.py	Thu Aug 27 16:53:08 2009
@@ -343,7 +343,7 @@
             return box
         if box.type == REF:
             value = box.getref_base()
-            key = self.cpu.ts.cast_ref_to_hashable(value)
+            key = self.cpu.ts.cast_ref_to_hashable(self.cpu, value)
             try:
                 return self.interned_refs[key]
             except KeyError:

Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/pyjitpl.py	Thu Aug 27 16:53:08 2009
@@ -1051,11 +1051,7 @@
     def _setup_class_sizes(self):
         class_sizes = {}
         for vtable, sizedescr in self._class_sizes:
-            if not self.cpu.is_oo:
-                vtable = llmemory.cast_ptr_to_adr(vtable)
-                vtable = self.cpu.cast_adr_to_int(vtable)
-            else:
-                vtable = ootype.cast_to_object(vtable)
+            vtable = self.cpu.ts.cast_ref_to_hashable(self.cpu, vtable)
             class_sizes[vtable] = sizedescr
         self.cpu.set_class_sizes(class_sizes)
 

Modified: pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/typesystem.py
==============================================================================
--- pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/typesystem.py	(original)
+++ pypy/branch/pyjitpl5-less-is_oo/pypy/jit/metainterp/typesystem.py	Thu Aug 27 16:53:08 2009
@@ -91,8 +91,9 @@
         ll = llstr(str)
         return history.ConstPtr(lltype.cast_opaque_ptr(llmemory.GCREF, ll))
 
-    def cast_ref_to_hashable(self, ptr):
-        return lltype.cast_ptr_to_int(ptr)
+    def cast_ref_to_hashable(self, cpu, ptr):
+        adr = llmemory.cast_ptr_to_adr(ptr)
+        return cpu.cast_adr_to_int(adr)
 
 class OOTypeHelper(TypeSystemHelper):
 
@@ -149,8 +150,8 @@
         oo = oostr(str)
         return history.ConstObj(ootype.cast_to_object(oo))
 
-    def cast_ref_to_hashable(self, obj):
-        return obj
+    def cast_ref_to_hashable(self, cpu, obj):
+        return ootype.cast_to_object(obj)
 
 
 llhelper = LLTypeHelper()



More information about the Pypy-commit mailing list