UNREACHABLE executed at MCJIT.cpp:322!

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

UNREACHABLE executed at MCJIT.cpp:322!

edA-qa mort-ora-y
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
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: UNREACHABLE executed at MCJIT.cpp:322!

Yaron Keren
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 <[hidden email]>
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
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


_______________________________________________
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: UNREACHABLE executed at MCJIT.cpp:322!

edA-qa mort-ora-y
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 <[hidden email] <mailto:[hidden email]>>
>
>     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
>     [hidden email] <mailto:[hidden email]>        
>     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.
_______________________________________________
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: UNREACHABLE executed at MCJIT.cpp:322!

Yaron Keren
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 <[hidden email]>
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 <[hidden email] <mailto:[hidden email]>>
>
>     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
>     [hidden email] <mailto:[hidden email]>
>     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.


_______________________________________________
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: UNREACHABLE executed at MCJIT.cpp:322!

edA-qa mort-ora-y
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 <[hidden email] <mailto:[hidden email]>>
>
>     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 <[hidden email]
>     <mailto:[hidden email]> <mailto:[hidden email]
>     <mailto:[hidden email]>>>
>     >
>     >     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
>     >     [hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>
>     >     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.
_______________________________________________
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: UNREACHABLE executed at MCJIT.cpp:322!

Yaron Keren
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 <[hidden email]>
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 <[hidden email] <mailto:[hidden email]>>
>
>     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 <[hidden email]
>     <mailto:[hidden email]> <mailto:[hidden email]
>     <mailto:[hidden email]>>>
>     >
>     >     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
>     >     [hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>
>     >     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.


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