emscripten: adds experimental InstantiateForModule for invoke exports (#1372)

This adds emscripten.InstantiateForModule into the experimental package.
This builds dynamic invoke exports in the same order and only matching
those needed by the importing modules.

Finally, this removes special casing of function type IDs by deferring
resolution of them only in Emscripten.

Fixes #1364

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-04-18 09:13:50 +02:00
committed by GitHub
parent 2a2e07a91f
commit df0faa5d16
9 changed files with 795 additions and 321 deletions

View File

@@ -23,6 +23,12 @@ import (
// defer r.Close(ctx) // This closes everything this Runtime created.
//
// mod, _ := r.Instantiate(ctx, wasm)
//
// # Notes
//
// - Closing this closes any CompiledModule or Module it instantiated.
// - This is an interface for decoupling, not third-party implementations.
// All implementations are in wazero.
type Runtime interface {
// Instantiate instantiates a module from the WebAssembly binary (%.wasm)
// with default configuration.