Hakan Ardo avatar Hakan Ardo committed ba02b28

extract loops at end of bridges too

Comments (0)

Files changed (3)


         # run a child pypy-c with logging enabled
         logfile = self.filepath.new(ext='.log')
+        print logfile
         cmdline = [sys.executable]
         if not import_site:
                           for key, value in jitopts.items()]
             cmdline += ['--jit', ','.join(jitcmdline)]
+        print ' '.join(cmdline)
         env={'PYPYLOG': self.log_string + ':' + str(logfile)}
         pipe = subprocess.Popen(cmdline,


         # 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)
         # 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):


                     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
         self.loops = res
         return res
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.