Author: Maciej Fijalkowski <fij...@gmail.com>
Branch: kill-gen-store-back-in
Changeset: r62799:637b1b38a06f
Date: 2013-03-25 22:34 -0700
http://bitbucket.org/pypy/pypy/changeset/637b1b38a06f/

Log:    remove forcing on virtuals

diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py 
b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -54,7 +54,7 @@
             expected_short = self.parse(expected_short)
 
         preamble = self.unroll_and_optimize(loop, call_pure_results)
-        
+
         #
         print
         print "Preamble:"
@@ -219,7 +219,7 @@
         """
         self.optimize_loop(ops, expected)
 
-    def test_reverse_of_cast_2(self):        
+    def test_reverse_of_cast_2(self):
         ops = """
         [p0]
         i1 = cast_ptr_to_int(p0)
@@ -1292,7 +1292,7 @@
         p30 = new_with_vtable(ConstClass(node_vtable))
         setfield_gc(p30, i28, descr=nextdescr)
         setfield_gc(p3, p30, descr=valuedescr)
-        p46 = same_as(p30) # This same_as should be killed by backend        
+        p46 = same_as(p30) # This same_as should be killed by backend
         jump(i29, p30, p3)
         """
         expected = """
@@ -2415,7 +2415,7 @@
         p2 = new_with_vtable(ConstClass(node_vtable))
         setfield_gc(p2, p4, descr=nextdescr)
         setfield_gc(p1, p2, descr=nextdescr)
-        i101 = same_as(i4) 
+        i101 = same_as(i4)
         jump(p1, i2, i4, p4, i101)
         """
         expected = """
@@ -3273,7 +3273,7 @@
         setfield_gc(p1, i1, descr=valuedescr)
         i3 = call_assembler(i1, descr=asmdescr)
         setfield_gc(p1, i3, descr=valuedescr)
-        i143 = same_as(i3) # Should be killed by backend        
+        i143 = same_as(i3) # Should be killed by backend
         jump(p1, i4, i3)
         '''
         self.optimize_loop(ops, ops, preamble)
@@ -3384,7 +3384,7 @@
         escape(i2)
         i4 = call(123456, 4, i0, 6, descr=plaincalldescr)
         guard_no_exception() []
-        i155 = same_as(i4)        
+        i155 = same_as(i4)
         jump(i0, i4, i155)
         '''
         expected = '''
@@ -5833,7 +5833,7 @@
         [p1, i1, i2, i3]
         escape(i3)
         i4 = int_sub(i2, i1)
-        i5 = same_as(i4)        
+        i5 = same_as(i4)
         jump(p1, i1, i2, i4, i5)
         """
         expected = """
@@ -6919,6 +6919,19 @@
         """
         self.optimize_loop(ops, expected)
 
+    def test_force_virtualizable_virtual(self):
+        ops = """
+        [i0]
+        p1 = new_with_vtable(ConstClass(node_vtable))
+        force_virtualizable(p1)
+        jump(i0)
+        """
+        expected = """
+        [i0]
+        jump(i0)
+        """
+        self.optimize_loop(ops, expected)
+
     def test_setgetfield_counter(self):
         ops = """
         [p1]
@@ -7091,7 +7104,7 @@
         [i0]
         i2 = int_lt(i0, 10)
         guard_true(i2) []
-        i1 = int_add(i0, 1)        
+        i1 = int_add(i0, 1)
         jump(i1)
         """
         self.optimize_loop(ops, expected)
@@ -7790,7 +7803,7 @@
         jump(i0, p0, i2)
         """
         self.optimize_loop(ops, expected)
-        
+
     def test_constant_failargs(self):
         ops = """
         [p1, i2, i3]
@@ -7871,7 +7884,7 @@
         jump()
         """
         self.optimize_loop(ops, expected)
-        
+
 
     def test_issue1080_infinitie_loop_simple(self):
         ops = """
@@ -7903,8 +7916,8 @@
     def test_licm_boxed_opaque_getitem(self):
         ops = """
         [p1]
-        p2 = getfield_gc(p1, descr=nextdescr) 
-        mark_opaque_ptr(p2)        
+        p2 = getfield_gc(p1, descr=nextdescr)
+        mark_opaque_ptr(p2)
         guard_class(p2,  ConstClass(node_vtable)) []
         i3 = getfield_gc(p2, descr=otherdescr)
         i4 = call(i3, descr=nonwritedescr)
@@ -7920,8 +7933,8 @@
     def test_licm_boxed_opaque_getitem_unknown_class(self):
         ops = """
         [p1]
-        p2 = getfield_gc(p1, descr=nextdescr) 
-        mark_opaque_ptr(p2)        
+        p2 = getfield_gc(p1, descr=nextdescr)
+        mark_opaque_ptr(p2)
         i3 = getfield_gc(p2, descr=otherdescr)
         i4 = call(i3, descr=nonwritedescr)
         jump(p1)
@@ -7937,7 +7950,7 @@
     def test_licm_unboxed_opaque_getitem(self):
         ops = """
         [p2]
-        mark_opaque_ptr(p2)        
+        mark_opaque_ptr(p2)
         guard_class(p2,  ConstClass(node_vtable)) []
         i3 = getfield_gc(p2, descr=otherdescr)
         i4 = call(i3, descr=nonwritedescr)
@@ -7953,14 +7966,14 @@
     def test_licm_unboxed_opaque_getitem_unknown_class(self):
         ops = """
         [p2]
-        mark_opaque_ptr(p2)        
+        mark_opaque_ptr(p2)
         i3 = getfield_gc(p2, descr=otherdescr)
         i4 = call(i3, descr=nonwritedescr)
         jump(p2)
         """
         expected = """
         [p2]
-        i3 = getfield_gc(p2, descr=otherdescr) 
+        i3 = getfield_gc(p2, descr=otherdescr)
         i4 = call(i3, descr=nonwritedescr)
         jump(p2)
         """
diff --git a/rpython/jit/metainterp/optimizeopt/virtualize.py 
b/rpython/jit/metainterp/optimizeopt/virtualize.py
--- a/rpython/jit/metainterp/optimizeopt/virtualize.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualize.py
@@ -398,6 +398,12 @@
             return
         self.emit_operation(op)
 
+    def optimize_FORCE_VIRTUALIZABLE(self, op):
+        val = self.getvalue(op.getarg(0))
+        if val.is_virtual():
+            return
+        self.emit_operation(op)
+
     def optimize_CALL_MAY_FORCE(self, op):
         effectinfo = op.getdescr().get_extra_info()
         oopspecindex = effectinfo.oopspecindex
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to