[pypy-commit] pypy jit-short_from_state: clone the snapshot in start_resumedescr before inlining it and reenable the "trace some more"-feature

hakanardo noreply at buildbot.pypy.org
Wed Jul 13 10:16:45 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r45520:ec6703579cf2
Date: 2011-07-12 18:26 +0200
http://bitbucket.org/pypy/pypy/changeset/ec6703579cf2/

Log:	clone the snapshot in start_resumedescr before inlining it and
	reenable the "trace some more"-feature

diff --git a/pypy/jit/metainterp/optimizeopt/unroll.py b/pypy/jit/metainterp/optimizeopt/unroll.py
--- a/pypy/jit/metainterp/optimizeopt/unroll.py
+++ b/pypy/jit/metainterp/optimizeopt/unroll.py
@@ -139,6 +139,22 @@
         for op in self.optimizer.loop.operations:
             newop = op.clone()
             self.cloned_operations.append(newop)
+
+    def fix_snapshot(self, loop, jump_args, snapshot):
+        if snapshot is None:
+            return None
+        snapshot_args = snapshot.boxes 
+        new_snapshot_args = []
+        for a in snapshot_args:
+            if not isinstance(a, Const):
+                a = loop.preamble.inputargs[jump_args.index(a)]
+            a = self.inliner.inline_arg(a)
+            a = self.getvalue(a).get_key_box()
+            new_snapshot_args.append(a)
+        prev = self.fix_snapshot(loop, jump_args, snapshot.prev)
+        return Snapshot(prev, new_snapshot_args)
+        #snapshot.boxes = new_snapshot_args
+        #return snapshot
             
     def propagate_all_forward(self):
         loop = self.optimizer.loop
@@ -185,18 +201,8 @@
             start_resumedescr = loop.preamble.start_resumedescr.clone_if_mutable()
             self.start_resumedescr = start_resumedescr
             assert isinstance(start_resumedescr, ResumeGuardDescr)
-            snapshot = start_resumedescr.rd_snapshot
-            while snapshot is not None:
-                snapshot_args = snapshot.boxes 
-                new_snapshot_args = []
-                for a in snapshot_args:
-                    if not isinstance(a, Const):
-                        a = loop.preamble.inputargs[jump_args.index(a)]
-                    a = self.inliner.inline_arg(a)
-                    a = self.getvalue(a).get_key_box()
-                    new_snapshot_args.append(a)
-                snapshot.boxes = new_snapshot_args
-                snapshot = snapshot.prev
+            start_resumedescr.rd_snapshot = self.fix_snapshot(loop, jump_args,
+                                                              start_resumedescr.rd_snapshot)
 
             inputargs, short_inputargs, short = self.inline(self.cloned_operations,
                                            loop.inputargs, jump_args,
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -1847,9 +1847,9 @@
                 else:
                     self.compile(original_boxes, live_arg_boxes, start, resumedescr)
                 # creation of the loop was cancelled!
-                #self.staticdata.log('cancelled, tracing more...')
-                self.staticdata.log('cancelled, stopping tracing')
-                raise SwitchToBlackhole(ABORT_BAD_LOOP)
+                self.staticdata.log('cancelled, tracing more...')
+                #self.staticdata.log('cancelled, stopping tracing')
+                #raise SwitchToBlackhole(ABORT_BAD_LOOP)
 
         # Otherwise, no loop found so far, so continue tracing.
         start = len(self.history.operations)


More information about the pypy-commit mailing list