[pypy-commit] pypy jit-applevel-hook: IN-PROGRESS. Start writing applevel hooks

fijal noreply at buildbot.pypy.org
Tue May 24 15:31:34 CEST 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: jit-applevel-hook
Changeset: r44404:157808aa9dd2
Date: 2011-05-24 15:42 +0200
http://bitbucket.org/pypy/pypy/changeset/157808aa9dd2/

Log:	IN-PROGRESS. Start writing applevel hooks

diff --git a/pypy/module/pypyjit/__init__.py b/pypy/module/pypyjit/__init__.py
--- a/pypy/module/pypyjit/__init__.py
+++ b/pypy/module/pypyjit/__init__.py
@@ -12,9 +12,10 @@
 
     def setup_after_space_initialization(self):
         # force the __extend__ hacks to occur early
-        import pypy.module.pypyjit.interp_jit
+        from pypy.module.pypyjit.interp_jit import pypyjitdriver
         # add the 'defaults' attribute
         from pypy.rlib.jit import PARAMETERS
         space = self.space
+        pypyjitdriver.space = space
         w_obj = space.wrap(PARAMETERS)
         space.setattr(space.wrap(self), space.wrap('defaults'), w_obj)
diff --git a/pypy/module/pypyjit/interp_jit.py b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -49,6 +49,12 @@
     greens = ['next_instr', 'is_being_profiled', 'pycode']
     virtualizables = ['frame']
 
+    def on_compile(self, looptoken, operations, type, *greenargs):
+        pass
+
+    def on_compile_bridge(self, orig_looptoken, operations, n):
+        pass
+
 pypyjitdriver = PyPyJitDriver(get_printable_location = get_printable_location,
                               get_jitcell_at = get_jitcell_at,
                               set_jitcell_at = set_jitcell_at,
@@ -150,5 +156,10 @@
     the JIT follow the call.'''
     return space.call_args(w_callable, __args__)
 
+class Cache(object):
+    w_compile_hook = None
+
 def set_compile_hook(space, w_hook):
-    pass
+    cache = space.fromcache(Cache)
+    cache.w_hook = w_compile_hook
+    return space.w_None


More information about the pypy-commit mailing list