Commits

Maciej Fijalkowski  committed bccaa2c

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

  • Participants
  • Parent commits 510f2a5
  • Branches callback-jit

Comments (0)

Files changed (2)

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

File 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: