[pypy-svn] r32886 - in pypy/dist/pypy/rpython/memory/gctransform2: . test
mwh at codespeak.net
mwh at codespeak.net
Wed Oct 4 19:48:23 CEST 2006
Author: mwh
Date: Wed Oct 4 19:48:22 2006
New Revision: 32886
Added:
pypy/dist/pypy/rpython/memory/gctransform2/test/test_protect.py (contents, props changed)
Modified:
pypy/dist/pypy/rpython/memory/gctransform2/boehm.py
Log:
add test for and make simple fix to gc_protect/gc_unprotect stuff.
Modified: pypy/dist/pypy/rpython/memory/gctransform2/boehm.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform2/boehm.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform2/boehm.py Wed Oct 4 19:48:22 2006
@@ -19,7 +19,7 @@
""" for boehm it is enough to do nothing"""
pass
- def gct_gc_unprotect(self, op, livevars, block):
+ def gct_gc_unprotect(self, hop):
""" for boehm it is enough to do nothing"""
pass
Added: pypy/dist/pypy/rpython/memory/gctransform2/test/test_protect.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/memory/gctransform2/test/test_protect.py Wed Oct 4 19:48:22 2006
@@ -0,0 +1,26 @@
+from pypy.rpython.memory.gctransform2.refcounting import \
+ RefcountingGCTransformer
+from pypy.rpython.memory.gctransform2.boehm import \
+ BoehmGCTransformer
+from pypy.rpython.memory.gctransform2.test.test_transform import \
+ rtype, rtype_and_transform, getops
+from pypy.rpython.lltypesystem.lloperation import llop
+from pypy.rpython.lltypesystem import lltype
+from pypy.translator.translator import graphof
+
+# ____________________________________________________________________
+# testing the protection magic
+
+def test_protect_unprotect():
+ def p(): llop.gc_protect(lltype.Void, 'this is an object')
+ def u(): llop.gc_unprotect(lltype.Void, 'this is an object')
+
+ rgc = RefcountingGCTransformer
+ bgc = BoehmGCTransformer
+ expected = [1, 1, 0, 0]
+ gcs = [rgc, rgc, bgc, bgc]
+ fs = [p, u, p, u]
+ for ex, f, gc in zip(expected, fs, gcs):
+ t, transformer = rtype_and_transform(f, [], gc, check=False)
+ ops = getops(graphof(t, f))
+ assert len(ops.get('direct_call', [])) == ex
More information about the Pypy-commit
mailing list