[pypy-commit] pypy callback-jit: move callback one level up, so the if gets constant folded and hopefully graphs are not mingled

fijal noreply at buildbot.pypy.org
Fri Dec 28 10:17:19 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: callback-jit
Changeset: r59600:bccaa2c1d52a
Date: 2012-12-28 11:16 +0200
http://bitbucket.org/pypy/pypy/changeset/bccaa2c1d52a/

Log:	move callback one level up, so the if gets constant folded and
	hopefully graphs are not mingled

diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -330,10 +330,11 @@
 CallbackHookPtr = lltype.Ptr(lltype.FuncType([lltype.Ptr(rstr.STR)], lltype.Void))
 
 class AroundState:
+    callback_hook = None
+    
     def _cleanup_(self):
         self.before = None        # or a regular RPython function
         self.after = None         # or a regular RPython function
-        self.callback_hook = None # or a regular RPython function
 aroundstate = AroundState()
 aroundstate._cleanup_()
 
diff --git a/pypy/translator/goal/targetpypystandalone.py b/pypy/translator/goal/targetpypystandalone.py
--- a/pypy/translator/goal/targetpypystandalone.py
+++ b/pypy/translator/goal/targetpypystandalone.py
@@ -28,13 +28,15 @@
     w_call_startup_gateway = space.wrap(gateway.interp2app(call_startup))
     withjit = space.config.objspace.usemodules.pypyjit
 
+    if withjit:
+        from pypy.module.pypyjit.interp_jit import callback_hook
+        from pypy.rlib import objectmodel
+        objectmodel.register_around_callback_hook(callback_hook)
+
     def entry_point(argv):
         if withjit:
             from pypy.jit.backend.hlinfo import highleveljitinfo
-            from pypy.module.pypyjit.interp_jit import callback_hook
-            from pypy.rlib import objectmodel
             highleveljitinfo.sys_executable = argv[0]
-            objectmodel.register_around_callback_hook(callback_hook)
 
         #debug("entry point starting") 
         #for arg in argv: 


More information about the pypy-commit mailing list