In my case, I am working on a posix regular expression library that uses
LLVM to execute a regular expression.
Each regular expression is a very small sets of code and is faster to
interpret than to JIT then execute.
I wanted to JIT only when the regular expression is executed more than 20
times.
The benchmarks I have run show that my library is amzingly fast to execute a
regular expression (thanks to LLVM) but amzingly slow to compile in JIT.
I need the interpreter to provide a way to execute a regular expression
without JITing it, which would be much slower BUT will result in a faster
execution IF the regular expression is used only two or three times.
So, is there no way now to execute a LLVM bitcode *without* JITing ?
On Tue, Nov 2, 2010 at 19:00, OvermindDL1 <overminddl1 at gmail.com>
wrote:
> Helps to send to list:
>
> On Tue, Nov 2, 2010 at 1:00 PM, OvermindDL1 <overminddl1 at
gmail.com> wrote:
> > On Tue, Nov 2, 2010 at 12:51 PM, Salomon Brys <salomon.brys at
gmail.com>
> wrote:
> >> Hi everyone !
> >> I am very new to LLVM and intent to use it in a research project.
> >> I have a problem with the interpreter: I have a simple compiler
that
> >> generates LLVM bitcode, JIT it and execute it, and it works very
well.
> >> Now I would like to execute it using the interpreter. And I get a
> segfault.
> >> Here is the code :
> >> // This code JIT the function and executes it
> >> llvm::InitializeNativeTarget();
> >> llvm::ExecutionEngine * EJ =
llvm::ExecutionEngine::create(&nM);
> >> typedef int (*REFunc)(const char *);
> >> union { void * obj; REFunc func; } u;
> >> u.obj = EJ->getPointerToFunction(func);
> >> REFunc jit = u.func;
> >> int ret = jit("aaa");
> >> std::cout << std::endl << ret << std::endl;
> >> // This code interprets the function
> >> llvm::initializeCore();
> >> llvm::ExecutionEngine * EI > >>
>
llvm::EngineBuilder(&M).setEngineKind(llvm::EngineKind::Interpreter).create();
> >> EI->runStaticConstructorsDestructors(false);
> >> std::vector<llvm::GenericValue> args;
> >> llvm::GenericValue arg1((void*)"aaabc");
> >> args.push_back(arg1);
> >> llvm::APInt res = EI->runFunction(func, args).IntVal;
> >> llvm::outs() << res << "\n";
> >> The first block of code works very well and write the expected
result.
> >> The second block segfaults on the EI->runFunction(func, args)
call.
> >> I can't find my mistake. Would somebody help me on this ???
> >> Thank you very much !
> >
> > The interpreter is probably broken. Since the JIT became stable the
> > interpreter is falling to bitrot, so it is better not to use it, just
> > use the JIT. Why do you need the interpreter anyway if the JIT is
> > working for you?
> >
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
###########################################
# Salomon BRYS
# +33 (0) 6 83 54 55 96
#------------------------------------------
# > EPITECH "Koala" : C++ assistant : Sbire du C++
# > Zend Certified Engineer for PHP5
#------------------------------------------
# All data in this e-mail is confidential.
# If you are not, or if you don't believe you are, the recipient of this
e-mail, please delete it.
#------------------------------------------
# GPG : http://gpgkey-salomon.antesocial.fr/
###########################################
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20101102/45bbdc8d/attachment.html>