Introduction and questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Introduction and questions

Gary Benson
Hi all,

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 :)

Cheers,
Gary

--
http://gbenson.net/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Introduction and questions

Gordon Henriksen-3
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


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Introduction and questions

Gary Benson
Gordon Henriksen wrote:

> 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

Perfect, thank you!

Cheers,
Gary

--
http://gbenson.net/
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev