[pypy-commit] pypy default: backout 3f8b9a32c444, broke tests

bdkearns noreply at buildbot.pypy.org
Thu May 1 01:53:54 CEST 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r71112:43fa812a3a88
Date: 2014-04-30 19:53 -0400
http://bitbucket.org/pypy/pypy/changeset/43fa812a3a88/

Log:	backout 3f8b9a32c444, broke tests http://buildbot.pypy.org/summary?b
	ranch=%3Ctrunk%3E&recentrev=71106:fc261cbeb029

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
@@ -57,28 +57,6 @@
             self.emit_operation(nextop)
 
     def optimize_CALL_PURE(self, op):
-        # Step 1: check if all arguments are constant
-        arg_consts = []
-        for i in range(op.numargs()):
-            arg = op.getarg(i)
-            const = self.get_constant_box(arg)
-            if const is None:
-                break
-            arg_consts.append(const)
-        else:
-            # all constant arguments: check if we already know the result
-            try:
-                result = self.optimizer.call_pure_results[arg_consts]
-            except KeyError:
-                pass
-            else:
-                # this removes a CALL_PURE with all constant arguments.
-                self.make_constant(op.result, result)
-                self.last_emitted_operation = REMOVED
-                return
-
-        # Step 2: check if all arguments are the same as a previous
-        # CALL_PURE.
         args = self.optimizer.make_args_key(op)
         oldop = self.pure_operations.get(args, None)
         if oldop is not None and oldop.getdescr() is op.getdescr():
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
@@ -515,9 +515,30 @@
             return True # 0-length arraycopy
         return False
 
+    def optimize_CALL_PURE(self, op):
+        arg_consts = []
+        for i in range(op.numargs()):
+            arg = op.getarg(i)
+            const = self.get_constant_box(arg)
+            if const is None:
+                break
+            arg_consts.append(const)
+        else:
+            # all constant arguments: check if we already know the result
+            try:
+                result = self.optimizer.call_pure_results[arg_consts]
+            except KeyError:
+                pass
+            else:
+                # this removes a CALL_PURE with all constant arguments.
+                self.make_constant(op.result, result)
+                self.last_emitted_operation = REMOVED
+                return
+        self.emit_operation(op)
+
     def optimize_GUARD_NO_EXCEPTION(self, op):
         if self.last_emitted_operation is REMOVED:
-            # it was a CALL_LOOPINVARIANT that was killed;
+            # it was a CALL_PURE or a CALL_LOOPINVARIANT that was killed;
             # so we also kill the following GUARD_NO_EXCEPTION
             return
         self.emit_operation(op)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -5164,6 +5164,7 @@
         self.optimize_strunicode_loop(ops, expected)
 
     def test_call_pure_vstring_const(self):
+        py.test.skip("implement me")
         ops = """
         []
         p0 = newstr(3)


More information about the pypy-commit mailing list