lua-users home
lua-l archive

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


On Thu, 30 Jan 2020 at 16:04, Hugo Musso Gualandi
<hgualandi@inf.puc-rio.br> wrote:
>
> For a recent paper that I recently worked on, I created a modified
> version of Lua 5.4 that can compile Lua functions into C. On some
> number-crunchy benchmarks, it managed to get a speedup of 2x compared
> to regular Lua 5.4.
>
> It is still full of bugs, and I won't keep it updated with future Lua
> versions, so it probably wouldn't be a good idea to use it for anything
> serious. That said, I think that it might be scientifically interesting
> for some people, so I'm sharing it here :)
>
> https://github.com/hugomg/lua-aot-5.4

Nice! I did a similar thing for Lua 5.0 (or rather 5.1 beta) back in 2006:

http://lua-users.org/lists/lua-l/2006-07/msg00144.html

However, I stuck to the public Lua C APIs, so the resulting code ended up
slower than the stock interpreter. The main takeaway then was that the
Lua API back then didn't cover everything that you could do in Lua code
(for some things I had to emit Lua text and eval to preserve the semantics).
Roberto eventually fixed those omissions in later versions of Lua (and I'd
like to believe my work was useful for spotting those omissions, though I
never had confirmation that it was the case!)

David Manura's lua2c was also a very similar project, based on Lua source
instead of bytecode, and was maintained all the way to Lua 5.2. Like mine
it also uses the public APIs:

https://github.com/davidm/lua2c/

Both projects hit limitations with coroutines, upvalues and tail calls. Do any
of these three limitations apply to lua-aot?

As for compatibility: did you try to run the Lua test suite with lua-aot?
If so, how much of it can it handle?

-- Hisham