[LLVMdev] Dynamic (JIT) type resolution

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Nov 6 11:05:24 PST 2007

Chris Lattner wrote:
> I'm missing something here.  If you lazily compile getDoubleFromOne the 
> first time it is called, it seems like you are guaranteed to have layout 
> information, as an instance of "One" is required to be passed in for this 
> to run.

Right, you got me ;) Thanks for giving a better example.

> 1. interpret the first time through the code, then jit compile after the 
> class is loaded, or:

Not the best way to do: what if you have many field operations on many
classes in one method? You'll interpret the function as long as all
field operations are not resolved?

> 2. jit compile code that is slower than need be (using function calls to 
> cause the lazy stuff to happen) and then replace it when the class is 
> loaded.

You mean replace the code at the IR level right? and then recompile the
function. You then have the same issue than 1).

By the way, this is a classic optimization in Java that all VMs with JIT
do (sorry, I don't have links here).


> -Chris

More information about the llvm-dev mailing list