[pypy-svn] r24616 - pypy/dist/pypy/jit/test

pedronis at codespeak.net pedronis at codespeak.net
Mon Mar 20 17:08:25 CET 2006


Author: pedronis
Date: Mon Mar 20 17:08:13 2006
New Revision: 24616

Modified:
   pypy/dist/pypy/jit/test/test_llabstractinterp.py
Log:
another test.

here we don't merge again for subtle but correct structure sharing issues.



Modified: pypy/dist/pypy/jit/test/test_llabstractinterp.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_llabstractinterp.py	(original)
+++ pypy/dist/pypy/jit/test/test_llabstractinterp.py	Mon Mar 20 17:08:13 2006
@@ -7,6 +7,7 @@
 from pypy.annotation import model as annmodel
 from pypy.jit.llabstractinterp import LLAbstractInterp, Policy
 from pypy.objspace.flow import model as flowmodel
+from pypy.rpython import objectmodel
 
 def annotation(a, x):
     T = lltype.typeOf(x)
@@ -307,8 +308,27 @@
         s.n = 4
         if flag:
             s = t.s
-        return s.n
+        return s.n+2
     graph2, insns = abstrinterp(ll_function, [0], [])
+    assert insns['int_add'] == 2 # no merge
+
+def test_merge_cross_substructure():
+    S = lltype.Struct('S', ('n', lltype.Signed))
+    T = lltype.GcStruct('T', ('s', S), ('s1', S), ('n', lltype.Float))
+
+    def ll_function(flag):
+        t = lltype.malloc(T)
+        t.s.n = 3
+        t.s1.n = 3
+        if flag:
+            s = t.s
+        else:
+            s = t.s1
+        n = s.n
+        objectmodel.keepalive_until_here(t)
+        return n+2
+    graph2, insns = abstrinterp(ll_function, [0], [])
+    assert insns['int_add'] == 2 # no merge
 
 def test_merge_different_sharing():
     S = lltype.GcStruct('S', ('x', lltype.Signed), ('y', lltype.Signed))
@@ -334,6 +354,7 @@
         # the two t joining here are not mergeable
         return (t.s1.x+t.s1.x)*(t.s2.y+t.s2.y)
     graph2, insns = abstrinterp(ll_function, [0, 2, 3], [])
+    # no merge
     assert insns['int_add'] == 4
     assert insns['int_mul'] == 2    
             



More information about the Pypy-commit mailing list