[pypy-svn] r69700 - in pypy/branch/virtual-forcing/pypy/jit/backend: test x86

arigo at codespeak.net arigo at codespeak.net
Fri Nov 27 15:02:14 CET 2009


Author: arigo
Date: Fri Nov 27 15:02:13 2009
New Revision: 69700

Modified:
   pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py
   pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py
Log:
(pedronis, arigo)
It actually makes no sense for cpu.force() to be a no-op if
already forced.  Kill the feature and the test.


Modified: pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/test/runner_test.py	Fri Nov 27 15:02:13 2009
@@ -1263,38 +1263,6 @@
         assert self.cpu.get_latest_value_int(1) == 10
         assert values == [1, 10]
 
-    def test_double_force(self):
-        values = []
-        def double_force(token):
-            self.cpu.force(token)
-            values.append(self.cpu.get_latest_value_int(0))
-            self.cpu.force(token)
-            values.append(self.cpu.get_latest_value_int(1))
-        
-        FUNC = self.FuncType([lltype.Signed], lltype.Void)
-        func_ptr = llhelper(lltype.Ptr(FUNC), double_force)
-        funcbox = self.get_funcbox(self.cpu, func_ptr).constbox()
-        calldescr = self.cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT)
-        cpu = self.cpu
-        i0 = BoxInt()
-        i1 = BoxInt()
-        tok = BoxInt()
-        faildescr = BasicFailDescr(1)
-        ops = [
-        ResOperation(rop.FORCE_TOKEN, [], tok),
-        ResOperation(rop.CALL_MAY_FORCE, [funcbox, tok], None,
-                     descr=calldescr),
-        ResOperation(rop.GUARD_NOT_FORCED, [], None, descr=faildescr),
-        ResOperation(rop.FINISH, [i0], None, descr=BasicFailDescr(0))
-        ]
-        ops[2].fail_args = [i1, i0]
-        looptoken = LoopToken()
-        self.cpu.compile_loop([i0, i1], ops, looptoken)
-        self.cpu.set_future_value_int(0, 20)
-        self.cpu.set_future_value_int(1, 0)
-        fail = self.cpu.execute_token(looptoken)
-        assert values == [0, 20]
-
     # pure do_ / descr features
 
     def test_do_operations(self):

Modified: pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/backend/x86/runner.py	Fri Nov 27 15:02:13 2009
@@ -90,8 +90,7 @@
     def force(self, addr_of_force_index):
         TP = rffi.CArrayPtr(lltype.Signed)
         fail_index = rffi.cast(TP, addr_of_force_index)[0]
-        if fail_index < 0:
-            return    # already forced
+        assert fail_index >= 0, "already forced!"
         faildescr = self.get_fail_descr_from_number(fail_index)
         rffi.cast(TP, addr_of_force_index)[0] = -1
         bytecode = rffi.cast(rffi.UCHARP,



More information about the Pypy-commit mailing list