News for hackers. Stuff that matters.
Re:Python 3.13 Gets a JIT by checker659 on Tuesday January 09, 2024 @06:31AM (#38924894)
M. Anton Ertl and David Gregg. 2004. Retargeting JIT Compilers by using C-Compiler Generated Executable Code. In Proceedings of the 13th International Conference on Parallel Architectures and Compilation Techniques (PACT '04). IEEE Computer Society, USA, 41–50.

https://dl.acm.org/doi/10.5555/1025127.1025995

Re:Python 3.13 Gets a JIT by lifthrasiir on Tuesday January 09, 2024 @06:50AM (#38925032)
While bears a significant resemblance, Ertl and Gregg's approach is not automatic and every additional architecture requires a significant understanding of the target architecture---including an ability to ensure that fully relocable code can be generated and extracted. In comparison, the copy-and-patch approach can be thought as a simple dynamic linker, and objects generated by unmodified C compilers are far more predictable and need much less architecture-specific information for linking.
Re:Python 3.13 Gets a JIT by vanderZwan on Tuesday January 09, 2024 @06:55AM (#38925069)
Does Ertl and Gregg's approach have any "upsides" over copy-and-patch? Or is it a case of just missing those one or two insights that make the whole thing a lot simpler to implement?
Re:Python 3.13 Gets a JIT by lifthrasiir on Tuesday January 09, 2024 @07:01AM (#38925129)
I think so, but I can't say this any more confident until I get an actual copy of their paper (I used other review papers to get the main idea instead).
Re:Python 3.13 Gets a JIT by pierrebai on Tuesday January 09, 2024 @01:45PM (#38930140)
The copy-and-patch also assumes the compiler will generate patchable code. For example, on some architecture, have a zero operand might have a smaller or different opcode compared to a more general operand. Same issue for relative jumps or offset ranges. It seems the main difference is that the patch approach also patches jumps to absolute addresses instead of requiring instruction-counter relative code.
Re:Python 3.13 Gets a JIT by naasking on Tuesday January 09, 2024 @01:57PM (#38930309)
Full copy of the paper: https://www2.cs.arizona.edu/~collberg/Teaching/553/2011/Reso...

There's also this which seems to use the same technique:

Templates-based portable just-in-time compiler, https://dl.acm.org/doi/abs/10.1145/944579.944588

Nice to see there's still room for innovation in the VM space!

Re:Python 3.13 Gets a JIT by vanderZwan on Tuesday January 09, 2024 @06:45AM (#38924994)
Anton Ertl! <3

Context: I've been on a concatenative language binge recently, and his work on Forth is awesome. In my defense he doesn't seem to list this paper among his publications[0]. Will give this paper a read, thanks for linking it! :)

If they missed the boat on getting credit for their contributions then at least the approach finally starts to catch on I guess?

(I wonder if he got the idea from his work on optimizing Forth somehow?)

[0] https://informatics.tuwien.ac.at/people/anton-ertl