[pypy-svn] r63437 - in pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp: . test

fijal at codespeak.net fijal at codespeak.net
Mon Mar 30 15:55:35 CEST 2009


Author: fijal
Date: Mon Mar 30 15:55:32 2009
New Revision: 63437

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_loop.py
Log:
(pedronis, fijal)
* Skipped test to decide what to do
* Reset the counter when tracing didn't succeed on a guard failure


Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	Mon Mar 30 15:55:32 2009
@@ -839,7 +839,11 @@
             self.interpret()
             assert False, "should always raise"
         except GenerateMergePoint, gmp:
-            target_loop = self.compile_bridge(key, gmp.argboxes)
+            try:
+                target_loop = self.compile_bridge(key, gmp.argboxes)
+            except self.ContinueRunningNormally:
+                guard_failure.key.counter = 0
+                raise
             return self.designate_target_loop(gmp, target_loop)
 
     def designate_target_loop(self, gmp, loop):

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_loop.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_loop.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_loop.py	Mon Mar 30 15:55:32 2009
@@ -431,3 +431,39 @@
         assert main_interpreter_loop(5) == 5 * 10 * 3
         res = self.meta_interp(main_interpreter_loop, [5])
         assert res == 5 * 10 * 3
+
+    def test_outer_and_inner_loop(self):
+        py.test.skip("fix me")
+        jitdriver = JitDriver(greens = ['p', 'code'], reds = ['i', 'j',
+                                                              'total'])
+
+        codes = [[], [0, 0, 1, 1]]
+        
+        def interpret(num):
+            code = codes[num]
+            p = 0
+            i = 0
+            j = 0
+            total = 0
+            while p < len(code):
+                jitdriver.jit_merge_point(code=code, p=p, i=i, j=j, total=total)
+                total += i
+                e = code[p]
+                if e == 0:
+                    p += 1
+                elif e == 1:
+                    if i < p * 20:
+                        p = 3 - p
+                        i += 1
+                        jitdriver.can_enter_jit(code=code, p=p, j=j, i=i,
+                                                total=total)
+                    else:
+                        j += 1
+                        i = j
+                        p += 1
+            return total
+
+        res = self.meta_interp(interpret, [1])
+        assert res == interpret(1)
+        # XXX it's unsure how many loops should be there
+        self.check_loop_count(3)



More information about the Pypy-commit mailing list