[LLVMdev] Introduction and questions

Gordon Henriksen gordonhenriksen at mac.com
Wed Apr 2 04:04:50 PDT 2008


On 2008-04-02, at 05:55, Gary Benson wrote:

> I've been working on making a non-architecture specific port of  
> OpenJDK these past few months.  It's interpreter-only at present,  
> and very slow, and I'd like to use LLVM to add some kind of JIT to it.
>
> So far I'm just trying to figure out how it would all slot in. The  
> existing code in OpenJDK is written to accomodate different JITs, so  
> integrating peripheral stuff like garbage collection seems pretty  
> simple, but method dispatch seems like it will be tricky.  The  
> examples I've seen require an ExecutionEngine to execute code.  Is  
> it possible to bypass this and get a function pointer?  So you could  
> use it like this:
>
>  typedef void (*function_t)(methodOop method, JavaThread *thread);
>  function_t func = [some LLVM call here];
>  func(method, thread);
>
> That would solve pretty much all my problems :)


The getPointerToFunctionOrStub method that does what you want in the  
JIT.

http://llvm.org/docs/doxygen/html/classllvm_1_1JIT.html#a6

— Gordon





More information about the llvm-dev mailing list