Author: Armin Rigo <[email protected]>
Branch: stmgc-c4
Changeset: r66882:de0e05b91573
Date: 2013-09-09 22:29 +0200
http://bitbucket.org/pypy/pypy/changeset/de0e05b91573/
Log: A test and small fixes for gc_writebarrier in stm.
diff --git a/rpython/memory/gctransform/framework.py
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -745,9 +745,7 @@
resultvar=op.result)
def gct_gc_writebarrier(self, hop):
- # this operation is removed by stm/writebarrier.py
- assert not self.translator.config.translation.stm
- if self.write_barrier_ptr is None:
+ if self.write_barrier_ptr is None: # incl. in case of stm
return
op = hop.spaceop
v_addr = op.args[0]
diff --git a/rpython/translator/stm/inevitable.py
b/rpython/translator/stm/inevitable.py
--- a/rpython/translator/stm/inevitable.py
+++ b/rpython/translator/stm/inevitable.py
@@ -18,7 +18,7 @@
'weakref_create', 'weakref_deref',
'stm_threadlocalref_get', 'stm_threadlocalref_set',
'stm_threadlocalref_count', 'stm_threadlocalref_addr',
- 'jit_assembler_call',
+ 'jit_assembler_call', 'gc_writebarrier',
])
ALWAYS_ALLOW_OPERATIONS |= set(lloperation.enum_tryfold_ops())
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
@@ -358,3 +358,21 @@
match = re.search(r"(\d+) mallocs left", dataerr)
assert match
assert int(match.group(1)) < 20
+
+ def test_gc_writebarrier(self):
+ class X(object):
+ pass
+ prebuilt = X()
+ 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]
diff --git a/rpython/translator/stm/writebarrier.py
b/rpython/translator/stm/writebarrier.py
--- a/rpython/translator/stm/writebarrier.py
+++ b/rpython/translator/stm/writebarrier.py
@@ -201,8 +201,6 @@
newoperations.append(newop)
ren.newvar = w
ren.category = to
- if op.opname == 'gc_writebarrier':
- continue # remove after inserting 'stm_barrier'
#
newop = SpaceOperation(op.opname,
[renamings_get(v) for v in op.args],
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit