• Marius Wachtler's avatar
    add frame intospection for exited frames · f770d00e
    Marius Wachtler authored
    this works by copying the last locals state into the BoxedFrame when we exit a function.
    As a perf improvement we only create BoxedFrames if _getframe got called or an exception got thrown.
    
    It turned out that our python frame retrieving / updating code was really slow (using libunwind) I replaced it now with
    a approach which manually keeps track of the python frames (calling initFrame/deinitFrame every time a functions gets called / exits).
    Sadly we can't inline this functions in the llvm tier currently because it uses thread local storage which the JIT does not support.
    But I have a prototype which works around the issue with inline asm.
    We also store now always the current stmt inside the FrameInfo and in addition the FunctionMetadata.
    This made it possible to switch away from libunwind frame introspection for most cases (except deopt and c++ unwinding where we need to access all register)
    
    I think we can further improve the patch in several ways:
     - only copying the vregs array instead of generating the dict which takes more time (because of space overhead and hashing?).
     - refcounting should remove uneccesarry locals updating when no one keeps track of the BoxedFrame anymore.
     - switch to cpythons traceback implementation
    f770d00e
unwinding.h 4.2 KB