[pypy-commit] pypy jit-refactor-tests: Resurrect check_loops

hakanardo noreply at buildbot.pypy.org
Sat Nov 26 12:57:06 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-refactor-tests
Changeset: r49807:4bc39a378477
Date: 2011-11-26 09:36 +0100
http://bitbucket.org/pypy/pypy/changeset/4bc39a378477/

Log:	Resurrect check_loops

diff --git a/pypy/jit/metainterp/history.py b/pypy/jit/metainterp/history.py
--- a/pypy/jit/metainterp/history.py
+++ b/pypy/jit/metainterp/history.py
@@ -1013,6 +1013,36 @@
                 "found %d %r, expected %d" % (found, insn, expected_count))
         return insns
         
+    def check_loops(self, expected=None, everywhere=False, **check):
+        insns = {}
+        for loop in self.loops:
+            #if not everywhere:
+            #    if getattr(loop, '_ignore_during_counting', False):
+            #        continue
+            insns = loop.summary(adding_insns=insns)
+        if expected is not None:
+            insns.pop('debug_merge_point', None)
+            print
+            print
+            print "        self.check_resops(%s)" % str(insns)
+            print
+            import pdb; pdb.set_trace()
+        else:
+            chk = ['%s=%d' % (i, insns.get(i, 0)) for i in check]
+            print
+            print
+            print "        self.check_resops(%s)" % ', '.join(chk)
+            print
+            import pdb; pdb.set_trace()
+        return
+        
+        for insn, expected_count in check.items():
+            getattr(rop, insn.upper())  # fails if 'rop.INSN' does not exist
+            found = insns.get(insn, 0)
+            assert found == expected_count, (
+                "found %d %r, expected %d" % (found, insn, expected_count))
+        return insns
+
     def check_consistency(self):
         "NOT_RPYTHON"
         for loop in self.loops:


More information about the pypy-commit mailing list