wazevo(frontend): fixes br_table lowering not to share arg slice (#1777)

Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
Takeshi Yoneda
2023-10-13 09:11:05 +09:00
committed by GitHub
parent 66a5be714f
commit 088424c7e5
4 changed files with 39 additions and 1 deletions

View File

@@ -419,3 +419,21 @@ func Test1054(t *testing.T) {
modules[1].Memory().(*wasm.MemoryInstance).Buffer,
)
}
// Test1777 tests that br_table with multiple args works fine even if
// there might be phi eliminations.
func Test1777(t *testing.T) {
if !platform.CompilerSupported() {
return
}
run(t, func(t *testing.T, r wazero.Runtime) {
mod, err := r.Instantiate(ctx, getWasmBinary(t, 1777))
require.NoError(t, err)
f := mod.ExportedFunction("")
require.NotNil(t, f)
res, err := f.Call(ctx)
require.NoError(t, err)
require.Equal(t, []uint64{18446626425965379583, 4607736361554183979}, res)
})
}