internal WebAssemblyInstance(Module module, WebAssemblyImports imports) { Module = module; Imports = imports; _vm = new VirtualMachine(this); var memoryImport = Module.Import.SingleOrDefault(i => i.Type == ExternalKind.Memory); if (memoryImport != null) { Memory = Imports.GetMemory(memoryImport); foreach (var segment in module.Data) { Memory.Write(segment); } } var table = Module.Table; Table = new WebAssemblyTable(table.FirstOrDefault()?.Limits.Min ?? 0); foreach (var segment in module.Element) { Table.Write(segment); } }
public void Add(string module, string function, WebAssemblyMemory memory) { _memories[module + "." + function] = memory; }