Adds MemoryDefinition to CompiledModule and Memory (#817)

It is more often the case that projects are enabling a freestanding
target, and that may or may not have an exporting memory depending on
how that's interpreted. This adds the ability to inspect memories
similar to how you can already inspect compiled code prior to
instantiation. For example, you can enforce an ABI constraint that
"memory" must be exported even if WASI is not in use.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-09-29 13:37:52 +08:00
committed by GitHub
parent 761347db1e
commit 9a623c4f88
15 changed files with 430 additions and 62 deletions

View File

@@ -181,8 +181,9 @@ func (r *runtime) CompileModule(ctx context.Context, binary []byte) (CompiledMod
internal.AssignModuleID(binary)
// Now that the module is validated, cache the function definitions.
// Now that the module is validated, cache the function and memory definitions.
internal.BuildFunctionDefinitions()
internal.BuildMemoryDefinitions()
c := &compiledModule{module: internal, compiledEngine: r.store.Engine}