[LLVMdev] UNREACHABLE executed at MCJIT.cpp:322!
Yaron Keren
yaron.keren at gmail.com
Fri Nov 8 11:06:44 PST 2013
Since you know the argument types you can hardcode your own runFunction
with the specific types.
You don't have to go through GenericValues at all, just get the pointer to
function and call it with the correct input types.
For example, the code to run int F(int) is:
void *FPtr = getPointerToFunction(F);
assert(FPtr && "Pointer to fn's code was null after
getPointerToFunction");
int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
OutputInt = PF(InputInt);
return OutputInt;
Yaron
2013/11/8 edA-qa mort-ora-y <eda-qa at disemia.com>
> It was the return type which was i64. I changed it also to my
> abi_int_size and it works now. I have to take care of a few other type
> translations, but it looks like MCJIT is working now.
>
> Thank you.
>
>
> On 08/11/13 18:12, Yaron Keren wrote:
> > Something must be wrong with the Function Type. Try to debug into
> > runFunction to see which if condition fails.
> > Just a guess, if this is on 64 bit system the first argument type may be
> > int64 but needs to be int32.
> >
> > Yaron
> >
> >
> >
> > 2013/11/8 edA-qa mort-ora-y <eda-qa at disemia.com <mailto:
> eda-qa at disemia.com>>
> >
> > That makes it more mysterious then since I am indeed only calling a
> main
> > function. Perhaps I have to invoke it a different way. Here's my
> call I
> > have now:
> >
> > auto main = linker->getModule()->getFunction( "main" );
> >
> > std::vector<llvm::GenericValue> args(2);
> > args[0].IntVal = llvm::APInt( platform::abi_int_size, 0 );
> > args[1].PointerVal = nullptr;
> > llvm::GenericValue gv = ee->runFunction( main, args );
> >
> >
> >
> > On 08/11/13 11:14, Yaron Keren wrote:
> > > MCJIT::runFunction supports only main-style argument passing but
> not
> > > other cases like the JIT.
> > > These types of arguments will work:
> > >
> > > (int, char**, char**)
> > > (int, char**)
> > > (int)
> > > (void)
> > >
> > > The general case is not supported since it requires creating a
> small
> > > stub function, compiling and running it on the fly, supported by
> > JIT but
> > > not MCJIT.
> > >
> > > However, with the supported calling sequences, you can probably
> > replace
> > > the char** with a void* to a structure so that practically
> > anything can
> > > be passed to your function inside the structure.
> > >
> > > Yaron
> > >
> > >
> > >
> > > 2013/11/8 edA-qa mort-ora-y <eda-qa at disemia.com
> > <mailto:eda-qa at disemia.com> <mailto:eda-qa at disemia.com
> > <mailto:eda-qa at disemia.com>>>
> > >
> > > I'm trying to get MCJIT working but I get the following errors:
> > > Full-featured argument passing not supported yet!
> > > UNREACHABLE executed at MCJIT.cpp:322!
> > > I'm sure the first one will be a problem, but the second one
> > prevents me
> > > from testing anything. I don't know how to fix the problem.
> > >
> > > My code works when using the non-MC JIT, and I added to my
> > > EngineBuilder:
> > > .setUseMCJIT(true)
> > >
> > > Reading from a tutorial* I also tried finalizing the engine
> > object:
> > > ee->finalizeObject()
> > >
> > > I'd like to get this working since in the release notes for
> 3.4 it
> > > indicates exception handling has been removed from the old
> > JIT. I need
> > > exception handling support and would like to get MCJIT working
> > prior to
> > > upgrading to 3.4 later.
> > >
> > >
> > >
> > *
> http://blog.llvm.org/2013/07/using-mcjit-with-kaleidoscope-tutorial.html
> > >
> > > --
> > > edA-qa mort-ora-y
> > > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > -- -- --
> > > Sign: Please digitally sign your emails.
> > > Encrypt: I'm also happy to receive encrypted mail.
> > > _______________________________________________
> > > LLVM Developers mailing list
> > > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>
> > <mailto:LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>>
> > > http://llvm.cs.uiuc.edu
> > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> > >
> > >
> >
> >
> > --
> > edA-qa mort-ora-y
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> --
> > Sign: Please digitally sign your emails.
> > Encrypt: I'm also happy to receive encrypted mail.
> >
> >
>
>
> --
> edA-qa mort-ora-y
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Sign: Please digitally sign your emails.
> Encrypt: I'm also happy to receive encrypted mail.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131108/e0bc3156/attachment.html>
More information about the llvm-dev
mailing list