Carter Cheng
2009-Jun-29 10:37 UTC
[LLVMdev] JIT question about resolving unknown function calls
My understanding is that the JIT system allows during the running of the system resolution of call instructions to undefined functions to be trapped and then patched with the correct address (is this true?). The question I have is does the current system also allow for repatching? for a certain OO system I am working on this could be desirable when an object/class is updated and replaced- making it possible in certain cases to update the call point as the code is replaced. Thanks in advance.
Chris Lattner
2009-Jun-29 17:18 UTC
[LLVMdev] JIT question about resolving unknown function calls
On Jun 29, 2009, at 3:37 AM, Carter Cheng wrote:> > My understanding is that the JIT system allows during the running of > the system resolution of call instructions to undefined functions to > be trapped and then patched with the correct address (is this true?).Yes, see: http://llvm.org/docs/tutorial/LangImpl4.html#jit> The question I have is does the current system also allow for > repatching? for a certain OO system I am working on this could be > desirable when an object/class is updated and replaced- making it > possible in certain cases to update the call point as the code is > replaced.You can repatch a function that was hitted with the ExecutionEngine::recompileAndRelinkFunction method. If you have a symbol that isn't JIT'd that you want to move around, just define a global that holds the pointer, and change the pointer as you wish. -Chris
Carter Cheng
2009-Jun-30 06:04 UTC
[LLVMdev] JIT question about resolving unknown function calls
Thanks. --- On Mon, 6/29/09, Chris Lattner <clattner at apple.com> wrote:> From: Chris Lattner <clattner at apple.com> > Subject: Re: [LLVMdev] JIT question about resolving unknown function calls > To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu> > Date: Monday, June 29, 2009, 10:18 AM > > On Jun 29, 2009, at 3:37 AM, Carter Cheng wrote: > > > > > My understanding is that the JIT system allows during > the running of > > the system resolution of call instructions to > undefined functions to > > be trapped and then patched with the correct address > (is this true?). > > Yes, see: > http://llvm.org/docs/tutorial/LangImpl4.html#jit > > > The question I have is does the current system also > allow for > > repatching? for a certain OO system I am working on > this could be > > desirable when an object/class is updated and > replaced- making it > > possible in certain cases to update the call point as > the code is > > replaced. > > You can repatch a function that was hitted with the > ExecutionEngine::recompileAndRelinkFunction method. > If you have a > symbol that isn't JIT'd that you want to move around, just > define a > global that holds the pointer, and change the pointer as > you wish. > > -Chris > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu > http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >