Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: guard-compatible
Changeset: r83184:ada9ee9869bc
Date: 2016-03-20 09:39 +0100
http://bitbucket.org/pypy/pypy/changeset/ada9ee9869bc/

Log:    fix: things were broken with more than two args that are not the
        quasi-immutable case

diff --git a/rpython/jit/metainterp/compatible.py 
b/rpython/jit/metainterp/compatible.py
--- a/rpython/jit/metainterp/compatible.py
+++ b/rpython/jit/metainterp/compatible.py
@@ -78,6 +78,10 @@
         if op.numargs() == 2:
             return copied_op, PureCallCondition(op)
         arg2 = copied_op.getarg(2)
+        if arg2.is_constant():
+            # already a constant, can just use PureCallCondition
+            return copied_op, PureCallCondition(op)
+
         # really simple-minded pattern matching
         # the order of things is like this:
         # GUARD_COMPATIBLE(x)
diff --git a/rpython/jit/metainterp/compile.py 
b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -1095,13 +1095,11 @@
         assert typetag == self.TY_REF # for now
         refval = metainterp_sd.cpu.get_value_direct(deadframe, 'r', index)
         if self.is_compatible(metainterp_sd.cpu, refval):
-            print "~~~~~~~~~~~~~~~~~~~ compatible! growing switch", self
             from rpython.jit.metainterp.blackhole import resume_in_blackhole
             metainterp_sd.cpu.grow_guard_compatible_switch(
                 self.rd_loop_token, self, refval)
             resume_in_blackhole(metainterp_sd, jitdriver_sd, self, deadframe)
         else:
-            print "~~~~~~~~~~~~~~~~~~~ not compatible!", self
             # a real failure
             return ResumeGuardDescr.handle_fail(self, deadframe, 
metainterp_sd, jitdriver_sd)
 
diff --git a/rpython/jit/metainterp/test/test_compatible.py 
b/rpython/jit/metainterp/test/test_compatible.py
--- a/rpython/jit/metainterp/test/test_compatible.py
+++ b/rpython/jit/metainterp/test/test_compatible.py
@@ -22,7 +22,7 @@
         c = A()
         c.count = 0
         @jit.elidable_compatible()
-        def g(s):
+        def g(s, ignored):
             c.count += 1
             return s.x
 
@@ -30,9 +30,10 @@
             while n > 0:
                 driver.can_enter_jit(n=n, x=x)
                 driver.jit_merge_point(n=n, x=x)
-                n -= g(x)
+                n -= g(x, 7)
 
         def main():
+            g(p1, 9) # make annotator not make argument constant
             f(100, p1)
             f(100, p2)
             f(100, p3)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to