[pypy-svn] r71590 - in pypy/trunk/pypy: jit/backend/x86/test jit/metainterp rpython rpython/lltypesystem

arigo at codespeak.net arigo at codespeak.net
Mon Mar 1 13:10:19 CET 2010


Author: arigo
Date: Mon Mar  1 13:10:18 2010
New Revision: 71590

Modified:
   pypy/trunk/pypy/jit/backend/x86/test/test_zrpy_gc.py
   pypy/trunk/pypy/jit/metainterp/virtualref.py
   pypy/trunk/pypy/rpython/lltypesystem/rclass.py
   pypy/trunk/pypy/rpython/rtyper.py
Log:
Test and fix for --gcremovetypeptr together with the JIT.


Modified: pypy/trunk/pypy/jit/backend/x86/test/test_zrpy_gc.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/test/test_zrpy_gc.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/test/test_zrpy_gc.py	Mon Mar  1 13:10:18 2010
@@ -439,3 +439,19 @@
 
     def test_compile_hybrid_bug1(self):
         self.run('compile_hybrid_bug1', 200)
+
+    def define_compile_hybrid_vref(self):
+        from pypy.rlib.jit import virtual_ref, virtual_ref_finish
+        class A:
+            pass
+        glob = A()
+        def f(n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s):
+            a = A()
+            glob.v = virtual_ref(a)
+            virtual_ref_finish(a)
+            n -= 1
+            return n, x, x0, x1, x2, x3, x4, x5, x6, x7, l, s
+        return None, f, None
+
+    def test_compile_hybrid_vref(self):
+        self.run('compile_hybrid_vref', 200)

Modified: pypy/trunk/pypy/jit/metainterp/virtualref.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/virtualref.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/virtualref.py	Mon Mar  1 13:10:18 2010
@@ -27,6 +27,10 @@
         self.descr_virtualref_index = fielddescrof(self.JIT_VIRTUAL_REF,
                                                    'virtualref_index')
         self.descr_forced = fielddescrof(self.JIT_VIRTUAL_REF, 'forced')
+        #
+        # record the type JIT_VIRTUAL_REF explicitly in the rtyper, too
+        self.warmrunnerdesc.rtyper.set_type_for_typeptr(
+            self.jit_virtual_ref_vtable, self.JIT_VIRTUAL_REF)
 
     def _freeze_(self):
         return True
@@ -50,10 +54,6 @@
         if c_funcptr is not None:
             log("replaced %d 'jit_force_virtual' with %r" % (count,
                                                              c_funcptr.value))
-        #
-        # record the type JIT_VIRTUAL_REF explicitly in the rtyper, too
-        self.warmrunnerdesc.rtyper.set_type_for_typeptr(
-            self.jit_virtual_ref_vtable, self.JIT_VIRTUAL_REF)
 
     # ____________________________________________________________
 

Modified: pypy/trunk/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rclass.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rclass.py	Mon Mar  1 13:10:18 2010
@@ -384,7 +384,6 @@
                                                   OBJECT, destrptr)
             vtable = self.rclass.getvtable()
             self.rtyper.set_type_for_typeptr(vtable, self.lowleveltype.TO)
-            self.rtyper.lltype2vtable[self.lowleveltype.TO] = vtable
 
     def common_repr(self): # -> object or nongcobject reprs
         return getinstancerepr(self.rtyper, None, self.gcflavor)

Modified: pypy/trunk/pypy/rpython/rtyper.py
==============================================================================
--- pypy/trunk/pypy/rpython/rtyper.py	(original)
+++ pypy/trunk/pypy/rpython/rtyper.py	Mon Mar  1 13:10:18 2010
@@ -152,6 +152,7 @@
 
     def set_type_for_typeptr(self, typeptr, TYPE):
         self.type_for_typeptr[typeptr._obj] = TYPE
+        self.lltype2vtable[TYPE] = typeptr
 
     def get_real_typeptr_for_typeptr(self, typeptr):
         # perform a linear scan for the case of ll2ctypes typeptr



More information about the Pypy-commit mailing list