[pypy-svn] r74710 - in pypy/branch/blackhole-improvement/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Mon May 24 16:31:38 CEST 2010


Author: arigo
Date: Mon May 24 16:31:36 2010
New Revision: 74710

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitprof.py
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_jitprof.py
Log:
Fix jitprof.


Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitprof.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitprof.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/jitprof.py	Mon May 24 16:31:36 2010
@@ -96,7 +96,7 @@
         self.t1 = self.starttime
         self.times = [0, 0]
         self.counters = [0] * ncounters
-        self.calls = [[0, 0], [0, 0], [0, 0]]
+        self.calls = [[0, 0], [0, 0]]
         self.current = []
 
     def finish(self):
@@ -149,10 +149,10 @@
     def count_ops(self, opnum, kind=OPS):
         from pypy.jit.metainterp.resoperation import rop
         self.counters[kind] += 1
-        if opnum == rop.CALL or opnum == rop.OOSEND:
+        if opnum == rop.CALL:  # or opnum == rop.OOSEND:
             self.calls[kind-OPS][0] += 1
-        elif opnum == rop.CALL_PURE or opnum == rop.OOSEND_PURE:
-            self.calls[kind-OPS][1] += 1        
+        elif opnum == rop.CALL_PURE:  # or opnum == rop.OOSEND_PURE:
+            self.calls[kind-OPS][1] += 1
 
     def print_stats(self):
         cnt = self.counters
@@ -171,8 +171,6 @@
         self._print_intline("  calls", calls[1][0])
         self._print_intline("  pure calls", calls[1][1])
         self._print_intline("guards", cnt[GUARDS])
-        self._print_intline("blackholed ops", calls[2][0])
-        self._print_intline("  pure calls", calls[2][1])
         self._print_intline("opt ops", cnt[OPT_OPS])
         self._print_intline("opt guards", cnt[OPT_GUARDS])
         self._print_intline("forcings", cnt[OPT_FORCINGS])

Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_jitprof.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_jitprof.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_jitprof.py	Mon May 24 16:31:36 2010
@@ -63,7 +63,7 @@
             ]
         assert profiler.events == expected
         assert profiler.times == [2, 1, 1, 1]
-        assert profiler.counters == [1, 1, 1, 1, 4, 3, 1, 1, 7, 1, 0, 0, 0,
+        assert profiler.counters == [1, 1, 1, 1, 3, 3, 1, 7, 1, 0, 0, 0,
                                      0, 0, 0, 0]
 
     def test_simple_loop_with_call(self):
@@ -84,8 +84,8 @@
         res = self.meta_interp(f, [6, 7])
         assert res == 84
         profiler = pyjitpl._warmrunnerdesc.metainterp_sd.profiler
-        # calls = (executed, recorded, blackholed) x (inpure, pure)
-        assert profiler.calls == [[1, 0], [1, 0], [0, 0]]
+        # calls = (executed, recorded) x (inpure, pure)
+        assert profiler.calls == [[1, 0], [1, 0]]
 
     def test_blackhole_pure(self):
         @purefunction
@@ -99,12 +99,11 @@
                 myjitdriver.can_enter_jit(x=x, y=y, res=res, z=z)
                 myjitdriver.jit_merge_point(x=x, y=y, res=res, z=z)
                 res += x
-                if y == 1:
-                    res += g(z)
+                res += g(z)
                 y -= 1
             return res * 2
         res = self.meta_interp(f, [6, 7, 2])
-        assert res == 90
+        assert res == f(6, 7, 2)
         profiler = pyjitpl._warmrunnerdesc.metainterp_sd.profiler
-        # calls = (executed, recorded, blackholed) x (inpure, pure)
-        assert profiler.calls == [[0, 1], [0, 0], [0, 1]]
+        # calls = (executed, recorded) x (inpure, pure)
+        assert profiler.calls == [[0, 1], [0, 0]]



More information about the Pypy-commit mailing list