[pypy-commit] pypy jit-short_from_state: properly parse loops not starting with a debug_merge_point op

hakanardo noreply at buildbot.pypy.org
Sat May 21 16:03:14 CEST 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short_from_state
Changeset: r44355:2d8aa4398c09
Date: 2011-05-21 16:13 +0200
http://bitbucket.org/pypy/pypy/changeset/2d8aa4398c09/

Log:	properly parse loops not starting with a debug_merge_point op

diff --git a/pypy/module/pypyjit/test_pypy_c/model.py b/pypy/module/pypyjit/test_pypy_c/model.py
--- a/pypy/module/pypyjit/test_pypy_c/model.py
+++ b/pypy/module/pypyjit/test_pypy_c/model.py
@@ -74,6 +74,9 @@
         Function.__init__(self, *args, **kwds)
         self.ids = {}
         self.code = self.chunks[0].getcode()
+        if not self.code and isinstance(self.chunks[1], TraceForOpcode):
+            # First chunk might be missing the debug_merge_point op
+            self.code = self.chunks[1].getcode()
         if self.code:
             self.compute_ids(self.ids)
 
@@ -131,8 +134,9 @@
     def _allops(self, include_debug_merge_points=False, opcode=None):
         opcode_name = opcode
         for chunk in self.flatten_chunks():
-            opcode = chunk.getopcode()                                                          
-            if opcode_name is None or opcode.__class__.__name__ == opcode_name:
+            opcode = chunk.getopcode()
+            if opcode_name is None or \
+                   (opcode and opcode.__class__.__name__ == opcode_name):
                 for op in self._ops_for_chunk(chunk, include_debug_merge_points):
                     yield op
 
diff --git a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
--- a/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_pypy_c_new.py
@@ -777,7 +777,6 @@
             log = self.run(src, [], threshold=400)
             assert log.result == res
             for loop in log.loops_by_filename(self.filepath):
-                loop.print_ops()            
                 le_ops = log.opnames(loop.ops_by_id('lt'))
                 ge_ops = log.opnames(loop.ops_by_id('ge'))
                 assert le_ops.count('int_lt') == 1
@@ -1728,4 +1727,4 @@
             # few instructions
             loop.match_by_id("contains", """
                 i1 = int_add(i0, 1)
-            """)
\ No newline at end of file
+            """)
diff --git a/pypy/tool/jitlogparser/parser.py b/pypy/tool/jitlogparser/parser.py
--- a/pypy/tool/jitlogparser/parser.py
+++ b/pypy/tool/jitlogparser/parser.py
@@ -120,6 +120,8 @@
         return self.code
 
     def getopcode(self):
+        if self.code is None:
+            return None
         return self.code.map[self.bytecode_no]
 
     def getlineno(self):


More information about the pypy-commit mailing list