[pypy-svn] r79424 - in pypy/branch/jit-unroll-loops/pypy/jit/metainterp: . optimizeopt

hakanardo at codespeak.net hakanardo at codespeak.net
Tue Nov 23 18:25:47 CET 2010


Author: hakanardo
Date: Tue Nov 23 18:25:44 2010
New Revision: 79424

Modified:
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/logger.py
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py
Log:
added some logging

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/compile.py	Tue Nov 23 18:25:44 2010
@@ -108,6 +108,11 @@
     globaldata.loopnumbering += 1
 
     metainterp_sd.logger_ops.log_loop(loop.inputargs, loop.operations, n, type)
+    short = loop.token.short_preamble
+    if short:
+        metainterp_sd.logger_ops.log_short_preamble(short.inputargs,
+                                                     short.operations)
+
     if not we_are_translated():
         show_loop(metainterp_sd, loop)
         loop.check_consistency()

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/logger.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/logger.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/logger.py	Tue Nov 23 18:25:44 2010
@@ -38,6 +38,11 @@
             self._log_operations(inputargs, operations)
             debug_stop("jit-log-opt-bridge")
 
+    def log_short_preamble(self, inputargs, operations):
+        debug_start("jit-log-short-preamble")
+        self._log_operations(inputargs, operations)
+        debug_stop("jit-log-short-preamble")            
+
     def repr_of_descr(self, descr):
         return descr.repr_of_descr()
 

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py	Tue Nov 23 18:25:44 2010
@@ -3,6 +3,7 @@
 from pypy.jit.metainterp.compile import ResumeGuardDescr
 from pypy.jit.metainterp.resume import Snapshot
 from pypy.jit.metainterp.history import TreeLoop, LoopToken
+from pypy.rlib.debug import debug_start, debug_stop, debug_print
 
 # FXIME: Introduce some VirtualOptimizer super class instead
 
@@ -201,28 +202,26 @@
         state = ExeState()
         short_preamble = []
         loop_i = preamble_i = 0
-        while loop_i < len(loop)-1 and preamble_i < len(preamble)-1:
-            if self.sameop(preamble[preamble_i], loop[loop_i]):
+        while preamble_i < len(preamble)-1:
+            if self.sameop(preamble[preamble_i], loop[loop_i]) \
+               and loop_i < len(loop)-1:
                 loop_i += 1
             else:
                 if not state.safe_to_move(preamble[preamble_i]):
-                    #print "Unsafe heap operation."
+                    debug_print("create_short_preamble failed due to",
+                                "unsafe op:", preamble[preamble_i].getopnum(),
+                                "at position: ", preamble_i)
                     return None
                 short_preamble.append(preamble[preamble_i])
             state.update(preamble[preamble_i])
             preamble_i += 1
 
 
-        if loop_i < len(loop)-1: 
-            #print "Loop contains ops not in preamble???"
+        if loop_i < len(loop)-1:
+            debug_print("create_short_preamble failed due to",
+                        "loop contaning ops not in preamble"
+                        "at position", loop_i)
             return None
-        while preamble_i < len(preamble)-1:
-            if not state.safe_to_move(preamble[preamble_i]):
-                #print "Unsafe heap operation."
-                return None
-            short_preamble.append(preamble[preamble_i])
-            state.update(preamble[preamble_i])
-            preamble_i += 1
 
         jumpargs = [None] * len(inputargs)
         allboxes = preambleargs[:]
@@ -240,7 +239,8 @@
         
         for a in jumpargs:
             if a is None:
-                #print "Unable to find all input arguments???"
+                debug_print("create_short_preamble failed due to",
+                            "input arguments not located")
                 return None
 
         jmp = ResOperation(rop.JUMP, jumpargs[:], None)
@@ -257,7 +257,8 @@
         for op in short_preamble:
             for box in op.getarglist():
                 if box not in seen:
-                    #print "Op arguments not produced???"
+                    debug_print("create_short_preamble failed due to",
+                                "op arguments not produced")
                     return None
             if op.result:
                 seen[op.result] = True



More information about the Pypy-commit mailing list