The BrTable AST node is currently not emitted with any form of optimization, as it used to be. The reason being that this causes problems consolidating the stack as different branches have different alignments that must be emitted before doing the jump.
Nonetheless, it should still be possible to at least generate a binary search instead of a linear search for the branch or otherwise optimize the lookup.
The
BrTable
AST node is currently not emitted with any form of optimization, as it used to be. The reason being that this causes problems consolidating the stack as different branches have different alignments that must be emitted before doing the jump.Nonetheless, it should still be possible to at least generate a binary search instead of a linear search for the branch or otherwise optimize the lookup.
https://github.com/Rerumu/Wasynth/blob/master/codegen-luajit/src/backend/statement.rs#L31 https://github.com/Rerumu/Wasynth/blob/master/codegen-luau/src/backend/statement.rs#L42