Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/lib/libdylink.js
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ var LibraryDylink = {
},

$loadDylibs__internal: true,
$loadDylibs__deps: ['$loadDynamicLibrary', '$reportUndefinedSymbols', '$addRunDependency', '$removeRunDependency'],
$loadDylibs__deps: ['$loadDynamicLibrary', '$reportUndefinedSymbols'],
$loadDylibs: async () => {
if (!dynamicLibraries.length) {
#if DYLINK_DEBUG
Expand All @@ -1248,7 +1248,6 @@ var LibraryDylink = {
#if DYLINK_DEBUG
dbg('loadDylibs:', dynamicLibraries);
#endif
addRunDependency('loadDylibs');

// Load binaries asynchronously
for (var lib of dynamicLibraries) {
Expand All @@ -1260,7 +1259,6 @@ var LibraryDylink = {
#if DYLINK_DEBUG
dbg('loadDylibs done!');
#endif
removeRunDependency('loadDylibs');
},

// void* dlopen(const char* filename, int flags);
Expand Down
16 changes: 8 additions & 8 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ function getWasmImports() {
// handle a generated wasm instance, receiving its exports and
// performing other necessary setup
/** @param {WebAssembly.Module=} module*/
function receiveInstance(instance, module) {
{{{ asyncIf(MAIN_MODULE) }}}function receiveInstance(instance, module) {
#if RUNTIME_DEBUG
dbg('receiveInstance')
#endif
Expand Down Expand Up @@ -776,21 +776,21 @@ function getWasmImports() {
Module['wasmExports'] = wasmExports;
#endif

#if !IMPORTED_MEMORY
updateMemoryViews();
#endif
Comment thread
sbc100 marked this conversation as resolved.

#if MAIN_MODULE
#if '$LDSO' in addedLibraryItems
LDSO.init();
#endif
loadDylibs();
await loadDylibs();
#endif

#if ABORT_ON_WASM_EXCEPTIONS
instrumentWasmTableWithAbort();
#endif

#if !IMPORTED_MEMORY
updateMemoryViews();
#endif

#if PTHREADS || WASM_WORKERS
// We now have the Wasm module loaded up, keep a reference to the compiled module so we can post it to the workers.
wasmModule = module;
Expand Down Expand Up @@ -864,7 +864,7 @@ function getWasmImports() {

#if SOURCE_PHASE_IMPORTS
var instance = await WebAssembly.instantiate(wasmModule, info);
var exports = receiveInstantiationResult({instance, 'module':wasmModule});
var exports = {{{ awaitIf(MAIN_MODULE) }}}receiveInstantiationResult({instance, 'module':wasmModule});
Comment thread
sbc100 marked this conversation as resolved.
return exports;
#else
wasmBinaryFile ??= findWasmBinary();
Expand All @@ -873,7 +873,7 @@ function getWasmImports() {
dbg('asynchronously preparing wasm');
#endif
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
var exports = receiveInstantiationResult(result);
var exports = {{{ awaitIf(MAIN_MODULE) }}}receiveInstantiationResult(result);
return exports;
#else // WASM_ASYNC_COMPILATION
var result = instantiateSync(wasmBinaryFile, info);
Expand Down
4 changes: 2 additions & 2 deletions src/runtime_pthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
// notified about them.
self.onunhandledrejection = (e) => { throw e.reason || e; };

{{{ asyncIf(ASYNCIFY == 2) }}}function handleMessage(e) {
{{{ asyncIf(ASYNCIFY == 2 || MAIN_MODULE) }}}function handleMessage(e) {
try {
var msgData = e.data;
//dbg('msgData: ' + Object.keys(msgData));
Expand Down Expand Up @@ -123,7 +123,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
#if MODULARIZE == 'instance'
init();
#else
createWasm();
{{{ awaitIf(MAIN_MODULE) }}}createWasm();
run();
#endif
#endif // MINIMAL_RUNTIME
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_dylink.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 26397,
"a.out.js.gz": 11245,
"a.out.js": 26265,
"a.out.js.gz": 11182,
"a.out.nodebug.wasm": 17861,
"a.out.nodebug.wasm.gz": 9019,
"total": 44258,
"total_gz": 20264,
"total": 44126,
"total_gz": 20201,
"sent": [
"__syscall_stat64",
"emscripten_resize_heap",
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_hello_dylink_all.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"a.out.js": 268126,
"a.out.js": 268089,
"a.out.nodebug.wasm": 587575,
"total": 855701,
"total": 855664,
"sent": [
"IMG_Init",
"IMG_Load",
Expand Down
Loading