Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: value-profiling Changeset: r78981:d34953857d58 Date: 2015-08-14 12:10 +0200 http://bitbucket.org/pypy/pypy/changeset/d34953857d58/
Log: (cfbolz, arigo around): deal with non-constant classes in record_exact_class diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py --- a/rpython/jit/metainterp/optimizeopt/rewrite.py +++ b/rpython/jit/metainterp/optimizeopt/rewrite.py @@ -334,7 +334,9 @@ def optimize_RECORD_EXACT_CLASS(self, op): value = self.getvalue(op.getarg(0)) expectedclassbox = op.getarg(1) - assert isinstance(expectedclassbox, Const) + if not isinstance(expectedclassbox, Const): + # can't optimize + return realclassbox = value.get_constant_class(self.optimizer.cpu) if realclassbox is not None: assert realclassbox.same_constant(expectedclassbox) diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py @@ -7098,6 +7098,20 @@ jump(p1) """ self.optimize_loop(ops, expected) + ops = """ + [p0, i0] + p1 = getfield_gc(p0, descr=nextdescr) + record_exact_class(p1, i0) + guard_class(p1, ConstClass(node_vtable)) [] + jump(p1, i0) + """ + expected = """ + [p0, i0] + p1 = getfield_gc(p0, descr=nextdescr) + guard_class(p1, ConstClass(node_vtable)) [] + jump(p1, i0) + """ + self.optimize_loop(ops, expected) def test_quasi_immut(self): ops = """ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit