Adds vs benchmark WasmEdge and splits compile from instantiate (#495)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-04-22 16:13:51 +08:00
committed by GitHub
parent 2b5b1b706e
commit f728be94c5
13 changed files with 495 additions and 232 deletions

View File

@@ -131,11 +131,16 @@ type CompiledCode struct {
compiledEngine wasm.Engine
}
// compile-time check to ensure CompiledCode implements io.Closer (consistent with api.Module)
var _ io.Closer = &CompiledCode{}
// Close releases all the allocated resources for this CompiledCode.
//
// Note: it is safe to call Close while having outstanding calls from Modules instantiated from this *CompiledCode.
func (c *CompiledCode) Close() {
// Note: It is safe to call Close while having outstanding calls from Modules instantiated from this *CompiledCode.
func (c *CompiledCode) Close() error {
c.compiledEngine.DeleteCompiledModule(c.module)
// It is possible the underlying may need to return an error later, but in any case this matches api.Module.Close.
return nil
}
// ModuleConfig configures resources needed by functions that have low-level interactions with the host operating system.