Valery A.Khamenya
2004-Aug-14 13:07 UTC
[LLVMdev] is this code really JITed and/or optimized? ..
> > ExecutionEngine* EE = ExecutionEngine::create( MP, true ); > > As Reid pointed out, changing true to false will get it to work.as I've posted already, I got Segmentation Fault. Now, i have re-compiled LLVM with debug support. The evaluation is broken at line 78 in file: lib/ExecutionEngine/JIT/JIT.cpp The assertion assert(ArgValues.size() == 1); fails. But what's wrong? My function has type int FooF(void); so ArgValues should have size 0, right? BTW, the code of runFunction is quite unclear, indeed, for some reason cases ArgValues==3 and ArgValues==1 are specially considered... I looked in JIT.h for more description on interface -- quite ascetic info, nothing interesting. Anyway, few lines of documentation could make life easier for other guys too. Thanks in advance, -- Valery.
Chris Lattner
2004-Aug-14 20:49 UTC
[LLVMdev] is this code really JITed and/or optimized? ..
On Sat, 14 Aug 2004, Valery A.Khamenya wrote:> > > ExecutionEngine* EE = ExecutionEngine::create( MP, true ); > > As Reid pointed out, changing true to false will get it to work. > > as I've posted already, I got Segmentation Fault. > Now, i have re-compiled LLVM with debug support. > > The evaluation is broken at line 78 in file: > lib/ExecutionEngine/JIT/JIT.cpp > > The assertion > > assert(ArgValues.size() == 1); > > fails. But what's wrong? My function has type > int FooF(void); > so ArgValues should have size 0, right?Yes, you're right.> BTW, the code of runFunction is quite unclear, indeed, for some reason > cases ArgValues==3 and ArgValues==1 are specially considered... I looked > in JIT.h for more description on interface -- quite ascetic info, > nothing interesting. Anyway, few lines of documentation could make life > easier for other guys too.If you look at the 3 lines above the assert that is failing, you'll see this: // FIXME: This code should handle a couple of common cases efficiently, but // it should also implement the general case by code-gening a new anonymous // nullary function to call. Basically it's saying that we only support one argument functions that take an integer right now. This is a bug/suboptimality, hence the FIXME. There are several different ways to fix the problem, as hinted at by the comment. In the short term, adding something like this: } else if (ArgValues.empty()) { void (*PF)() = (void(*)())getPointerToFunction(F); assert(PF && "Pointer to fn's code was null after getPointerToFunction"); PF(); before the "else" case, should fix the issue for you. That code is basically only smart enough to run 'main', but could be enhanced by someone interested in it to handle the general case. -Chris -- http://llvm.org/ http://nondot.org/sabre/
Reid Spencer
2004-Aug-14 21:29 UTC
[LLVMdev] is this code really JITed and/or optimized? ..
ick! Is there a bugzilla on this? Reid. On Sat, 2004-08-14 at 13:49, Chris Lattner wrote:> If you look at the 3 lines above the assert that is failing, you'll see > this: > > // FIXME: This code should handle a couple of common cases efficiently, but > // it should also implement the general case by code-gening a new anonymous > // nullary function to call. > > Basically it's saying that we only support one argument functions that > take an integer right now. This is a bug/suboptimality, hence the FIXME. > > There are several different ways to fix the problem, as hinted at by the > comment. In the short term, adding something like this: > > } else if (ArgValues.empty()) { > void (*PF)() = (void(*)())getPointerToFunction(F); > assert(PF && "Pointer to fn's code was null after getPointerToFunction"); > PF(); > > before the "else" case, should fix the issue for you. That code is > basically only smart enough to run 'main', but could be enhanced by > someone interested in it to handle the general case. > > -Chris-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040814/54fa9ff1/attachment.sig>
Maybe Matching Threads
- [LLVMdev] is this code really JITed and/or optimized? ..
- [LLVMdev] is this code really JITed and/or optimized? ..
- [LLVMdev] RE: is this code really JITed and/or optimized ? ..
- [LLVMdev] is this code really JITed and/or optimized ? ..
- [LLVMdev] is this code really JITed and/or optimized ? ..