Hi all, I think there is still too few docs/samples for those, who'd like to write JIT-based interpreters. Today, the real examples to learn from are rather: - lli.cpp - ModuleMaker.cpp - Stacker which is still unfortunatelly not that much about JITing :( Well, what I am going to sell: What about very small JIT-based example similar to ModuleMaker? I mean example, where, say, two simple functions are created, inserted to a Module/BasicBlock, then executed via JIT and result is passed to a driver. It would be really great. Thanks. --- Valery A.Khamenya
Valery, I agree that there could be more examples of JIT-based interpreters, and I like your idea. When can you have it ready? :) Reid. On Sun, 2004-08-08 at 13:11, Valery A.Khamenya wrote:> Hi all, > > I think there is still too few docs/samples for those, > who'd like to write JIT-based interpreters. > > Today, the real examples to learn from are rather: > > - lli.cpp > - ModuleMaker.cpp > - Stacker > > which is still unfortunatelly not that much > about JITing :( > > Well, what I am going to sell: > > What about very small JIT-based example similar > to ModuleMaker? > > I mean example, where, say, two simple functions are > created, inserted to a Module/BasicBlock, then executed > via JIT and result is passed to a driver. > It would be really great. > > Thanks. > > > --- > Valery A.Khamenya > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- 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/20040808/5188d9bb/attachment.sig>
Hi Reid,> I agree that there could be more examples of JIT-based interpreters, and > I like your idea. When can you have it ready? :)soon, if you could just help me to get through some sticky places :) Agreed? (if "yes" then you could simply answer me privately and I will send you my concrete questions) Thank you. -- Valery.
On Mon, Aug 09, 2004 at 12:11:03AM +0400, Valery A.Khamenya wrote:> What about very small JIT-based example similar > to ModuleMaker? > > I mean example, where, say, two simple functions are > created, inserted to a Module/BasicBlock, then executed > via JIT and result is passed to a driver. > It would be really great.Your example would essentially take lli.cpp and hack out the part where the bytecode is read from a file to instead construct a Module directly. See the part where there's a ModuleProvider created from an InputFile and then ExecutionEngine::create() is called on the ModuleProvider. That's about all that would need to change. You can also use ExecutionEngine::runFunctionAsMain() if you wish. For a trivial example, if you look through the Module, ModuleProvider, and ExecutionEngine interfaces, you can probably simplify lli.cpp a great deal to work with a single main() function in a Module with one return statement. HTH, -- Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu