Making your JITted Code known: Let me count the ways

· coding · Source ↗

TLDR

  • Survey of techniques for registering JIT-compiled code with debuggers, profilers, and stack unwinders so it is visible to native tooling.

Key Takeaways

  • JIT-generated code is invisible by default to tools like perf, GDB, and exception unwinders unless explicitly registered.
  • Multiple registration paths exist, implying tradeoffs in portability, complexity, and which tooling benefits.
  • Stack unwinding through JIT frames is a distinct problem from symbol visibility, requiring separate handling.
  • The article title frames this as an enumeration, suggesting no single universal solution covers all cases.

Hacker News Comment Review

  • The one commenter confirmed the cross-platform asymmetry of unwinding through JIT frames: Windows MinGW with the LJSJ (longjmp/setjmp) backend silently skips JIT frames, while Linux crashes immediately on the first JIT-generated frame.
  • C++ exceptions propagating through JIT-generated frames remain a practical blocker for toy and production JITs alike, not just a theoretical edge case.

Notable Comments

  • @kgeist: Built a JIT in C++ for a toy language; Windows LJSJ backend skipped JIT frames safely, Linux crashed immediately – “abandoned the project” after failing to find a quick fix.

Original | Discuss on HN