[pypy-svn] r64993 - pypy/branch/pyjitpl5/pypy/jit/backend/test

fijal at codespeak.net fijal at codespeak.net
Sun May 3 05:24:20 CEST 2009


Author: fijal
Date: Sun May  3 05:24:17 2009
New Revision: 64993

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
Log:
Yet-another-case. Boring, all x86 tests are passing


Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py	Sun May  3 05:24:17 2009
@@ -232,7 +232,28 @@
         builder.cpu.clear_exception()
         op = ResOperation(rop.GUARD_EXCEPTION, [exc_box], BoxPtr())
         op.suboperations = [ResOperation(rop.FAIL, [], None)]
-        builder.loop.operations.append(op)        
+        builder.loop.operations.append(op)
+
+# 4. raising call and guard_no_exception
+
+class RaisingCallOperationGuardNoException(BaseCallOperation):
+    def produce_into(self, builder, r):
+        subset, f, exc = self.raising_func_code(builder, r)
+        TP = lltype.FuncType([lltype.Signed] * len(subset), lltype.Void)
+        ptr = llhelper(lltype.Ptr(TP), f)
+        c_addr = ConstAddr(llmemory.cast_ptr_to_adr(ptr), builder.cpu)
+        args = [c_addr] + subset
+        descr = builder.cpu.calldescrof(TP, TP.ARGS, TP.RESULT)
+        self.put(builder, args, descr)
+        assert builder.cpu.get_exception()
+        builder.cpu.clear_exception()
+        op = ResOperation(rop.GUARD_NO_EXCEPTION, [], BoxPtr())
+        op._exc_box = ConstAddr(llmemory.cast_ptr_to_adr(exc), builder.cpu)
+        subset = builder.subset_of_intvars(r)
+        op.suboperations = [ResOperation(rop.FAIL, subset, None)]
+        builder.should_fail_by = op.suboperations[0]
+        builder.guard_op = op
+        builder.loop.operations.append(op)
 
 # ____________________________________________________________
 
@@ -248,6 +269,7 @@
     OPERATIONS.append(GuardClassOperation(rop.GUARD_CLASS))
     OPERATIONS.append(CallOperation(rop.CALL))
     OPERATIONS.append(RaisingCallOperation(rop.CALL))
+    OPERATIONS.append(RaisingCallOperationGuardNoException(rop.CALL))
 
 LLtypeOperationBuilder.OPERATIONS = OPERATIONS
 

Modified: pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py	Sun May  3 05:24:17 2009
@@ -389,6 +389,10 @@
             cpu.set_future_value_int(i, v)
         op = cpu.execute_operations(self.loop)
         assert op is self.should_fail_by
+        if (self.guard_op is not None and
+            self.guard_op.opnum == rop.GUARD_NO_EXCEPTION):
+            assert cpu.get_exception()
+            cpu.clear_exception()
         for i, v in enumerate(op.args):
             value = cpu.get_latest_value_int(i)
             assert value == self.expected[v], (
@@ -397,6 +401,13 @@
                 )
 
     def build_bridge(self):
+        def exc_handling(guard_op):
+            # operations need to start with correct GUARD_EXCEPTION
+            op = ResOperation(rop.GUARD_EXCEPTION, [guard_op._exc_box],
+                              BoxPtr())
+            op.suboperations = [ResOperation(rop.FAIL, [], None)]
+            return op
+
         if self.dont_generate_more:
             return False
         r = self.r
@@ -406,6 +417,8 @@
         if not op.args:
             return False
         subloop = DummyLoop(guard_op.suboperations)
+        if guard_op.opnum == rop.GUARD_NO_EXCEPTION:
+            guard_op.suboperations.append(exc_handling(guard_op))
         bridge_builder = self.builder.__class__(self.builder.cpu, subloop,
                                                 op.args[:])
         self.generate_ops(bridge_builder, r, subloop, op.args[:])
@@ -424,6 +437,10 @@
             if self.guard_op is None:
                 guard_op.suboperations[-1] = jump_op
             else:
+                if self.guard_op.opnum == rop.GUARD_NO_EXCEPTION:
+                    # exception clearing
+                    self.guard_op.suboperations.insert(-1, exc_handling(
+                        self.guard_op))
                 self.guard_op.suboperations[-1] = jump_op
             self.guard_op = jump_target.guard_op
             self.prebuilt_ptr_consts += jump_target.prebuilt_ptr_consts



More information about the Pypy-commit mailing list