Commits

Hakan Ardo  committed 5fa8a8e

only inherit the part of the short preamble for which we have failargs

  • Participants
  • Parent commits ad56d1e
  • Branches jit-fromstart

Comments (0)

Files changed (5)

File pypy/jit/metainterp/compile.py

 class ResumeDescr(AbstractFailDescr):
     def inline_short_preamble(self):
         return True
+    def has_parent_short_preamble(self):
+        return False
 
 class ResumeGuardDescr(ResumeDescr):
     _counter = 0        # if < 0, there is one counter per value;
     parent_short_preamble = None
     start_indexes = None
     rd_extrafailargs = None
-    # FIXME: Add theese to copy_all_attrbutes_into
+
 
     CNT_INT   = -0x20000000
     CNT_REF   = -0x40000000
         res.rd_consts = self.rd_consts
         res.rd_virtuals = self.rd_virtuals
         res.rd_pendingfields = self.rd_pendingfields
+        res.parent_short_preamble = self.parent_short_preamble 
+        res.start_indexes = self.start_indexes 
+        res.rd_extrafailargs = self.rd_extrafailargs 
 
     def _clone_if_mutable(self):
         res = ResumeGuardDescr()
         self.copy_all_attrbutes_into(res)
         return res
 
+    def has_parent_short_preamble(self):
+        return self.parent_short_preamble is not None
+    
 class ResumeAtPositionDescr(ResumeGuardDescr):
     def inline_short_preamble(self):
         return False

File pypy/jit/metainterp/optimizeopt/__init__.py

         optimize_unroll(metainterp_sd, loop, optimizations)
     else:
         optimizer = Optimizer(metainterp_sd, loop, optimizations)
-        if resumekey:
+        if resumekey and resumekey.has_parent_short_preamble():
             optimizer.initialize_state_from_guard_failure(resumekey)
         optimizer.propagate_all_forward()
 

File pypy/jit/metainterp/optimizeopt/optimizer.py

             print
             print
             for op in resumedescr.parent_short_preamble.operations[:-1]:
-                newop = inliner.inline_op(op, inline_result=True)
-                print newop
-                self.first_optimization.propagate_forward(newop)
+                if op.result and op.result not in inliner.argmap:
+                    continue
+                try:
+                    newop = inliner.inline_op(op, inline_result=True)
+                    self.first_optimization.propagate_forward(newop)
+                except KeyError:
+                    pass
                 # FIMXE: only ops with boxes in myboxes
         
     def force_at_end_of_preamble(self):

File pypy/jit/metainterp/optimizeopt/unroll.py

             else:
                 newop.setfailargs([])
 
+        descr = newop.getdescr()
+        if isinstance(descr, ResumeGuardDescr):
+            descr.rd_snapshot = self.inline_snapshot(descr.rd_snapshot)
+
         if newop.result and not ignore_result:
             old_result = newop.result
             if inline_result:
                 newop.result = newop.result.clonebox()
             self.argmap[old_result] = newop.result
 
-        descr = newop.getdescr()
-        if isinstance(descr, ResumeGuardDescr):
-            descr.rd_snapshot = self.inline_snapshot(descr.rd_snapshot)
-
         return newop
     
     def inline_arg(self, arg):

File pypy/jit/metainterp/test/test_basic.py

         self.check_loops({'int_add': 2, 'int_lt': 1,
                           'int_sub': 2, 'guard_false': 1,
                           'jump': 2,
-                          'int_gt': 1, 'guard_true': 1, 'int_mul': 1})
+                          'int_gt': 1, 'guard_true': 1})
 
     def test_loop_invariant_intbox(self):
         myjitdriver = JitDriver(greens = [], reds = ['y', 'res', 'x'])