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

arigo at codespeak.net arigo at codespeak.net
Wed May 6 16:22:44 CEST 2009


Author: arigo
Date: Wed May  6 16:22:42 2009
New Revision: 65102

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_ll_random.py
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
Log:
Fix again test_random to generate correct code with overflow.


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	Wed May  6 16:22:42 2009
@@ -327,6 +327,7 @@
 # 1. non raising call and guard_no_exception
 class CallOperation(BaseCallOperation):
     def produce_into(self, builder, r):
+        fail_subset = builder.subset_of_intvars(r)
         subset, f = self.non_raising_func_code(builder, r)
         if len(subset) == 0:
             RES = lltype.Void
@@ -339,7 +340,7 @@
         descr = builder.cpu.calldescrof(TP, TP.ARGS, TP.RESULT)
         self.put(builder, args, descr)
         op = ResOperation(rop.GUARD_NO_EXCEPTION, [], None)
-        op.suboperations = [ResOperation(rop.FAIL, [], None)]
+        op.suboperations = [ResOperation(rop.FAIL, fail_subset, None)]
         builder.loop.operations.append(op)
 
 # 5. Non raising-call and GUARD_EXCEPTION
@@ -371,6 +372,7 @@
 
 class RaisingCallOperation(BaseCallOperation):
     def produce_into(self, builder, r):
+        fail_subset = builder.subset_of_intvars(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)
@@ -382,7 +384,7 @@
         assert builder.cpu.get_exception()
         builder.cpu.clear_exception()
         op = ResOperation(rop.GUARD_EXCEPTION, [exc_box], BoxPtr())
-        op.suboperations = [ResOperation(rop.FAIL, [], None)]
+        op.suboperations = [ResOperation(rop.FAIL, fail_subset, None)]
         builder.loop.operations.append(op)
 
 # 4. raising call and guard_no_exception

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	Wed May  6 16:22:42 2009
@@ -221,6 +221,7 @@
 
 class AbstractOvfOperation(AbstractOperation):
     def produce_into(self, builder, r):
+        fail_subset = builder.subset_of_intvars(r)
         original_intvars = builder.intvars[:]
         super(AbstractOvfOperation, self).produce_into(builder, r)
         exc = builder.cpu.get_exception()
@@ -229,11 +230,14 @@
             exc_box = ConstInt(exc)
             res_box = BoxPtr()
             op = ResOperation(rop.GUARD_EXCEPTION, [exc_box], res_box)
-            # the overflowed result should not be used any more
+            # the overflowed result should not be used any more, but can
+            # be used on the failure path: recompute fail_subset including
+            # the result, and then remove it from builder.intvars.
+            fail_subset = builder.subset_of_intvars(r)
             builder.intvars[:] = original_intvars
         else:
             op = ResOperation(rop.GUARD_NO_EXCEPTION, [], None)
-        op.suboperations = [ResOperation(rop.FAIL, [], None)]
+        op.suboperations = [ResOperation(rop.FAIL, fail_subset, None)]
         builder.loop.operations.append(op)
 
 class BinaryOvfOperation(AbstractOvfOperation, BinaryOperation):



More information about the Pypy-commit mailing list