[wasm] Fix missing branch target table update (#83236)
authorKatelyn Gadd <kg@luminance.org>
Fri, 10 Mar 2023 00:25:59 +0000 (16:25 -0800)
committerGitHub <noreply@github.com>
Fri, 10 Mar 2023 00:25:59 +0000 (16:25 -0800)
The jiterpreter was failing to add unconditional branch targets to the branch target table, which could cause branches targeting them to fail and make the trace bail out.

src/mono/wasm/runtime/jiterpreter-trace-generator.ts

index 38e9647..8f44a3b 100644 (file)
@@ -2396,6 +2396,7 @@ function emit_branch (
                 // Simple branches are enabled and this is a forward branch. We
                 //  don't need to wrap things in a block here, we can just exit
                 //  the current branch block after updating eip
+                builder.branchTargets.add(destination);
                 builder.ip_const(destination);
                 builder.local("eip", WasmOpcode.set_local);
                 builder.appendU8(WasmOpcode.br);