Skip to content
Merged
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
17 changes: 7 additions & 10 deletions src/lib/libasync.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,18 @@ addToLibrary({
},
#endif

#if ASYNCIFY == 1
instrumentFunction(original) {
var wrapper = (...args) => {
#if ASYNCIFY_DEBUG >= 2
dbg(`ASYNCIFY: ${' '.repeat(Asyncify.exportCallStack.length)} try ${original}`);
#endif
#if ASYNCIFY == 1
Asyncify.exportCallStack.push(original);
try {
#endif
#if ASYNCIFY == 1 && MEMORY64
#if MEMORY64
Asyncify.saveRewindArguments(original, args);
#endif
return original(...args);
#if ASYNCIFY == 1
} finally {
if (!ABORT) {
var top = Asyncify.exportCallStack.pop();
Expand All @@ -139,11 +137,8 @@ addToLibrary({
Asyncify.maybeStopUnwind();
}
}
#endif
};
#if ASYNCIFY == 1
Asyncify.funcWrappers.set(original, wrapper);
#endif
#if MAIN_MODULE
wrapper.orig = original;
#endif
Expand All @@ -152,6 +147,7 @@ addToLibrary({
#endif
return wrapper;
},
#endif // ASYNCIFY == 1

instrumentWasmExports(exports) {
#if EMBIND_GEN_MODE
Expand All @@ -175,11 +171,12 @@ addToLibrary({
Asyncify.asyncExports.add(original);
original = Asyncify.makeAsyncFunction(original);
}
#endif
ret[x] = original;
#else
var wrapper = Asyncify.instrumentFunction(original);
ret[x] = wrapper;

} else {
#endif
Copy link
Member

@kripken kripken Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not match if ASYNCIFY == 2? (edit: from line 167) (if so, then my comment from above remains - can this not be reached with values 0 or 1?)

Please add a comment saying what it does match, if I'm reading this wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is my confusion about JSPI - what is the value of ASYNCIFY when JSPI is enabled?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSPI means ASYNCIFY == 2 yes, they are the same thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, makes sense now.

} else {
ret[x] = original;
}
}
Expand Down