[LLVMdev] Jump back to/return from runFunction
Rick Mann
rmann at latencyzero.com
Tue Jan 29 22:17:04 PST 2013
On Jan 29, 2013, at 21:41 , edA-qa mort-ora-y <eda-qa at disemia.com> wrote:
> How can I properly exit from code being executed via
> "ExecutionEngine::runFunction"? My JIT'd code is executing and it calls
> a function in the host program. This host function then decides the
> executing code should be stopped and wants to return from runFunction.
If the executing code wants to return, it should just return. I take it that doesn't work for you? You probably need to modify things so that your JITed code can tolerate the host code returning, or it can return some kind of error condition.
I'm not sure what's required to allow an exception to be thrown through the JITed code. I'd consider doing that if I could.
My own code has a similar need. I got around it by making my code very asynchronous. That is, I call runFunction, my JITed code executes, and eventually calls a method in my host with a callback. That method returns immediately, and so does runFunction. Eventually, my host code calls the callback it was given to continue processing.
However, I haven't fully tested this, in that currently my host function is stubbed out to just immediately call the callback, so I don't know if this can actually work. I better test it…
--
Rick
More information about the llvm-dev
mailing list