Moonjit is a Just-In-Time Compiler (JIT) for the Lua programming
language. Lua is a powerful, dynamic and light-weight programming
language. It may be embedded or used as a general-purpose, stand-alone
language.
The v2.2 release of moonjit brings many new features that bring the
project closer to its aim of unifying LuaJIT forks and compatibility
with Lua. Following are some major features implemented in this
release.
Lua 5.2 extensions
The following Lua 5.2 functions and behaviours are now implemented in moonjit.
- lua_len
- lua_rawlen
- lua_absindex
- lua_pushglobal
- luaL_len
- luaL_getsubtable
- luaL_pushresultsize
- luaL_tolstring
- String matching patterns may contain
\0
as a regular character.
Lua 5.3 extensions
The following Lua 5.3 functions and behaviours are now supported:
string.pack
,string.packsize
andstring.unpack
math.maxinteger
,max.mininteger
,math.tointeger(x)
,
math.type(x)
,math.ult(m, n)
Note: moonjit uses the same numeric type model as Lua 5.1 which
is incompatible with Lua 5.3. As a result, these functions work only
in the range [-2^53, 2^53].math.maxinteger
andmath.mininteger
thus give the limits of this range. A future release may remedy
this.utf8.char(...)
,utf8.charpattern
,utf8.codepoints(s [, i [, j]])
,utf8.codes(s)
,utf8.len(s [, i [, j]])
,utf8.offset(s, n [, i])
- Lua/C API extensions:
lua_isyieldable()
,luaopen_utf8()
Faster string hashing
moonjit incorporates the fast CRC hash for string hashing from
OpenResty's luajit2 to significantly speed up string hashing on
platforms that support it, i.e. platforms with SSE4.2 support.
Further, moonjit adds capability to detect SSE4.2 support at runtime
and deploy the suitable hash function instead of having to recompile
the binary.
OpenResty Extensions
The following OpenResty luajit extensions were incorporated into
moonjit:
thread.exdata
to embedding user data into a thread
(lua_State
). This cannot be used by from within OpenResty context
since it is used by OpenResty core.jit.prngstate
to manage the PRNG state (a Lua number) used by the
JIT compiler-bl
flag forjit.dump
to display the constant tables of each Lua
prototype- bytecode option
L
to display lua source line numbers - Internal memory-buffer-based trace entry/exit/start-recording event
logging, mainly for debugging bugs in the JIT compiler. it requires
-DLUA_USE_TRACE_LOGS when building
Contributors
This release was made possible due to contributions from the following
people:
- abhay1722
- Badger
- doujiang24
- Francois Perrad
- fsfod
- Girish Joshi
- Gustavo L F Walbon
- Guy Menanteau
- Johannes
- Julien Desgats
- ketank-new
- Luka Blaskovic
- Manuel BACHMANN
- mcc
- Michael Munday
- Mike Pall
- myfreeweb
- niravthakkar
- Patrick Galizia
- preetikhorjuvenkar
- Priya Seth
- Sameera Deshpande
- Shuxin Yang
- Siddhesh Poyarekar
- s.ostanevich
- Stefan Schulze Frielinghaus
- Thibault Charbonnier
- Vitaly Novichkov
- Vivien HENRIET
- Vyacheslav Egorov
- xiabin
- Yichun Zhang (agentzh)