[pypy-commit] pypy better-jit-hooks: work out the API

fijal noreply at buildbot.pypy.org
Tue Jan 3 13:43:32 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: better-jit-hooks
Changeset: r50993:a8dc9a3fd739
Date: 2012-01-03 14:42 +0200
http://bitbucket.org/pypy/pypy/changeset/a8dc9a3fd739/

Log:	work out the API

diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py
--- a/pypy/rlib/jit.py
+++ b/pypy/rlib/jit.py
@@ -449,23 +449,6 @@
         # special-cased by ExtRegistryEntry
         pass
 
-    def on_compile(self, logger, looptoken, operations, type, *greenargs):
-        """ A hook called when loop is compiled. Overwrite
-        for your own jitdriver if you want to do something special, like
-        call applevel code
-        """
-
-    def on_compile_bridge(self, logger, orig_looptoken, operations, n):
-        """ A hook called when a bridge is compiled. Overwrite
-        for your own jitdriver if you want to do something special
-        """
-
-    # note: if you overwrite this functions with the above signature it'll
-    #       work, but the *greenargs is different for each jitdriver, so we
-    #       can't share the same methods
-    del on_compile
-    del on_compile_bridge
-
     def _make_extregistryentries(self):
         # workaround: we cannot declare ExtRegistryEntries for functions
         # used as methods of a frozen object, but we can attach the
@@ -753,6 +736,32 @@
     An instance of this class might be returned by the policy.get_jit_portal
     method in order to function.
     """
+    def on_abort(self, reason, jitdriver, greenkey):
+        """ A hook called each time a loop is aborted with jitdriver and
+        greenkey where it started, reason is a string why it got aborted
+        """
+
+    def on_compile(self, jitdriver, logger, looptoken, operations, greenkey,
+                   asmaddr, asmlen):
+        """ A hook called when loop is compiled. Overwrite
+        for your own jitdriver if you want to do something special, like
+        call applevel code.
+
+        jitdriver - an instance of jitdriver where tracing started
+        logger - an instance of jit.metainterp.logger.LogOperations
+        asmaddr - (int) raw address of assembler block
+        asmlen - assembler block length
+        """
+
+    def on_compile_bridge(self, jitdriver, logger, orig_looptoken, operations,
+                          fail_descr_no, asmaddr, asmlen):
+        """ A hook called when a bridge is compiled. Overwrite
+        for your own jitdriver if you want to do something special
+        """
+
+    def get_stats(self):
+        """ Returns various statistics
+        """
 
 class Entry(ExtRegistryEntry):
     _about_ = record_known_class


More information about the pypy-commit mailing list