[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Questions on LuaJIT
- From: Mike Pall <mikelu-0512@...>
- Date: Fri, 16 Dec 2005 16:18:54 +0100
joe rossi wrote:
> I've added LuaJIT to my app and I'm trying to consider what that
> means besides a performance boost. Are there any tips on ways to
> use/abuse this?
> Can I hide the JIT scripts so users won't edit them?
You mean jit.opt and so on? Well ... why bother? I mean it's open
source, so there's nothing secret about it. But if you are
worried that a user edits a script and then gets a crash: that's
their problem -- modifying the internals of any application is
a bad idea (unless you know what you are doing).
But if you have a really good reason (e.g. packaging everything
inside one executable): use luac -s and bin2c (from Lua 5.0) and
link them to your code. Load the bytecode (luaL_loadbuffer) at
startup and put the returned module function into package.preload.
Don't forget that your main program (e.g. what replaces lua.c)
needs to require the JIT modules _and_ run the start() function.
In pure Lua that would be: require("jit.opt").start().
> Will luac work with the JIT?
Yes. LuaJIT operates on internal structures (LClosure*, Proto*).
It doesn't even know whether the bytecode has been freshly
translated from source or whether it has been untangled from the
binary bytecode representation. It doesn't care about stripped
Be sure to use a luac that exactly matches the version LuaJIT is
based on. [Technically you can build luac with the LuaJIT source,
but it's a waste because the JIT engine is linked in, but stays
> Lastly, do I need to distribute DynASM?
No. You only need DynAsm during the build process of LuaJIT
itself. And only if you need to modify anything in the *.dasc or
*.dash files (very unlikely -- better file a bug report with me).
The only things you really need to distribute is the compiled C
code and the jit.opt* modules. An acknowledgment in the docs
would be nice though (but the license does not require it).
BTW: I plan on collecting a 'Who uses LuaJIT' list with links to
projects (hey, free advertising for you :-)). Anyone interested,
please mail me a short description and a link. Thank you!
[Don't worry, I'll guarantee your confidentiality if you have
mailed me non-publicly about LuaJIT in the past.]
BTW#2: I'm making progress on the next release. But I don't know
whether I can get it out before the end of the year.