[pypy-svn] pypy default: add a way to distinguish loops and entry bridges
antocuni
commits-noreply at bitbucket.org
Fri Feb 18 18:30:59 CET 2011
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch:
Changeset: r42177:2b39e1dc17af
Date: 2011-02-18 17:09 +0100
http://bitbucket.org/pypy/pypy/changeset/2b39e1dc17af/
Log: add a way to distinguish loops and entry bridges
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
@@ -47,11 +47,20 @@
ids[name] = opcodes
return ids
- def by_filename(self, filename):
- return [func for func in self.functions if func.filename == filename]
+ def _filter(self, function, is_entry_bridge=False):
+ return is_entry_bridge == '*' or function.is_entry_bridge == is_entry_bridge
+
+ def by_filename(self, filename, **kwds):
+ return [func for func in self.functions
+ if func.filename == filename and self._filter(func, **kwds)]
class FunctionWithIds(Function):
+ is_entry_bridge = False
+
@classmethod
def from_trace(cls, trace, storage):
- return cls.from_operations(trace.operations, storage)
+ res = cls.from_operations(trace.operations, storage)
+ if 'entry bridge' in trace.comment:
+ res.is_entry_bridge = True
+ return res
diff --git a/pypy/module/pypyjit/test_pypy_c/test_model.py b/pypy/module/pypyjit/test_pypy_c/test_model.py
--- a/pypy/module/pypyjit/test_pypy_c/test_model.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_model.py
@@ -82,5 +82,13 @@
#
log = self.run(f)
loops = log.by_filename(self.filepath)
- assert len(loops) == 2 # loop and entry bridge
-
+ assert len(loops) == 1
+ assert loops[0].filename == self.filepath
+ assert not loops[0].is_entry_bridge
+ #
+ loops = log.by_filename(self.filepath, is_entry_bridge=True)
+ assert len(loops) == 1
+ assert loops[0].is_entry_bridge
+ #
+ loops = log.by_filename(self.filepath, is_entry_bridge='*')
+ assert len(loops) == 2
More information about the Pypy-commit
mailing list