[LLVMdev] Re: questions about LLVM
John T. Criswell
criswell at uiuc.edu
Wed Nov 17 17:19:10 PST 2004
Shuo Chen wrote:
>John,
>
>Thank you very much.
>
>
>>Dinakar is correct; the SAFECode website is a version of Apache compiled
>>with LLVM and running on the LLVM x86 JIT.
>>
>>
>This is exciting. Do you mean that the Apache server is compiled to the VM
>code format, which gets executed one instruction by another by the
>interpretor? x86 JIT basically compiles the VM code to native x86 code,
>right?
>
>
Apache is compiled into LLVM bytecode and then run with the lli command.
Some of the below description may be off, so I welcome corrections:
On x86 and SparcV9, lli is a JIT, so Apache is compiled one function at
a time as needed. That is to say, when the JIT discovers that it needs
to call a function that has not been translated yet, it loads the
function from the bytecode file (which is mmapp'ed into memory) and
compiles it. All further executions of the funtion use the native code
previously generated by the JIT.
So, the JIT is similar to static compilation of the code, but it only
compiles parts that are needed by a particular execution, and it only
compiles them when they are needed by the program.
I believe you could run Apache using the interpreter by using the
appropriate options to the lli command to disable the JIT, although I
haven't tried it. Internally, we seldomly use the interpreter, since
JIT usually executes faster and is mostly transparent to the user (i.e.
the JIT looks just like an interpreter, but runs faster).
-- John T.
>thanks
>Shuo
>
>
>
More information about the llvm-dev
mailing list