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

arigo at codespeak.net arigo at codespeak.net
Wed Apr 29 15:28:20 CEST 2009


Author: arigo
Date: Wed Apr 29 15:28:19 2009
New Revision: 64808

Modified:
   pypy/branch/pyjitpl5/pypy/jit/backend/test/test_random.py
Log:
Occasionally produce a very large integer, like sys.maxint or -sys.maxint-1.


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 Apr 29 15:28:19 2009
@@ -289,7 +289,7 @@
 
 for i in range(4):      # make more common
     OPERATIONS.append(GetFieldOperation(rop.GETFIELD_GC))
-    OPERATIONS.append(GetFieldOperation(rop.GETFIELD_GC_PURE))
+    OPERATIONS.append(GetFieldOperation(rop.GETFIELD_GC))
     OPERATIONS.append(SetFieldOperation(rop.SETFIELD_GC))
     OPERATIONS.append(NewOperation(rop.NEW))
 
@@ -309,6 +309,12 @@
                 break
         if r.randrange(0, 5) <= 1:
             result = -result
+        if result not in (0, -1) and r.random() < 0.1:
+            # occasionally produce a very large integer.  The algo is such
+            # that it's likely we get a special value, e.g. sys.maxint or
+            # -sys.maxint-1.
+            while intmask(result << 2) == (result << 2):
+                result = (result << 2) | (result & 0x3)
         return result
     r.random_integer = get_random_integer
     return r



More information about the Pypy-commit mailing list