[pypy-svn] r49504 - in pypy/branch/lazy-write-barrier/pypy/rpython/memory: gctransform/test test

fijal at codespeak.net fijal at codespeak.net
Fri Dec 7 12:27:18 CET 2007


Author: fijal
Date: Fri Dec  7 12:27:18 2007
New Revision: 49504

Modified:
   pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/test/test_framework.py
   pypy/branch/lazy-write-barrier/pypy/rpython/memory/test/test_transformed_gc.py
Log:
Shuffle this test around, now it works (still not testing anything, but that's
another level)


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	Fri Dec  7 12:27:18 2007
@@ -166,28 +166,4 @@
     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('Child', ('field', lltype.Signed)))
-    T_PARENT = lltype.Ptr(lltype.GcStruct('Parent', ('sub', T_CHILD)))
-    child = lltype.malloc(T_CHILD.TO)
-    child2 = lltype.malloc(T_CHILD.TO)
-    parent = lltype.malloc(T_PARENT.TO)
-    parent2 = lltype.malloc(T_PARENT.TO)
-    parent.sub = child
-    child.field = 3
-    parent2.sub = child2
-    child2.field = 8
-
-    T_ALL = lltype.Ptr(lltype.GcArray(T_PARENT))
-    all = lltype.malloc(T_ALL.TO, 2)
-    all[0] = parent
-    all[1] = parent2
-
-    def f(x):
-        res = all[x]
-        all[x] = lltype.nullptr(T_PARENT.TO)
-        return res.sub.field
-
-    t, transformer = rtype_and_transform(f, [int], WriteBarrierTransformer)
     

Modified: pypy/branch/lazy-write-barrier/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/lazy-write-barrier/pypy/rpython/memory/test/test_transformed_gc.py	(original)
+++ pypy/branch/lazy-write-barrier/pypy/rpython/memory/test/test_transformed_gc.py	Fri Dec  7 12:27:18 2007
@@ -862,6 +862,30 @@
         run = self.runner(f, nbargs=0)
         run([])
 
+    def test_immutable_to_old_promotion(self):
+        T_CHILD = lltype.Ptr(lltype.GcStruct('Child', ('field', lltype.Signed)))
+        T_PARENT = lltype.Ptr(lltype.GcStruct('Parent', ('sub', T_CHILD)))
+        child = lltype.malloc(T_CHILD.TO)
+        child2 = lltype.malloc(T_CHILD.TO)
+        parent = lltype.malloc(T_PARENT.TO)
+        parent2 = lltype.malloc(T_PARENT.TO)
+        parent.sub = child
+        child.field = 3
+        parent2.sub = child2
+        child2.field = 8
+
+        T_ALL = lltype.Ptr(lltype.GcArray(T_PARENT))
+        all = lltype.malloc(T_ALL.TO, 2)
+        all[0] = parent
+        all[1] = parent2
+
+        def f(x, y):
+            res = all[x]
+            all[x] = lltype.nullptr(T_PARENT.TO)
+            return res.sub.field
+
+        run = self.runner(f, nbargs=2)
+        run([1, 4])
 
 class TestGenerationalNoFullCollectGC(GCTest):
     # test that nursery is doing its job and that no full collection



More information about the Pypy-commit mailing list