[pypy-commit] pypy kill-gen-store-back-in: merge fast-slowpath
fijal
noreply at buildbot.pypy.org
Wed Jul 24 21:24:12 CEST 2013
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: kill-gen-store-back-in
Changeset: r65627:4d3199d86bfc
Date: 2013-07-24 21:23 +0200
http://bitbucket.org/pypy/pypy/changeset/4d3199d86bfc/
Log: merge fast-slowpath
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
@@ -250,7 +250,7 @@
# This is only safe if the class of the guard_value matches the
# class of the guard_*_class, otherwise the intermediate ops might
# be executed with wrong classes.
- previous_classbox = value.get_constant_class(self.optimizer.cpu)
+ previous_classbox = value.get_constant_class(self.optimizer.cpu)
expected_classbox = self.optimizer.cpu.ts.cls_of_box(op.getarg(1))
assert previous_classbox is not None
assert expected_classbox is not None
@@ -343,6 +343,15 @@
resvalue = self.getvalue(op.result)
self.loop_invariant_results[key] = resvalue
+ def optimize_COND_CALL(self, op):
+ arg = op.getarg(0)
+ val = self.getvalue(arg)
+ if val.is_constant():
+ if val.box.same_constant(CONST_0):
+ return
+ op = op.copy_and_change(rop.CALL, args=op.getarglist()[1:])
+ self.emit_operation(op)
+
def _optimize_nullness(self, op, box, expect_nonnull):
value = self.getvalue(box)
if value.is_nonnull():
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
@@ -8165,9 +8165,7 @@
"""
self.optimize_loop(ops, expected)
-
-
- def test_only_strengthen_guard_if_class_matches(self):
+ def test_only_strengthen_guard_if_class_matches_2(self):
ops = """
[p1]
guard_class(p1, ConstClass(node_vtable2)) []
@@ -8177,6 +8175,30 @@
self.raises(InvalidLoop, self.optimize_loop,
ops, ops)
+ def test_cond_call_with_a_constant(self):
+ ops = """
+ [p1]
+ cond_call(1, 123, p1, descr=plaincalldescr)
+ jump(p1)
+ """
+ expected = """
+ [p1]
+ call(123, p1, descr=plaincalldescr)
+ jump(p1)
+ """
+ self.optimize_loop(ops, expected)
+
+ def test_cond_call_with_a_constant_2(self):
+ ops = """
+ [p1]
+ cond_call(0, 123, p1, descr=plaincalldescr)
+ jump(p1)
+ """
+ expected = """
+ [p1]
+ jump(p1)
+ """
+ self.optimize_loop(ops, expected)
class TestLLtype(OptimizeOptTest, LLtypeMixin):
pass
More information about the pypy-commit
mailing list