Maciej Fijalkowski avatar Maciej Fijalkowski committed bccaa2c

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

Comments (0)

Files changed (2)

pypy/rpython/lltypesystem/rffi.py

 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_()
 

pypy/translator/goal/targetpypystandalone.py

     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: 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.