Author: Carl Friedrich Bolz <[email protected]>
Branch: value-profiling
Changeset: r79084:ab5fe2fb0615
Date: 2015-08-20 11:09 +0200
http://bitbucket.org/pypy/pypy/changeset/ab5fe2fb0615/
Log: fix problem when the class is not a constant
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
@@ -335,8 +335,9 @@
value = self.getvalue(op.getarg(0))
expectedclassbox = op.getarg(1)
if not isinstance(expectedclassbox, Const):
- value.make_nonnull(None)
# can't optimize
+ if not value.is_nonnull():
+ value.make_nonnull(None)
return
realclassbox = value.get_constant_class(self.optimizer.cpu)
if realclassbox is not None:
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
@@ -7116,6 +7116,21 @@
"""
self.optimize_loop(ops, expected)
+ ops = """
+ [p0, i0]
+ p1 = getfield_gc(p0, descr=nextdescr)
+ guard_class(p1, ConstClass(node_vtable)) []
+ record_exact_class(p1, i0)
+ 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 = """
[p0, p1, i0]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit