Adds LookupFunction in experimental/table package (#1637)

This commit is contained in:
Takeshi Yoneda
2023-08-20 08:10:10 +09:00
committed by GitHub
parent 78b4581b51
commit 4709f04be3
4 changed files with 135 additions and 7 deletions

View File

@@ -93,10 +93,7 @@ func (v *InvokeFunc) Call(ctx context.Context, mod api.Module, stack []uint64) {
m := mod.(*wasm.ModuleInstance)
// Lookup the type of the function we are calling indirectly.
typeID, err := m.GetFunctionTypeID(v.FunctionType)
if err != nil {
panic(err)
}
typeID := m.GetFunctionTypeID(v.FunctionType)
// This needs copy (not reslice) because the stack is reused for results.
// Consider invoke_i (zero arguments, one result): index zero (tableOffset)
@@ -129,7 +126,7 @@ func (v *InvokeFunc) Call(ctx context.Context, mod api.Module, stack []uint64) {
var savedStack [2]uint64
callOrPanic(ctx, mod, "stackSave", savedStack[:])
err = f.CallWithStack(ctx, stack)
err := f.CallWithStack(ctx, stack)
if err != nil {
// Module closed: any calls will just fail with the same error.
if _, ok := err.(*sys.ExitError); ok {