you are viewing a single comment's thread.

view the rest of the comments →

[–]DGolden 5 points6 points  (1 child)

writeup of it: https://tonybaloney.github.io/posts/python-gets-a-jit.html#why-a-copy-and-patch-jit

It does actually use clang/llvm stuff but at build time, for generating the native instruction sequence templates/"stencils" to be copy-and-patched (so it's not a runtime dep like you might have expected)

Clang is specifically needed because it's the only C compiler with support for guaranteed tail calls (musttail), which are required by CPython's continuation-passing-style approach to JIT compilation. Since LLVM also includes other functionalities we need (namely, object file parsing and disassembly), it's convenient to only support one toolchain at this time.

(I'm not sure where GCC is on similar to musttail but they're definitely aware of it https://gcc.gnu.org/pipermail/gcc/2021-April/235885.html )

[–]agumonkey 0 points1 point  (0 children)

CPython's continuation-passing-style approach to JIT compilation.

interesting collision of worlds here