[pypy-commit] pypy jit-usable_retrace_2: extract loops at end of bridges too

hakanardo noreply at buildbot.pypy.org
Thu Jan 5 18:26:42 CET 2012


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-usable_retrace_2
Changeset: r51034:ba02b282da2e
Date: 2012-01-05 10:41 +0100
http://bitbucket.org/pypy/pypy/changeset/ba02b282da2e/

Log:	extract loops at end of bridges too

diff --git a/pypy/module/pypyjit/test_pypy_c/test_00_model.py b/pypy/module/pypyjit/test_pypy_c/test_00_model.py
--- a/pypy/module/pypyjit/test_pypy_c/test_00_model.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_00_model.py
@@ -44,6 +44,7 @@
         #
         # run a child pypy-c with logging enabled
         logfile = self.filepath.new(ext='.log')
+        print logfile
         #
         cmdline = [sys.executable]
         if not import_site:
@@ -53,6 +54,7 @@
                           for key, value in jitopts.items()]
             cmdline += ['--jit', ','.join(jitcmdline)]
         cmdline.append(str(self.filepath))
+        print ' '.join(cmdline)
         #
         env={'PYPYLOG': self.log_string + ':' + str(logfile)}
         pipe = subprocess.Popen(cmdline,
diff --git a/pypy/module/pypyjit/test_pypy_c/test_misc.py b/pypy/module/pypyjit/test_pypy_c/test_misc.py
--- a/pypy/module/pypyjit/test_pypy_c/test_misc.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_misc.py
@@ -21,7 +21,7 @@
         # not virtual, then "i" is written and thus we get a new loop where
         # "i" is virtual. However, in this specific case the two loops happen
         # to contain the very same operations
-        loop0, loop1 = log.loops_by_filename(self.filepath)
+        loop0, loop1, loop2 = log.loops_by_filename(self.filepath)
         
         expected = """
             i9 = int_le(i7, i8)
@@ -39,6 +39,7 @@
         # becomes constant 0 after the bridge and constant 1 at the end of the
         # loop. A bridge back to the peramble is produced instead.        
         assert loop1.match(expected)
+        assert loop2.match(expected)
 
     def test_factorial(self):
         def fact(n):
diff --git a/pypy/tool/jitlogparser/storage.py b/pypy/tool/jitlogparser/storage.py
--- a/pypy/tool/jitlogparser/storage.py
+++ b/pypy/tool/jitlogparser/storage.py
@@ -76,7 +76,12 @@
                     op.percentage = ((getattr(loop, 'count', 1) * 100) /
                                      max(getattr(parent, 'count', 1), 1))
                     loop.no = no
-                    continue
+
+                    labels = [op for op in loop.operations if op.name == 'label']
+                    jumpop = loop.operations[-1]
+                    if not (labels and jumpop.name == 'jump' and 
+                            jumpop.getdescr() == labels[-1].getdescr()):
+                        continue
             res.append(loop)
         self.loops = res
         return res


More information about the pypy-commit mailing list