Adds experimental package to expose listener and sys APIs (#513)

This adds an experimental package to expose two work-in-progress
features:
* FunctionListener - for tracing etc.
* Sys - to control random number generators

Both the functionality and the names of the features above are
not stable. However, this should help those who can tolerate drift a
means to test things out.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Anuraag Agrawal <anuraaga@gmail.com>
This commit is contained in:
Crypt Keeper
2022-04-29 08:42:24 +08:00
committed by GitHub
parent 266320e257
commit 189b694140
26 changed files with 542 additions and 435 deletions

View File

@@ -64,7 +64,7 @@ func getFunctionInstance(module *wasm.Module, index wasm.Index, moduleInstance *
Type: module.TypeSection[typeIndex],
Body: module.CodeSection[index].Body,
LocalTypes: module.CodeSection[index].LocalTypes,
Index: index + c,
Idx: index + c,
}
}
@@ -298,7 +298,7 @@ func runTestModuleEngine_Call_HostFn_ModuleContext(t *testing.T, et EngineTester
Kind: wasm.FunctionKindGoModule,
Type: sig,
Module: module,
Index: 0,
Idx: 0,
}
me, err := e.NewModuleEngine(t.Name(), m, nil, []*wasm.FunctionInstance{f}, nil, nil)
@@ -600,7 +600,7 @@ func linkModuleToEngine(module *wasm.ModuleInstance, me wasm.ModuleEngine) {
// addFunction assigns and adds a function to the module.
func addFunction(module *wasm.ModuleInstance, funcName string, fn *wasm.FunctionInstance) {
fn.DebugName = wasmdebug.FuncName(module.Name, funcName, fn.Index)
fn.DebugName = wasmdebug.FuncName(module.Name, funcName, fn.Idx)
module.Functions = append(module.Functions, fn)
if module.Exports == nil {
module.Exports = map[string]*wasm.ExportInstance{}