[pypy-svn] r70957 - in pypy/branch/oprofile-support/pypy/jit: backend metainterp

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Jan 28 18:10:21 CET 2010


Author: cfbolz
Date: Thu Jan 28 18:10:21 2010
New Revision: 70957

Modified:
   pypy/branch/oprofile-support/pypy/jit/backend/model.py
   pypy/branch/oprofile-support/pypy/jit/metainterp/warmspot.py
Log:
Add a finish_once methods on the CPU that will be called when the program
shuts down.


Modified: pypy/branch/oprofile-support/pypy/jit/backend/model.py
==============================================================================
--- pypy/branch/oprofile-support/pypy/jit/backend/model.py	(original)
+++ pypy/branch/oprofile-support/pypy/jit/backend/model.py	Thu Jan 28 18:10:21 2010
@@ -31,6 +31,11 @@
         """Called once by the front-end when the program starts."""
         pass
 
+    def finish_once(self):
+        """Called once by the front-end when the program stops."""
+        pass
+
+
     def compile_loop(self, inputargs, operations, looptoken):
         """Assemble the given loop.
         Extra attributes should be put in the LoopToken to

Modified: pypy/branch/oprofile-support/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/oprofile-support/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/oprofile-support/pypy/jit/metainterp/warmspot.py	Thu Jan 28 18:10:21 2010
@@ -182,7 +182,7 @@
         self.rewrite_can_enter_jit()
         self.rewrite_set_param()
         self.rewrite_force_virtual()
-        self.add_profiler_finish()
+        self.add_finish()
         self.metainterp_sd.finish_setup(optimizer=optimizer)
 
     def finish(self):
@@ -633,13 +633,14 @@
         origblock.recloseblock(Link([v_result], origportalgraph.returnblock))
         checkgraph(origportalgraph)
 
-    def add_profiler_finish(self):
-        def finish_profiler():
+    def add_finish(self):
+        def finish():
             if self.metainterp_sd.profiler.initialized:
                 self.metainterp_sd.profiler.finish()
+            self.metainterp_sd.cpu.finish_once()
         
         if self.cpu.translate_support_code:
-            call_final_function(self.translator, finish_profiler,
+            call_final_function(self.translator, finish,
                                 annhelper = self.annhelper)
 
     def rewrite_set_param(self):



More information about the Pypy-commit mailing list