[pypy-svn] r78563 - pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test

arigo at codespeak.net arigo at codespeak.net
Sat Oct 30 19:24:25 CEST 2010


Author: arigo
Date: Sat Oct 30 19:24:24 2010
New Revision: 78563

Modified:
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizefficall.py
Log:
Fix test_optimizefficall.


Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py	Sat Oct 30 19:24:24 2010
@@ -226,7 +226,7 @@
     _kind2count = {history.INT: 1, history.REF: 2, history.FLOAT: 3}
     return sorted(boxes, key=lambda box: _kind2count[box.type])
 
-class BaseTestOptimizeBasic(BaseTest):
+class BaseTestBasic(BaseTest):
 
     def invent_fail_descr(self, fail_args):
         if fail_args is None:
@@ -259,12 +259,14 @@
                                                      OptVirtualize,
                                                      OptString,
                                                      OptHeap,
+                                                     OptFfiCall,
                                                      Optimizer)
         optimizations = [OptIntBounds(),
                          OptRewrite(),
                          OptVirtualize(),
                          OptString(),
                          OptHeap(),
+                         OptFfiCall(),
                          ]
         optimizer = Optimizer(metainterp_sd, loop, optimizations,
                               not_a_bridge=True)
@@ -274,6 +276,9 @@
         print '\n'.join([str(o) for o in loop.operations])
         self.assert_equal(loop, expected)
 
+
+class BaseTestOptimizeBasic(BaseTestBasic):
+
     def test_simple(self):
         ops = """
         [i]

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizefficall.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizefficall.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizefficall.py	Sat Oct 30 19:24:24 2010
@@ -2,7 +2,8 @@
 from pypy.rlib.libffi import Func, types
 from pypy.jit.metainterp.history import AbstractDescr
 from pypy.jit.codewriter.effectinfo import EffectInfo
-from pypy.jit.metainterp.test.test_optimizeopt import BaseTestOptimizeOpt, LLtypeMixin
+from pypy.jit.metainterp.test.test_optimizebasic import BaseTestBasic
+from pypy.jit.metainterp.test.test_optimizebasic import LLtypeMixin
 
 class MyCallDescr(AbstractDescr):
     """
@@ -30,7 +31,7 @@
         return id(self)
 
 
-class TestFfiCall(BaseTestOptimizeOpt, LLtypeMixin):
+class TestFfiCall(BaseTestBasic, LLtypeMixin):
 
     class namespace:
         cpu = LLtypeMixin.cpu
@@ -45,13 +46,15 @@
                              argtypes=[types.sint, types.double],
                              restype=types.sint)
         #
-        def calldescr(cpu, FUNC, oopspecindex):
-            einfo = EffectInfo([], [], [], oopspecindex=oopspecindex)
+        def calldescr(cpu, FUNC, oopspecindex, extraeffect=None):
+            einfo = EffectInfo([], [], [], oopspecindex=oopspecindex,
+                               extraeffect=extraeffect)
             return cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, einfo)
         #
         libffi_prepare =  calldescr(cpu, FUNC, EffectInfo.OS_LIBFFI_PREPARE)
         libffi_push_arg = calldescr(cpu, FUNC, EffectInfo.OS_LIBFFI_PUSH_ARG)
-        libffi_call =     calldescr(cpu, FUNC, EffectInfo.OS_LIBFFI_CALL)
+        libffi_call =     calldescr(cpu, FUNC, EffectInfo.OS_LIBFFI_CALL,
+                                 EffectInfo.EF_FORCES_VIRTUAL_OR_VIRTUALIZABLE)
     
     namespace = namespace.__dict__
 
@@ -77,7 +80,7 @@
         guard_no_exception() []
         jump(i3, f1)
         """
-        loop = self.optimize_loop(ops, 'Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     def test_ffi_call_nonconst(self):
         ops = """
@@ -91,7 +94,7 @@
         jump(i3, f1, p2)
         """
         expected = ops
-        loop = self.optimize_loop(ops, 'Not, Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     def test_handle_virtualizables(self):
         # this test needs an explanation to understand what goes on: see the
@@ -117,7 +120,7 @@
         guard_no_exception() [p2]
         jump(i3, f1, p2)
         """
-        loop = self.optimize_loop(ops, 'Not, Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     # ----------------------------------------------------------------------
     # in pratice, the situations described in these tests should never happen,
@@ -136,7 +139,7 @@
         jump(i3, f1)
         """
         expected = ops
-        loop = self.optimize_loop(ops, 'Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     def test_rollback_multiple_calls(self):
         ops = """
@@ -159,7 +162,7 @@
         jump(i3, i4, f1)
         """
         expected = ops
-        loop = self.optimize_loop(ops, 'Not, Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     def test_rollback_multiple_prepare(self):
         ops = """
@@ -182,7 +185,7 @@
         jump(i3, i4, f1)
         """
         expected = ops
-        loop = self.optimize_loop(ops, 'Not, Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     def test_optimize_nested_call(self):
         ops = """
@@ -220,7 +223,7 @@
         guard_no_exception() []
         jump(i3, i4, f1)
         """
-        loop = self.optimize_loop(ops, 'Not, Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)
 
     def test_rollback_force_token(self):
         ops = """
@@ -237,4 +240,4 @@
         jump(i3, f1, p2)
         """
         expected = ops
-        loop = self.optimize_loop(ops, 'Not, Not, Not', expected)
+        loop = self.optimize_loop(ops, expected)



More information about the Pypy-commit mailing list