[pypy-svn] r49451 - pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/test

fijal at codespeak.net fijal at codespeak.net
Thu Dec 6 16:55:18 CET 2007


Author: fijal
Date: Thu Dec  6 16:55:17 2007
New Revision: 49451

Modified:
   pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/test/test_framework.py
Log:
Add a strange test where I try to have a static root.


Modified: pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/test/test_framework.py
==============================================================================
--- pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/test/test_framework.py	(original)
+++ pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/test/test_framework.py	Thu Dec  6 16:55:17 2007
@@ -166,3 +166,28 @@
     collect_analyzer = CollectAnalyzer(t)
     init_stores = find_initializing_stores(collect_analyzer, t.graphs[0])
     assert len(init_stores) == 5
+
+def test_immutable_to_old_promotion():
+    T_CHILD = lltype.Ptr(lltype.GcStruct('Childe', ('field', lltype.Signed)))
+    T_PARENT = lltype.Ptr(lltype.GcStruct('Parent', ('sub', T_CHILD)))
+    child = lltype.malloc(T_CHILD.TO)
+    parent = lltype.malloc(T_PARENT.TO)
+    parent.sub = child
+    child.field = 3
+    d = {'x' : parent}
+    d['y'] = lltype.malloc(T_PARENT.TO)
+    d['y'].sub = lltype.malloc(T_CHILD.TO)
+
+    def f(x, y):
+        t = d[y]
+        res = t.sub.field + x
+        del d[y]
+        return res
+
+    t = rtype(f, [int, str])
+    etrafo = ExceptionTransformer(t)
+    graphs = etrafo.transform_completely()
+    transformer = WriteBarrierTransformer(t)
+    transformer.finish()
+    graphof(t, f).show()
+    



More information about the Pypy-commit mailing list