lua-users home
lua-l archive

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


On Thu, Jul 2, 2015 at 11:23 AM, Javier Guerra Giraldez <javier@guerrag.com> wrote:

> By support for WebAssembly in Lua, do you mean generating WebAssembly
> from Lua source or converting WebAssembly to Lua source or bytecode?


the easiest thing would be to just compile current Lua C sources to
WA, as was done so long ago with emscriptiem.  that alone, would be
great!  then, modifying the Lua compiler to emit WA instead of Lua
bytecode would make it even faster and more 'native'.


Compiling the Lua VM to WA should yield performance on par with the C implementation, so I think will be good enough for most uses. Lua's small size will make the VM a small download. They are planning to add support for dynamic linking with dlopen [1], so it will even be possible to require C modules instead of statically linking them with the VM (or call other WA libraries from Lua).

Right now WA is too low-level for efficiently compiling Lua code to it, and there is no JIT compilation yet. I also suspect it is too high-level to gain anything by writing the interpreter loop in WA by hand, as LuaJIT does. But support for JIT compilers will come, and Brendan Eich specifically mentioned LuaJIT in his original announcement [2].
 
--
Javier


[1] https://github.com/WebAssembly/design/blob/master/FutureFeatures.md
[2] https://brendaneich.com/2015/06/from-asm-js-to-webassembly/#comment-1628

--
Fabio Mascarenhas