[pypy-svn] r54480 - pypy/branch/gc-tweak/pypy/rpython/memory/test
arigo at codespeak.net
arigo at codespeak.net
Tue May 6 16:53:52 CEST 2008
Author: arigo
Date: Tue May 6 16:53:52 2008
New Revision: 54480
Modified:
pypy/branch/gc-tweak/pypy/rpython/memory/test/test_transformed_gc.py
Log:
Another passing test...
Modified: pypy/branch/gc-tweak/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/branch/gc-tweak/pypy/rpython/memory/test/test_transformed_gc.py (original)
+++ pypy/branch/gc-tweak/pypy/rpython/memory/test/test_transformed_gc.py Tue May 6 16:53:52 2008
@@ -919,3 +919,25 @@
'nursery_size': 128,
'large_object': 32}
root_stack_depth = 200
+
+ def test_ref_from_rawmalloced_to_regular(self):
+ import gc
+ S = lltype.GcStruct('S', ('x', lltype.Signed))
+ A = lltype.GcStruct('A', ('p', lltype.Ptr(S)),
+ ('a', lltype.Array(lltype.Char)))
+ def setup(j):
+ p = lltype.malloc(S)
+ p.x = j*2
+ lst = lltype.malloc(A, j)
+ # the following line generates a write_barrier call at the moment,
+ # which is important because the 'lst' can be allocated directly
+ # in generation 2. This can only occur with varsized mallocs.
+ lst.p = p
+ return lst
+ def f(i, j):
+ lst = setup(j)
+ gc.collect()
+ return lst.p.x
+ run = self.runner(f, nbargs=2)
+ res = run([100, 100])
+ assert res == 200
More information about the pypy-svn
mailing list