Author: Antonio Cuni <anto.c...@gmail.com>
Branch: 
Changeset: r44754:9890eb21d335
Date: 2011-06-06 17:29 +0200
http://bitbucket.org/pypy/pypy/changeset/9890eb21d335/

Log:    port this test to test_pypy_c_new

diff --git a/pypy/module/pypyjit/test/test_pypy_c.py 
b/pypy/module/pypyjit/test/test_pypy_c.py
--- a/pypy/module/pypyjit/test/test_pypy_c.py
+++ b/pypy/module/pypyjit/test/test_pypy_c.py
@@ -347,21 +347,6 @@
                                 ([a2, b2], 2000 * res2),
                                 ([a3, b3], 2000 * res3))
 
-    def test_id_compare_optimization(self):
-        # XXX: lower the instruction count, 35 is the old value.
-        self.run_source("""
-        class A(object):
-            pass
-        def main():
-            i = 0
-            a = A()
-            while i < 5:
-                if A() != a:
-                    pass
-                i += 1
-        """, 35, ([], None))
-        _, compare = self.get_by_bytecode("COMPARE_OP")
-        assert "call" not in compare.get_opnames()
 
 class AppTestJIT(PyPyCJITTests):
     def setup_class(cls):
diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py 
b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -1851,3 +1851,21 @@
         log = self.run(main, [-10, -20], threshold=200)
         assert log.result == 300 * (-10 % -20)
         assert log.jit_summary.tracing_no == 1
+
+    def test_id_compare_optimization(self):
+        def main():
+            class A(object):
+                pass
+            #
+            i = 0
+            a = A()
+            while i < 300:
+                new_a = A()
+                if new_a != a:  # ID: compare
+                    pass
+                i += 1
+            return i
+        #
+        log = self.run(main, [], threshold=200)
+        loop, = log.loops_by_filename(self.filepath)
+        assert loop.match_by_id("compare", "") # optimized away
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to