[pypy-svn] r74930 - pypy/branch/blackhole-improvement/pypy/jit/backend/x86/test

arigo at codespeak.net arigo at codespeak.net
Sun May 30 20:30:08 CEST 2010


Author: arigo
Date: Sun May 30 20:30:07 2010
New Revision: 74930

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/backend/x86/test/test_ztranslation.py
Log:
A failing test.


Modified: pypy/branch/blackhole-improvement/pypy/jit/backend/x86/test/test_ztranslation.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/backend/x86/test/test_ztranslation.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/backend/x86/test/test_ztranslation.py	Sun May 30 20:30:07 2010
@@ -127,8 +127,14 @@
     def test_external_exception_handling_translates(self):
         jitdriver = JitDriver(greens = [], reds = ['n', 'total'])
 
+        class ImDone(Exception):
+            def __init__(self, resvalue):
+                self.resvalue = resvalue
+
         @dont_look_inside
-        def f(x):
+        def f(x, total):
+            if x <= 3:
+                raise ImDone(total * 10)
             if x > 20:
                 return 2
             raise ValueError
@@ -149,16 +155,16 @@
                 return Sub()
             else:
                 return Base()
-        def main(i):
+        def myportal(i):
             jitdriver.set_param("threshold", 3)
             jitdriver.set_param("trace_eagerness", 2)
             total = 0
             n = i
-            while n > 3:
+            while True:
                 jitdriver.can_enter_jit(n=n, total=total)
                 jitdriver.jit_merge_point(n=n, total=total)
                 try:
-                    total += f(n)
+                    total += f(n, total)
                 except ValueError:
                     total += 1
                 try:
@@ -166,7 +172,11 @@
                 except ValueError:
                     total -= 1
                 n -= h(n).meth()   # this is to force a GUARD_CLASS
-            return total * 10
+        def main(i):
+            try:
+                myportal(i)
+            except ImDone, e:
+                return e.resvalue
 
         # XXX custom fishing, depends on the exact env var and format
         logfile = udir.join('test_ztranslation.log')



More information about the Pypy-commit mailing list