// the output from emcc contains wrappers for these linker imports which add overhead,
// but now we have what we need to replace them with the actual functions
// By default the imports all live inside of 'env', but emscripten minification could rename it to 'a'.
// See https://github.com/emscripten-core/emscripten/blob/c5d1a856592b788619be11bbdc1dd119dec4e24c/src/preamble.js#L933-L936
constenv=imports.env||imports.a;
if(!env){
mono_log_warn("WARNING: Neither imports.env or imports.a were present when instantiating the wasm module. This likely indicates an emscripten configuration issue.");
return;
}
// the import names could be minified by applyImportAndExportNameChanges in emcc
// we call each stub function to get the runtime_idx, which is the index into the wasmImports array
// because of stack walk at src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
// and unit test at src\libraries\System.Runtime.InteropServices.JavaScript\tests\System.Runtime.InteropServices.JavaScript.Legacy.UnitTests\timers.mjs
// because of stack walk at src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
// and unit test at src\libraries\System.Runtime.InteropServices.JavaScript\tests\System.Runtime.InteropServices.JavaScript.Legacy.UnitTests\timers.mjs
// the output from emcc contains wrappers for these linker imports which add overhead,
// but now we have what we need to replace them with the actual functions
// By default the imports all live inside of 'env', but emscripten minification could rename it to 'a'.
// See https://github.com/emscripten-core/emscripten/blob/c5d1a856592b788619be11bbdc1dd119dec4e24c/src/preamble.js#L933-L936
constenv=imports.env||imports.a;
if(!env){
mono_log_warn("WARNING: Neither imports.env or imports.a were present when instantiating the wasm module. This likely indicates an emscripten configuration issue.");
return;
}
for(constkinrealFunctions){
constv=realFunctions[k];
if(typeof(v)!=="function")
continue;
if(kinenv)
env[k]=v;
}
}
asyncfunctioninstantiate_wasm_module(
imports:WebAssembly.Imports,
successCallback:InstantiateWasmSuccessCallback,
...
...
@@ -487,7 +474,7 @@ async function instantiate_wasm_module(