[pypy-svn] r70086 - in pypy/branch/virtual-forcing/pypy/jit/metainterp: . test

arigo at codespeak.net arigo at codespeak.net
Sun Dec 13 18:06:16 CET 2009


Author: arigo
Date: Sun Dec 13 18:06:15 2009
New Revision: 70086

Modified:
   pypy/branch/virtual-forcing/pypy/jit/metainterp/jitprof.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_jitprof.py
Log:
Also count the number of virtualizable escapes.


Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/jitprof.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/jitprof.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/jitprof.py	Sun Dec 13 18:06:15 2009
@@ -20,6 +20,7 @@
 OPT_FORCINGS
 ABORT_TOO_LONG
 ABORT_BRIDGE
+ABORT_ESCAPE
 NVIRTUALS
 NVHOLES
 NVREUSED
@@ -176,8 +177,9 @@
         self._print_intline("opt ops", cnt[OPT_OPS])
         self._print_intline("opt guards", cnt[OPT_GUARDS])
         self._print_intline("forcings", cnt[OPT_FORCINGS])
-        self._print_intline("trace too long", cnt[ABORT_TOO_LONG])
-        self._print_intline("bridge abort", cnt[ABORT_BRIDGE])
+        self._print_intline("abort: trace too long", cnt[ABORT_TOO_LONG])
+        self._print_intline("abort: compiling", cnt[ABORT_BRIDGE])
+        self._print_intline("abort: vable escape", cnt[ABORT_ESCAPE])
         self._print_intline("nvirtuals", cnt[NVIRTUALS])
         self._print_intline("nvholes", cnt[NVHOLES])
         self._print_intline("nvreused", cnt[NVREUSED])

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/pyjitpl.py	Sun Dec 13 18:06:15 2009
@@ -834,8 +834,7 @@
                 try:
                     self.metainterp.reached_can_enter_jit(self.env)
                 except GiveUp:
-                    self.metainterp.staticdata.profiler.count(ABORT_BRIDGE)
-                    self.metainterp.switch_to_blackhole()
+                    self.metainterp.switch_to_blackhole(ABORT_BRIDGE)
         if self.metainterp.is_blackholing():
             self.blackhole_reached_merge_point(self.env)
         return True
@@ -1281,8 +1280,7 @@
                 try:
                     self.compile_done_with_this_frame(resultbox)
                 except GiveUp:
-                    self.staticdata.profiler.count(ABORT_BRIDGE)
-                    self.switch_to_blackhole()
+                    self.switch_to_blackhole(ABORT_BRIDGE)
             sd = self.staticdata
             if sd.result_type == 'void':
                 assert resultbox is None
@@ -1319,8 +1317,7 @@
             try:
                 self.compile_exit_frame_with_exception(excvaluebox)
             except GiveUp:
-                self.staticdata.profiler.count(ABORT_BRIDGE)
-                self.switch_to_blackhole()
+                self.switch_to_blackhole(ABORT_BRIDGE)
         raise self.staticdata.ExitFrameWithExceptionRef(self.cpu, excvaluebox.getref_base())
 
     def check_recursion_invariant(self):
@@ -1438,7 +1435,8 @@
             op.pc = self.framestack[-1].pc
             op.name = self.framestack[-1].jitcode.name
 
-    def switch_to_blackhole(self):
+    def switch_to_blackhole(self, reason):
+        self.staticdata.profiler.count(reason)
         debug_print('~~~ ABORTING TRACING')
         debug_stop('jit-tracing')
         debug_start('jit-blackhole')
@@ -1452,10 +1450,9 @@
         if not self.is_blackholing():
             warmrunnerstate = self.staticdata.state
             if len(self.history.operations) > warmrunnerstate.trace_limit:
-                self.staticdata.profiler.count(ABORT_TOO_LONG)
                 self.greenkey_of_huge_function = self.find_biggest_function()
                 self.portal_trace_positions = None
-                self.switch_to_blackhole()
+                self.switch_to_blackhole(ABORT_TOO_LONG)
 
     def _interpret(self):
         # Execute the frames forward until we raise a DoneWithThisFrame,
@@ -1822,7 +1819,7 @@
                     escapes = True
             #
             if escapes:
-                self.switch_to_blackhole()
+                self.switch_to_blackhole(ABORT_ESCAPE)
         #
         if escapes:
             self.load_fields_from_virtualizable()

Modified: pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_jitprof.py
==============================================================================
--- pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_jitprof.py	(original)
+++ pypy/branch/virtual-forcing/pypy/jit/metainterp/test/test_jitprof.py	Sun Dec 13 18:06:15 2009
@@ -64,7 +64,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,
-                                     0, 0, 0]
+                                     0, 0, 0, 0]
 
     def test_simple_loop_with_call(self):
         @dont_look_inside



More information about the Pypy-commit mailing list