Shaw: Python 3.13 gets a JIT
Shaw: Python 3.13 gets a JIT
Posted Jan 11, 2024 13:53 UTC (Thu) by anton (subscriber, #25547)In reply to: Shaw: Python 3.13 gets a JIT by gabrielesvelto
Parent article: Shaw: Python 3.13 gets a JIT
Inline threading is copying without patching. There is still a VM instruction pointer around, and it is used for getting at the immediate arguments that are patched in with copy-and-patch, including, for control flow, the VM-level branch targets; so inline threading performs control flow by loading the new VM instruction pointer, then looking up the machine code there, and jumping to it.
In Retargeting JIT compilers by using C-compiler generated executable code (as ) we used a copy-and-patch approach to get rid of the VM instruction pointer. We derived the patch information by comparing two variants of each code fragment with different immediate arguments (and some architecture-specific knowledge about possible encodings). I'll have to read Copy-and-Patch Compilation to find what they did differently.
Earlier work in that vein was Automatic, template-based run-time specialization, but that's in the context of a specializer rather than a language implementation, and they used a different way to get the patch information.