Skip to content

Commit 2a283d1

Browse files
committed
Use createNamedFunction for asyncify wrappers. NFC
Also, add an assertion to dynCall. Split out from emscripten-core#25522.
1 parent 5ca9e3c commit 2a283d1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/lib/libasync.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ addToLibrary({
2121

2222
#if ASYNCIFY
2323
$Asyncify__deps: ['$runAndAbortIfError', '$callUserCallback',
24+
#if ASSERTIONS
25+
'$createNamedFunction',
26+
#endif
2427
#if !MINIMAL_RUNTIME
2528
'$runtimeKeepalivePush', '$runtimeKeepalivePop',
2629
#endif
@@ -143,6 +146,9 @@ addToLibrary({
143146
#endif
144147
#if MAIN_MODULE
145148
wrapper.orig = original;
149+
#endif
150+
#if ASSERTIONS
151+
wrapper = createNamedFunction(`__asyncify_wrapper_${original.name}`, wrapper);
146152
#endif
147153
return wrapper;
148154
},

src/lib/libcore.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,9 @@ addToLibrary({
17751775
},
17761776

17771777
$dynCall: (sig, ptr, args = [], promising = false) => {
1778+
#if ASSERTIONS
1779+
assert(ptr, `null function pointer in dynCall`);
1780+
#endif
17781781
#if ASSERTIONS && (DYNCALLS || !WASM_BIGINT || !JSPI)
17791782
assert(!promising, 'async dynCall is not supported in this mode')
17801783
#endif

0 commit comments

Comments
 (0)