[pypy-svn] r69060 - in pypy/trunk/pypy/jit/metainterp: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Nov 8 15:13:52 CET 2009


Author: cfbolz
Date: Sun Nov  8 15:13:51 2009
New Revision: 69060

Added:
   pypy/trunk/pypy/jit/metainterp/test/test_effectinfo.py   (contents, props changed)
Modified:
   pypy/trunk/pypy/jit/metainterp/effectinfo.py
Log:
(cfbolz, pedronis): fix problems with removetypeptr


Modified: pypy/trunk/pypy/jit/metainterp/effectinfo.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/effectinfo.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/effectinfo.py	Sun Nov  8 15:13:51 2009
@@ -1,3 +1,4 @@
+from pypy.rpython.lltypesystem.rclass import OBJECT
 from pypy.rpython.lltypesystem import lltype
 
 class EffectInfo(object):
@@ -24,6 +25,11 @@
             _, T, fieldname = tup
             if not isinstance(T.TO, lltype.GcStruct): # can be a non-GC-struct
                 continue
+            if fieldname == "typeptr" and T.TO is OBJECT:
+                # filter out the typeptr, because
+                # a) it is optimized in different ways
+                # b) it might not be there in C if removetypeptr is specified
+                continue
             descr = cpu.fielddescrof(T.TO, fieldname)
             write_descrs_fields.append(descr)
         elif tup[0] == "array":

Added: pypy/trunk/pypy/jit/metainterp/test/test_effectinfo.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/jit/metainterp/test/test_effectinfo.py	Sun Nov  8 15:13:51 2009
@@ -0,0 +1,9 @@
+from pypy.rpython.lltypesystem.rclass import OBJECT
+from pypy.rpython.lltypesystem import lltype
+from pypy.jit.metainterp.effectinfo import effectinfo_from_writeanalyze
+
+def test_filter_out_typeptr():
+    effects = frozenset([("struct", lltype.Ptr(OBJECT), "typeptr")])
+    effectinfo = effectinfo_from_writeanalyze(effects, None)
+    assert not effectinfo.write_descrs_fields
+    assert not effectinfo.write_descrs_arrays



More information about the Pypy-commit mailing list