[pypy-svn] r66560 - in pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Thu Jul 23 21:41:01 CEST 2009


Author: arigo
Date: Thu Jul 23 21:41:01 2009
New Revision: 66560

Removed:
   pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/optimize3.py
   pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimize3.py
Modified:
   pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimizeopt.py
Log:
Port the remaining tests from test_optimize3, and remove it.


Modified: pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimizeopt.py	(original)
+++ pypy/branch/pyjitpl5-optimize4/pypy/jit/metainterp/test/test_optimizeopt.py	Thu Jul 23 21:41:01 2009
@@ -153,7 +153,7 @@
 
     # ----------
 
-    def test_remove_guard_class(self):
+    def test_remove_guard_class_1(self):
         ops = """
         [p0]
         guard_class(p0, ConstClass(node_vtable))
@@ -170,6 +170,23 @@
         """
         self.optimize_loop(ops, 'Not', expected)
 
+    def test_remove_guard_class_2(self):
+        ops = """
+        [i0]
+        p0 = new_with_vtable(ConstClass(node_vtable))
+        escape(p0)
+        guard_class(p0, ConstClass(node_vtable))
+          fail()
+        jump(i0)
+        """
+        expected = """
+        [i0]
+        p0 = new_with_vtable(ConstClass(node_vtable))
+        escape(p0)
+        jump(i0)
+        """
+        self.optimize_loop(ops, 'Not', expected)
+
     def test_remove_consecutive_guard_value_constfold(self):
         ops = """
         [i0]
@@ -503,6 +520,27 @@
         """
         self.optimize_loop(ops, 'Not', expected)
 
+    def test_virtual_4(self):
+        ops = """
+        [i0, p0]
+        guard_class(p0, ConstClass(node_vtable))
+          fail()
+        i1 = getfield_gc(p0, descr=valuedescr)
+        i2 = int_sub(i1, 1)
+        i3 = int_add(i0, i1)
+        p1 = new_with_vtable(ConstClass(node_vtable), descr=nodesize)
+        setfield_gc(p1, i2, descr=valuedescr)
+        jump(i3, p1)
+        """
+        expected = """
+        [i0, i1]
+        i2 = int_sub(i1, 1)
+        i3 = int_add(i0, i1)
+        jump(i3, i2)
+        """
+        self.optimize_loop(ops, 'Not, Virtual(node_vtable, valuedescr=Not)',
+                           expected)
+
     def test_nonvirtual_1(self):
         ops = """
         [i]
@@ -538,6 +576,28 @@
         expected = ops
         self.optimize_loop(ops, 'Not, Not', expected)
 
+    def test_nonvirtual_later(self):
+        ops = """
+        [i]
+        p1 = new_with_vtable(ConstClass(node_vtable))
+        setfield_gc(p1, i, descr=valuedescr)
+        i1 = getfield_gc(p1, descr=valuedescr)
+        escape(p1)
+        i2 = getfield_gc(p1, descr=valuedescr)
+        i3 = int_add(i1, i2)
+        jump(i3)
+        """
+        expected = """
+        [i]
+        p1 = new_with_vtable(ConstClass(node_vtable))
+        setfield_gc(p1, i, descr=valuedescr)
+        escape(p1)
+        i2 = getfield_gc(p1, descr=valuedescr)
+        i3 = int_add(i, i2)
+        jump(i3)
+        """
+        self.optimize_loop(ops, 'Not', expected)
+
     def test_getfield_gc_pure_1(self):
         ops = """
         [i]



More information about the Pypy-commit mailing list