[pypy-svn] r65084 - pypy/branch/pyjitpl5/pypy/jit/metainterp/test

arigo at codespeak.net arigo at codespeak.net
Wed May 6 12:55:07 CEST 2009


Author: arigo
Date: Wed May  6 12:55:06 2009
New Revision: 65084

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py
Log:
Fix the test to actually test a bit more (now it returns the number
of ovfchecks that failed, instead of always 100 or 101).


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_exception.py	Wed May  6 12:55:06 2009
@@ -1,7 +1,7 @@
 import py
 from pypy.jit.metainterp.test.test_basic import LLJitMixin, OOJitMixin
 from pypy.rlib.jit import JitDriver
-from pypy.rlib.rarithmetic import ovfcheck
+from pypy.rlib.rarithmetic import ovfcheck, LONG_BIT
 from pypy.jit.metainterp.policy import StopAtXPolicy
 
 
@@ -368,18 +368,20 @@
     def test_int_lshift_ovf(self):
         from pypy.jit.metainterp.simple_optimize import Optimizer
         
-        myjitdriver = JitDriver(greens = [], reds = ['n', 'x', 'y'])
+        myjitdriver = JitDriver(greens = [], reds = ['n', 'x', 'y', 'm'])
         def f(x, y, n):
+            m = 0
             while n < 100:
-                myjitdriver.can_enter_jit(n=n, x=x, y=y)
-                myjitdriver.jit_merge_point(n=n, x=x, y=y)
+                myjitdriver.can_enter_jit(n=n, x=x, y=y, m=m)
+                myjitdriver.jit_merge_point(n=n, x=x, y=y, m=m)
                 y += 1
+                y &= (LONG_BIT-1)
                 try:
                     ovfcheck(x<<y)
                 except OverflowError:
-                    n += 1
+                    m += 1
                 n += 1
-            return n
+            return m
 
         res = self.meta_interp(f, [1, 1, 0], optimizer=Optimizer)
         assert res == f(1, 1, 0)



More information about the Pypy-commit mailing list