Author: Carl Friedrich Bolz <[email protected]>
Branch: guard-compatible
Changeset: r83014:4f6cf238e74a
Date: 2016-03-13 18:06 +0100
http://bitbucket.org/pypy/pypy/changeset/4f6cf238e74a/
Log: emitting guard_value after guard_compatible replaces the
guard_compatible
diff --git a/rpython/jit/metainterp/optimizeopt/pure.py
b/rpython/jit/metainterp/optimizeopt/pure.py
--- a/rpython/jit/metainterp/optimizeopt/pure.py
+++ b/rpython/jit/metainterp/optimizeopt/pure.py
@@ -228,6 +228,7 @@
info._compatibility_conditions = CompatibilityCondition(
op.getarg(1))
self.emit_operation(op)
+ info.mark_last_guard(self.optimizer)
def optimize_GUARD_NO_EXCEPTION(self, op):
if self.last_emitted_operation is REMOVED:
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
@@ -416,6 +416,12 @@
r = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
raise InvalidLoop('A GUARD_VALUE (%s) was proven to '
'always fail' % r)
+ if old_guard_op.getopnum() == rop.GUARD_COMPATIBLE:
+ if not old_guard_op.getarg(1).same_constant(op.getarg(1)):
+ r1 = self.optimizer.metainterp_sd.logger_ops.repr_of_resop(op)
+ r2 =
self.optimizer.metainterp_sd.logger_ops.repr_of_resop(old_guard)
+ raise InvalidLoop('a GUARD_COMPATIBLE (%s) is inconsistent '
+ 'with a GUARD_VALUE (%s)' % (r1, r2))
descr = compile.ResumeGuardDescr()
op = old_guard_op.copy_and_change(rop.GUARD_VALUE,
args = [old_guard_op.getarg(0), op.getarg(1)],
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
b/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_compatible.py
@@ -22,6 +22,14 @@
"""
self.optimize_loop(ops, expected)
+ ops = """
+ [p1]
+ guard_compatible(p1, ConstPtr(myptr)) []
+ guard_value(p1, ConstPtr(myptr)) []
+ jump(ConstPtr(myptr))
+ """
+ self.optimize_loop(ops, expected)
+
def test_guard_compatible_after_guard_compatible(self):
ops = """
[p1]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit