Rerumu / Wasynth

WebAssembly to Lua translation library and tool
https://discord.gg/sgm5YcmgyD
GNU General Public License v3.0
130 stars 18 forks source link

(Luau) `br_table.wast.lua` test fails due to recursion depth limit #12

Closed Hexcede closed 2 years ago

Hexcede commented 2 years ago

I am making a note of this for discussion. I'm not sure if it relates to #8 or not, but the br_table.wast test fails to compile in luau due to the following error message:

/home/hexcede/programming/Wasynth/target/tmp/br_table.wast.lua:1076: Exceeded allowed recursion depth; simplify your expression to make the code compile
stacktrace:

The referenced line is the creation of loaded["temp"] and my syntax highlighter fails to highlight this section making it difficult to tell exactly what's going on. My understanding of this error is that the wasm module is generating too many nested functions at compile time, however I could be wrong there.

This would likely require some sort of codegen changes to account for.

Rerumu commented 2 years ago

The table in question has something like thousands of cases. The issue here most likely relates to the other mentioned as fixing the other would probably heavily reduce code generated.

I'll note this also affects LuaJIT because of its jump size limit.

Rerumu commented 2 years ago

Seems to be fixed alongside #8.