lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Dec 4, 2011 at 7:29 PM, Axel Kittenberger <axkibe@gmail.com> wrote:
Because vanilla Lua and LuaJIT work very differently.  One is a
register based virtual machine, the other translates to assembler for
the CPU.

LuaJIT has bytecode and an interpreter, just like vanilla Lua. It just adds a tracing JIT-compiler on top of that.
 
Lua source to Lua bytecode compilation loses some information about
the code structure. Nothing that the Lua VM would need, since it only
executed the code, but LuaJIT uses that information.

Only insofar as the bytecode is in SSA-form.
 
Does LuaJIT even use another bytecode format? I always thought it
would translate source directly into assembler.

There is nothing direct about LuaJIT. The source is compiled into bytecode, which is then executed by the interpreter until the JIT kicks in, recording traces in the form of a special IR which is then compiled into machine code.