Carter Cheng
2008-Jul-31 19:41 UTC
[LLVMdev] LLVM JIT: How to install a callback for a function loaded in at runtime
Hello, This is probably a bit of a beginner's question but I am new to LLVM I have been examining the possibility of constructing something similar to the JnJVM for a language which supports dynamic class loading. The problem I am having is determining how the JIT system allows for dynamic loading of functions into the JIT. The paper indicates the JnJVM use some sort of callback when the JIT hits a call it cannot yet resolve. How do I install such a handler? Thanks in advance, Carter.
Evan Cheng
2008-Aug-01 00:30 UTC
[LLVMdev] LLVM JIT: How to install a callback for a function loaded in at runtime
lib/System/DynamicLibrary.cpp is a good place to look. Evan On Jul 31, 2008, at 12:41 PM, Carter Cheng wrote:> Hello, > > This is probably a bit of a beginner's question but I am new to LLVM > I have been examining the possibility of constructing something > similar to the JnJVM for a language which supports dynamic class > loading. The problem I am having is determining how the JIT system > allows for dynamic loading of functions into the JIT. The paper > indicates the JnJVM use some sort of callback when the JIT hits a > call it cannot yet resolve. How do I install such a handler? > > Thanks in advance, > > Carter. > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Nicolas Geoffray
2008-Aug-01 00:42 UTC
[LLVMdev] LLVM JIT: How to install a callback for a function loaded in at runtime
Hi Carter, Carter Cheng wrote:> Hello, > > This is probably a bit of a beginner's question but I am new to LLVM > I have been examining the possibility of constructing something similar to the JnJVM for a language which supports dynamic class loading. The problem I am having is determining how the JIT system allows for dynamic loading of functions into the JIT. The paper indicates the JnJVM use some sort of callback when the JIT hits a call it cannot yet resolve. How do I install such a handler? > >You need to implement your own ModuleProvider and specialize the materialzeFunction function to do the dynamic loading. In vmkit, you can take a look at lib/JnJVM/VMCore/JnjvmModuleProvider.cpp file. Nicolas> Thanks in advance, > > Carter. > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Carter Cheng
2008-Aug-01 12:34 UTC
[LLVMdev] LLVM JIT: How to install a callback for a function loaded in at runtime
Thanks. I didnt realize that this particular function was a virtual inherited from the Module Provider interface. Out of curiousity what applications does the materializeModule function have and when does it get invoked? Regards, Carter. --- On Thu, 7/31/08, Nicolas Geoffray <nicolas.geoffray at lip6.fr> wrote:> From: Nicolas Geoffray <nicolas.geoffray at lip6.fr> > Subject: Re: [LLVMdev] LLVM JIT: How to install a callback for a function loaded in at runtime > To: carter_cheng at yahoo.com, "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Date: Thursday, July 31, 2008, 5:42 PM > Hi Carter, > > Carter Cheng wrote: > > Hello, > > > > This is probably a bit of a beginner's question > but I am new to LLVM > > I have been examining the possibility of constructing > something similar to the JnJVM for a language which supports > dynamic class loading. The problem I am having is > determining how the JIT system allows for dynamic loading of > functions into the JIT. The paper indicates the JnJVM use > some sort of callback when the JIT hits a call it cannot yet > resolve. How do I install such a handler? > > > > > > You need to implement your own ModuleProvider and > specialize the > materialzeFunction function to do the dynamic loading. In > vmkit, you > can take a look at lib/JnJVM/VMCore/JnjvmModuleProvider.cpp > file. > > Nicolas > > > Thanks in advance, > > > > Carter. > > > > > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >