Author: Hakan Ardo <ha...@debian.org> Branch: jit-short_from_state Changeset: r45837:3c2afbf75c4a Date: 2011-07-21 20:37 +0200 http://bitbucket.org/pypy/pypy/changeset/3c2afbf75c4a/
Log: produce guards before forcing virtuals as one force might lead to another diff --git a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/pypy/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -6579,6 +6579,20 @@ """ self.optimize_loop(ops, expected) + def test_chained_virtuals(self): + ops = """ + [p0, p1] + p2 = new_with_vtable(ConstClass(node_vtable)) + p3 = new_with_vtable(ConstClass(node_vtable)) + setfield_gc(p2, p3, descr=nextdescr) + jump(p2, p3) + """ + expected = """ + [] + jump() + """ + self.optimize_loop(ops, expected) + def test_arraylen_bound(self): ops = """ [p1, i] diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py --- a/pypy/jit/metainterp/optimizeopt/unroll.py +++ b/pypy/jit/metainterp/optimizeopt/unroll.py @@ -217,15 +217,18 @@ inputarg_setup_ops = [] preamble_optimizer.newoperations = [] seen = {} + for box in inputargs: + if box in seen: + continue + seen[box] = True + value = preamble_optimizer.getvalue(box) + inputarg_setup_ops.extend(value.make_guards(box)) for box in short_inputargs: if box in seen: continue seen[box] = True value = preamble_optimizer.getvalue(box) - if value.is_virtual(): value.force_box() - else: - inputarg_setup_ops.extend(value.make_guards(box)) preamble_optimizer.flush() inputarg_setup_ops += preamble_optimizer.newoperations _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit