Author: Remi Meier <[email protected]>
Branch: stmgc-c7
Changeset: r71368:9e10d6372feb
Date: 2014-05-07 13:41 +0200
http://bitbucket.org/pypy/pypy/changeset/9e10d6372feb/
Log: does_any_allocation in rewrite should be cleared on labels
diff --git a/rpython/jit/backend/llsupport/rewrite.py
b/rpython/jit/backend/llsupport/rewrite.py
--- a/rpython/jit/backend/llsupport/rewrite.py
+++ b/rpython/jit/backend/llsupport/rewrite.py
@@ -36,6 +36,8 @@
_previous_size = -1
_op_malloc_nursery = None
_v_last_malloced_nursery = None
+
+ # does_any_alloc tells us if we did any allocation since the last LABEL
does_any_allocation = False
def __init__(self, gc_ll_descr, cpu):
@@ -64,6 +66,7 @@
elif op.getopnum() == rop.LABEL:
self.emitting_an_operation_that_can_collect()
self.known_lengths.clear()
+ self.does_any_allocation = False
# ---------- write barriers ----------
if self.gc_ll_descr.write_barrier_descr is not None:
if op.getopnum() == rop.SETFIELD_GC:
diff --git a/rpython/jit/backend/llsupport/test/test_stmrewrite.py
b/rpython/jit/backend/llsupport/test/test_stmrewrite.py
--- a/rpython/jit/backend/llsupport/test/test_stmrewrite.py
+++ b/rpython/jit/backend/llsupport/test/test_stmrewrite.py
@@ -1267,3 +1267,19 @@
i2 = stm_should_break_transaction(0)
jump(i1, i2)
""")
+
+ def test_label_stm_should_break_allocation(self):
+ self.check_rewrite("""
+ []
+ p2 = new(descr=tdescr)
+ label()
+ i1 = stm_should_break_transaction(0)
+ jump(i1)
+ """, """
+ []
+ p2 = call_malloc_nursery(%(tdescr.size)d)
+ setfield_gc(p2, %(tdescr.tid)d, descr=tiddescr)
+ label()
+ i1 = stm_should_break_transaction(1)
+ jump(i1)
+ """)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit