[LLVMdev] Dynamic (JIT) type resolution

Chris Lattner sabre at nondot.org
Mon Nov 5 21:05:29 PST 2007


On Nov 5, 2007, at 8:27 PM, Nicolas Geoffray wrote:
> I would like to implement an equivalent mechanism of function  
> callbacks
> in the JIT, but for fields. Typically in Java, when you compile a
> method, there may be some instructions (getfield, putfield) that  
> depend
> on a type which is not yet resolved.
>
> I think the best way to do this in LLVM is to add an intrinsic. The
> intrinsic would be only valid if we jit, and would be lowered only in
> the codegen part (don't know yet if it would be in the target  
> dependent
> or target independent part).

>
> Now there is one issue to deal with here: how to represent the
> intrinsic? It can either be 1) llvm.getfieldptr.{type} or 2) have two
> kinds of intrinsics llvm.getfield.{type} and llvm.storefield.{type}.

I don't think this is really the right way to go.  Can you give an  
example snippet of Java code that would need this and what you are  
proposing?  With a concrete example that shows how the lazy class  
loading stuff works we can talk about different possibilities,

-Chris



More information about the llvm-dev mailing list