Questions on LuaJIT

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions on LuaJIT

joe rossi
Some random questions, mostly for Mike Pall.

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? Will luac work with the JIT? Lastly, do I need to distribute DynASM?

Thanks in advance,
Joe

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply | Threaded
Open this post in threaded view
|

Re: Questions on LuaJIT

Mike Pall-61
Hi,

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?

Abuse? ;-)

> 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
symbols either.

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
unused.]

> 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.

Bye,
     Mike

Reply | Threaded
Open this post in threaded view
|

Re: Questions on LuaJIT

Adrian Sietsma
In reply to this post by joe rossi
joe rossi wrote:
Some random questions, mostly for Mike Pall.

...
Can I hide the JIT scripts so users won't edit them?

You can use luac as MP suggests; alternately (for windows only) you can embed the lua source in a resource / dll.

Reply | Threaded
Open this post in threaded view
|

Re: Questions on LuaJIT

Luiz Henrique de Figueiredo
> You can use luac as MP suggests; alternately (for windows only) you can 
> embed the lua source in a resource / dll.

Why for Windows only? See my srlua for a solution that works everywhere.
--lhf

Reply | Threaded
Open this post in threaded view
|

Re: Questions on LuaJIT

D Burgess-4
Do you have a URL for that Luiz?

I have used Win32 resources for Lua code and found them to be
convenient.

Thanks
DB

On 12/21/05, Luiz Henrique de Figueiredo <[hidden email]> wrote:
> > You can use luac as MP suggests; alternately (for windows only) you can
> > embed the lua source in a resource / dll.
>
> Why for Windows only? See my srlua for a solution that works everywhere.
> --lhf
>


Reply | Threaded
Open this post in threaded view
|

Re: Questions on LuaJIT

Luiz Henrique de Figueiredo
> Do you have a URL for that Luiz?

All my libraries are here:
	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/

and also at LuaForge:
	http://luaforge.net/users/lhf/

--lhf