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
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ v.1.38.43: 08/30/2019
---------------------
- noExitRuntime is no longer a property on the Module object. Use `noExitRuntime`
instead of `Module.noExitRuntime`.
- Module.abort is no longer exported by default. It can be exported in the normal
way using `EXTRA_EXPORTED_RUNTIME_METHODS`, and as with other such changes in
the past, forgetting to export it with show a clear error in `ASSERTIONS` mode.

v.1.38.42: 08/19/2019
----------------------
Expand Down
2 changes: 1 addition & 1 deletion src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ LibraryManager.library = {
// In MINIMAL_RUNTIME the module object does not exist, so its behavior to abort is to throw directly.
throw 'abort';
#else
Module['abort']();
abort();
#endif
},

Expand Down
1 change: 1 addition & 0 deletions src/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ function exportRuntime() {
'getTempRet0',
'setTempRet0',
'callMain',
'abort',
];

if (!MINIMAL_RUNTIME) {
Expand Down
34 changes: 2 additions & 32 deletions src/postamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,44 +415,14 @@ function exit(status, implicit) {

exitRuntime();

#if expectToReceiveOnModule('onExit')
if (Module['onExit']) Module['onExit'](status);
#endif
}

quit_(status, new ExitStatus(status));
}

var abortDecorators = [];

function abort(what) {
if (Module['onAbort']) {
Module['onAbort'](what);
}

#if USE_PTHREADS
if (ENVIRONMENT_IS_PTHREAD) console.error('Pthread aborting at ' + new Error().stack);
#endif
what += '';
out(what);
err(what);

ABORT = true;
EXITSTATUS = 1;

#if ASSERTIONS == 0
throw 'abort(' + what + '). Build with -s ASSERTIONS=1 for more info.';
#else
var extra = '';
var output = 'abort(' + what + ') at ' + stackTrace() + extra;
if (abortDecorators) {
abortDecorators.forEach(function(decorator) {
output = decorator(output, what);
});
}
throw output;
#endif // ASSERTIONS
}
Module['abort'] = abort;

#if expectToReceiveOnModule('preInit')
if (Module['preInit']) {
if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
Expand Down
35 changes: 35 additions & 0 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,41 @@ Module["preloadedAudios"] = {}; // maps url to audio data
Module["preloadedWasm"] = {}; // maps url to wasm instance exports
#endif

#if EMTERPRETIFY_ASYNC && ASSERTIONS
var abortDecorators = [];
#endif

function abort(what) {
#if expectToReceiveOnModule('onAbort')
if (Module['onAbort']) {
Module['onAbort'](what);
}
#endif

#if USE_PTHREADS
if (ENVIRONMENT_IS_PTHREAD) console.error('Pthread aborting at ' + new Error().stack);
#endif
what += '';
out(what);
err(what);

ABORT = true;
EXITSTATUS = 1;

#if ASSERTIONS == 0
throw 'abort(' + what + '). Build with -s ASSERTIONS=1 for more info.';
#else
var extra = '';
var output = 'abort(' + what + ') at ' + stackTrace() + extra;
#if EMTERPRETIFY_ASYNC
abortDecorators.forEach(function(decorator) {
output = decorator(output, what);
});
#endif
throw output;
#endif // ASSERTIONS
}

#if RELOCATABLE
{{{
(function() {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4178,7 +4178,7 @@ def test_small_js_flags(self):
size = os.path.getsize('test.js')
print('size:', size)
# Note that this size includes test harness additions (for reporting the result, etc.).
self.assertLess(abs(size - 5754), 100)
self.assertLess(abs(size - 5692), 100)

# Tests that it is possible to initialize and render WebGL content in a pthread by using OffscreenCanvas.
# -DTEST_CHAINED_WEBGL_CONTEXT_PASSING: Tests that it is possible to transfer WebGL canvas in a chain from main thread -> thread 1 -> thread 2 and then init and render WebGL content there.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -9664,7 +9664,7 @@ def test(args):
# Changing this option to [] should decrease code size.
self.assertLess(changed, normal)
# Check an absolute code size as well, with some slack.
self.assertLess(abs(changed - 5905), 150)
self.assertLess(abs(changed - 5840), 150)

def test_llvm_includes(self):
self.build('#include <stdatomic.h>', self.get_dir(), 'atomics.c')
Expand Down