Skip to content

Commit aa0ed29

Browse files
authored
Remove needless internal use of Module object. NFC (#17388)
This are normal native functions and we can call them by their internal name (I'm working on a change that avoids exporting them at all).
1 parent 005699e commit aa0ed29

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/library_async.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ mergeInto(LibraryManager.library, {
210210
Asyncify.state = Asyncify.State.Normal;
211211
// Keep the runtime alive so that a re-wind can be done later.
212212
#if ASYNCIFY == 1
213-
runAndAbortIfError(Module['_asyncify_stop_unwind']);
213+
runAndAbortIfError(_asyncify_stop_unwind);
214214
#endif
215215
if (typeof Fibers != 'undefined') {
216216
Fibers.trampoline();
@@ -331,7 +331,7 @@ mergeInto(LibraryManager.library, {
331331
#endif
332332
Asyncify.state = Asyncify.State.Rewinding;
333333
#if ASYNCIFY == 1
334-
runAndAbortIfError(() => Module['_asyncify_start_rewind'](Asyncify.currData));
334+
runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
335335
#endif
336336
if (typeof Browser != 'undefined' && Browser.mainLoop.func) {
337337
Browser.mainLoop.resume();
@@ -392,7 +392,7 @@ mergeInto(LibraryManager.library, {
392392
// TODO: handle rejection
393393
});
394394
#else
395-
runAndAbortIfError(() => Module['_asyncify_start_unwind'](Asyncify.currData));
395+
runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData));
396396
#endif
397397
}
398398
} else if (Asyncify.state === Asyncify.State.Rewinding) {
@@ -402,7 +402,7 @@ mergeInto(LibraryManager.library, {
402402
#endif
403403
Asyncify.state = Asyncify.State.Normal;
404404
#if ASYNCIFY == 1
405-
runAndAbortIfError(Module['_asyncify_stop_rewind']);
405+
runAndAbortIfError(_asyncify_stop_rewind);
406406
#endif
407407
_free(Asyncify.currData);
408408
Asyncify.currData = null;
@@ -534,7 +534,7 @@ mergeInto(LibraryManager.library, {
534534
_emscripten_stack_set_limits(stack_base, stack_max);
535535

536536
#if STACK_OVERFLOW_CHECK >= 2
537-
Module['___set_stack_limits'](stack_base, stack_max);
537+
___set_stack_limits(stack_base, stack_max);
538538
#endif
539539

540540
stackRestore({{{ makeGetValue('newFiber', C_STRUCTS.emscripten_fiber_s.stack_ptr, 'i32') }}});
@@ -561,7 +561,7 @@ mergeInto(LibraryManager.library, {
561561
err('ASYNCIFY/FIBER: start rewind', asyncifyData, '(resuming fiber', newFiber, ')');
562562
#endif
563563
Asyncify.state = Asyncify.State.Rewinding;
564-
Module['_asyncify_start_rewind'](asyncifyData);
564+
_asyncify_start_rewind(asyncifyData);
565565
Asyncify.doRewind(asyncifyData);
566566
}
567567
},
@@ -610,7 +610,7 @@ mergeInto(LibraryManager.library, {
610610
#if ASYNCIFY_DEBUG
611611
err('ASYNCIFY/FIBER: start unwind', asyncifyData);
612612
#endif
613-
Module['_asyncify_start_unwind'](asyncifyData);
613+
_asyncify_start_unwind(asyncifyData);
614614

615615
var stackTop = stackSave();
616616
{{{ makeSetValue('oldFiber', C_STRUCTS.emscripten_fiber_s.stack_ptr, 'stackTop', 'i32') }}};
@@ -624,7 +624,7 @@ mergeInto(LibraryManager.library, {
624624
err('ASYNCIFY/FIBER: stop rewind');
625625
#endif
626626
Asyncify.state = Asyncify.State.Normal;
627-
Module['_asyncify_stop_rewind']();
627+
_asyncify_stop_rewind();
628628
Asyncify.currData = null;
629629
}
630630
},

src/library_stack_trace.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ var LibraryStackTrace = {
1212
// This avoids an infinite recursion with malloc()->abort()->stackTrace()->demangle()->malloc()->...
1313
demangle.recursionGuard = (demangle.recursionGuard|0)+1;
1414
if (demangle.recursionGuard > 1) return func;
15-
var __cxa_demangle_func = Module['___cxa_demangle'] || Module['__cxa_demangle'];
16-
assert(__cxa_demangle_func);
15+
#ASSERTIONS
16+
assert(___cxa_demangle);
17+
#endif
1718
return withStackSave(function() {
1819
try {
1920
var s = func;
@@ -23,7 +24,7 @@ var LibraryStackTrace = {
2324
var buf = stackAlloc(len);
2425
stringToUTF8(s, buf, len);
2526
var status = stackAlloc(4);
26-
var ret = __cxa_demangle_func(buf, 0, 0, status);
27+
var ret = ___cxa_demangle(buf, 0, 0, status);
2728
if ({{{ makeGetValue('status', '0', 'i32') }}} === 0 && ret) {
2829
return UTF8ToString(ret);
2930
}

0 commit comments

Comments
 (0)