Retrofitting JIT Compilers into C Interpreters
11–20 of 29 posts
Re: Retrofitting JIT Compilers into C Interpreters
#12Took me a while to figure out whether it's interpreters for C programs or if there's a particular class of interpreters called "C". Turns out it's about interpreters implemented in C that they use modified LLVM to do the retrofitting, but couldn't it be applicable for other languages with LLVM IR, or other switch-in-a-loop patterns in C?
I've been a low level C and C++ programmer for 30 years. Even with your explanation and having read the webpage twice I have no idea what this technology does or how it works. So it takes normal interpreted code and jits it somehow? But you have to modify the source code of your program in some way?
Metatracing ones are kind of an interesting twist on the original idea.
> So it takes normal interpreted code and jits it somehow?
Anyway, they use a patched LLVM to JIT-compile not just interpreted code but the main loop of the bytecode interpreter. Like, the C implementation itself.
> But you have to modify the source code of your program in some way?
Generally speaking, this is not normally the goal. All JIT-s try to support as much of the target language as possible. Some JIT-s do limit the subset of features supported.
Re: Retrofitting JIT Compilers into C Interpreters
#13Re: Retrofitting JIT Compilers into C Interpreters
#14TL;DR compile with a fork of LLVM that enables runtime IR tracing. Very clever!
Re: Retrofitting JIT Compilers into C Interpreters
#15Re: Retrofitting JIT Compilers into C Interpreters
#16i tend to think of myself as a computing nerd, but posts like this one make me realize that i don't even rate on the computing nerd scale.
Do you always make things about yourself? Have you written a parser or interpreter? You should, it’s an interesting exercise. The idea is to add meta tracing to the interpreter (the c code) that allows hot paths to be compiled to machine code and be then executed instead of being interpreted.
That's an abrasive question but i dare say that we all do. It's our only constant point of reference.
> Have you written a parser or interpreter?
i have written many parsers, several parser generators, and a handful of programming languages. This article, however, covers a whole other level, way over my head (or well beyond any of my ambitions, in any case).
Pics or it didn't happen: fossil.wanderinghorse.net/r/cwal
Re: Retrofitting JIT Compilers into C Interpreters
#17Why do they need to change LLVM? Why can't they make this another LLVM IR pass?
Re: Retrofitting JIT Compilers into C Interpreters
#18Took me a while to figure out whether it's interpreters for C programs or if there's a particular class of interpreters called "C". Turns out it's about interpreters implemented in C that they use modified LLVM to do the retrofitting, but couldn't it be applicable for other languages with LLVM IR, or other switch-in-a-loop patterns in C?
Re: Retrofitting JIT Compilers into C Interpreters
#19Re: Retrofitting JIT Compilers into C Interpreters
#20Took me a while to figure out whether it's interpreters for C programs or if there's a particular class of interpreters called "C". Turns out it's about interpreters implemented in C that they use modified LLVM to do the retrofitting, but couldn't it be applicable for other languages with LLVM IR, or other switch-in-a-loop patterns in C?