3 ms·
I'm not sure what that would even mean. JIT is an optimization for virtual machines. It compiles VM code (such as Java bytecode) or interpreted code to machine
by scott_s 17y ago
I'm not sure what that would even mean. JIT is an optimization for virtual machines. It compiles VM code (such as Java bytecode) or interpreted code to machine code at runtime. C already compiles to machine code.
In order to do anything resembling JIT, you would have to insert a runtime where one does not already exist.
- jrockway 17y agoLLVM's compiler suite compiles C to LLVM bitcode, and the LLVM (low-level virtual machine) runs that code.
- foldr 17y agoI don't think LLVM provides any such virtual machine, despite its name. It has a code generator, but no VM as such.
- maximilian 17y agoI'm almost positive that LLVM provides both. You always target LLVM bytecode with your frontend, but then you can choose either to: - run the bytecode using the LLVM with or without JIT. - compile the LLVM bytecode into x86 bytecode. This is what clang does (afaik) and is a reasonably nice use case because you write a static language that targets LLVM bytecode and end with a fast program because LLVM will output optimized x86 binaries. However, I'm pretty sure that the efforts like unladen swallow attempt to use the LLVM's virtual machine in the hope that it will become very fast as they optimize it (especially the JIT part).
- nostrademons 17y agoYeah, you just instantiate an ExecutionEngine and feed it your LLVM bytecode, and it'll give you back C function pointers that you can call. The ExecutionEngine is either a JIT (which'll compile your bytecode into native code and give you that back) or it's an interpreter (where the function pointer you get back is an entry point into the interpreter).
- foldr 17y agoOk, my mistake, sorry.