Commits

Hakan Ardo committed d0a9565

Take care of the case when inlining fails even if the dryrun was successfull

Comments (0)

Files changed (3)

pypy/jit/metainterp/optimizeopt/unroll.py

             assert isinstance(descr, LoopToken)
             # FIXME: Use a tree, similar to the tree formed by the full
             # preamble and it's bridges, instead of a list to save time and
-            # memory  
+            # memory. This should also allow better behaviour in
+            # situations that the is_emittable() chain currently cant
+            # handle and the inlining fails unexpectedly belwo.
             short = descr.short_preamble
             if short:
-                for sh in short:                    
+                for sh in short:
                     if self.inline(sh.operations, sh.inputargs,
                                    op.getarglist(), dryrun=True):
-                        self.inline(sh.operations, sh.inputargs,
-                                   op.getarglist())
+                        try:
+                            self.inline(sh.operations, sh.inputargs,
+                                        op.getarglist())
+                        except InvalidLoop:
+                            debug_print("Inlining failed unexpectedly",
+                                        "jumping to preamble instead")
+                        self.emit_operation(op)
                         return
                     
                 raise RetraceLoop

pypy/jit/metainterp/test/test_basic.py

                 myjitdriver.can_enter_jit(a=a, b=b, i=i, sa=sa)
                 myjitdriver.jit_merge_point(a=a, b=b, i=i, sa=sa)
                 if a > 0: pass
-                if 1 < b < 2: pass
+                if b < 2: pass
                 sa += a % b
                 i += 1
             return sa

pypy/module/pypyjit/test/test_pypy_c.py

                          count_debug_merge_point=False)
         
     def test_mod(self):
-        #py.test.skip('Results are correct, but traces 1902 times (on trunk too).')
         avalues = ('a', 'b', 7, -42, 8)
         bvalues = ['b'] + range(-10, 0) + range(1,10)
         code = ''