ir: rename NeedsAccess* -> Has*, and make them module-scoped (#699)

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
Takeshi Yoneda
2022-07-15 08:54:00 +09:00
committed by GitHub
parent 5f92e37d19
commit 9e3dda2429
9 changed files with 62 additions and 32 deletions

View File

@@ -17,6 +17,8 @@ var (
case695 []byte
//go:embed testdata/696.wasm
case696 []byte
//go:embed testdata/699.wasm
case699 []byte
)
func newRuntimeCompiler() wazero.Runtime {
@@ -87,3 +89,26 @@ func Test696(t *testing.T) {
})
}
}
// Test699 ensures that accessing element instances and data instances works
// without crash even when the access happens in the nested function call.
func Test699(t *testing.T) {
if !platform.CompilerSupported() {
return
}
for _, tc := range []struct {
name string
r wazero.Runtime
}{
{name: "compiler", r: newRuntimeCompiler()},
{name: "interpreter", r: newRuntimeInterpreter()},
} {
tc := tc
t.Run(tc.name, func(t *testing.T) {
defer tc.r.Close(ctx)
_, err := tc.r.InstantiateModuleFromBinary(ctx, case699)
require.NoError(t, err)
})
}
}