[pypy-commit] pypy jit-short_from_state: generated the guards before emitting as emitting might strengthen the guards

hakanardo noreply at buildbot.pypy.org
Mon Jun 6 14:23:28 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r44738:2520cdcd75cd
Date: 2011-06-06 14:15 +0200
http://bitbucket.org/pypy/pypy/changeset/2520cdcd75cd/

Log:	generated the guards before emitting as emitting might strengthen
	the guards

diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -298,6 +298,7 @@
         
         for result, op in self.short_boxes.items():
             if op is not None:
+                assert result is op.result
                 if len(self.getvalue(result).make_guards(result)) > 0:
                     self.add_op_to_short(op, short, short_seen)
 
@@ -358,7 +359,11 @@
         if op.is_guard():
             descr = self.start_resumedescr.clone_if_mutable()
             op.setdescr(descr)
-            
+
+        value_guards = []
+        if op.result in self.short_boxes:
+            value_guards = self.getvalue(op.result).make_guards(op.result)
+
         short.append(op)
         short_seen[op.result] = True
         newop = self.short_inliner.inline_op(op)
@@ -368,10 +373,8 @@
             # FIXME: ensure that GUARD_OVERFLOW:ed ops not end up here
             guard = ResOperation(rop.GUARD_NO_OVERFLOW, [], None)
             self.add_op_to_short(guard, short, short_seen)
-
-        if op.result in self.short_boxes:
-            for guard in self.getvalue(op.result).make_guards(op.result):
-                self.add_op_to_short(guard, short, short_seen)
+        for guard in value_guards:
+            self.add_op_to_short(guard, short, short_seen)
 
         return newop.result
         


More information about the pypy-commit mailing list