KS Sreeram
2009-Sep-23 00:04 UTC
[LLVMdev] [PATCH] Set error message if JIT/Interpreter not linked in.
Hi, In ExecutionEngine.cpp, when the JIT or the Interpreter have not been linked in then EngineBuilder::create fails without setting ErrorStr. I've attached a patch to fix this. Warm Regards KS Sreeram -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ee-not-linked-in-msg.diff URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090923/a455bb75/attachment.ksh>
Chris Lattner
2009-Sep-23 01:46 UTC
[LLVMdev] [PATCH] Set error message if JIT/Interpreter not linked in.
On Sep 22, 2009, at 5:04 PM, KS Sreeram wrote:> Hi, > > In ExecutionEngine.cpp, when the JIT or the Interpreter have not > been linked in then EngineBuilder::create fails without setting > ErrorStr. > > I've attached a patch to fix this.Thanks, applied in r82600. Please attach patches instead of including them inline. -Chris> > Warm Regards > KS Sreeram > Index: lib/ExecutionEngine/ExecutionEngine.cpp > ==================================================================> --- lib/ExecutionEngine/ExecutionEngine.cpp (revision 82523) > +++ lib/ExecutionEngine/ExecutionEngine.cpp (working copy) > @@ -436,16 +436,23 @@ > > // Unless the interpreter was explicitly selected or the JIT is > not linked, > // try making a JIT. > - if (WhichEngine & EngineKind::JIT && ExecutionEngine::JITCtor) { > - EE = ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel, > - AllocateGVsWithCode); > + if (WhichEngine & EngineKind::JIT) { > + if (ExecutionEngine::JITCtor) { > + EE = ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel, > + AllocateGVsWithCode); > + } else { > + *ErrorStr = "JIT has not been linked in."; > + } > } > > // If we can't make a JIT and we didn't request one specifically, > try making > // an interpreter instead. > - if (WhichEngine & EngineKind::Interpreter && EE == 0 && > - ExecutionEngine::InterpCtor) { > - EE = ExecutionEngine::InterpCtor(MP, ErrorStr); > + if (WhichEngine & EngineKind::Interpreter && EE == 0) { > + if (ExecutionEngine::InterpCtor) { > + EE = ExecutionEngine::InterpCtor(MP, ErrorStr); > + } else { > + *ErrorStr = "Interpreter has not been linked in."; > + } > } > > return EE; > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev