[pypy-commit] pypy stmgc-c7: Un-delete this test (see 53a2a9ecde3e) and make it pass
arigo
noreply at buildbot.pypy.org
Sun Mar 23 08:24:55 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r70182:52f5f6d0153b
Date: 2014-03-23 08:24 +0100
http://bitbucket.org/pypy/pypy/changeset/52f5f6d0153b/
Log: Un-delete this test (see 53a2a9ecde3e) and make it pass
diff --git a/rpython/memory/gctransform/stmframework.py b/rpython/memory/gctransform/stmframework.py
--- a/rpython/memory/gctransform/stmframework.py
+++ b/rpython/memory/gctransform/stmframework.py
@@ -91,6 +91,12 @@
hop.genop("stm_write", [v_struct])
hop.rename('bare_' + opname)
+ def gct_gc_writebarrier(self, hop):
+ v_struct = hop.spaceop.args[0]
+ assert var_needsgc(v_struct), ("gc_writebarrier: the argument is %r"
+ % v_struct.concretetype)
+ hop.genop("stm_write", [v_struct])
+
def gc_header_for(self, obj, needs_hash=False):
return self.gcdata.gc.gcheaderbuilder.header_of_object(obj)
diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -382,6 +382,23 @@
assert match
assert int(match.group(1)) < 20
+ def test_gc_writebarrier(self):
+ X = lltype.GcStruct('X', ('foo', lltype.Signed))
+ prebuilt = lltype.malloc(X, immortal=True)
+ prebuilt.foo = 42
+
+ def main(argv):
+ llop.gc_writebarrier(lltype.Void, prebuilt)
+ debug_print(objectmodel.current_object_addr_as_int(prebuilt))
+ prebuilt.foo = 43
+ debug_print(objectmodel.current_object_addr_as_int(prebuilt))
+ return 0
+
+ t, cbuilder = self.compile(main)
+ data, dataerr = cbuilder.cmdexec('', err=True)
+ lines = dataerr.split('\n')
+ assert lines[0] == lines[1]
+
def test_dtoa(self):
def main(argv):
a = len(argv) * 0.2
More information about the pypy-commit
mailing list