diff options
Diffstat (limited to 'src/postamble.js')
-rw-r--r-- | src/postamble.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/postamble.js b/src/postamble.js index 90a86474..603b330c 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -2,19 +2,21 @@ // === Auto-generated postamble setup entry stuff === if (memoryInitializer) { - function applyData(data) { + if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { + var data = Module['readBinary'](memoryInitializer); #if USE_TYPED_ARRAYS == 2 HEAPU8.set(data, STATIC_BASE); #else allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); #endif - } - if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { - applyData(Module['readBinary'](memoryInitializer)); } else { addRunDependency('memory initializer'); Browser.asyncLoad(memoryInitializer, function(data) { - applyData(data); +#if USE_TYPED_ARRAYS == 2 + HEAPU8.set(data, STATIC_BASE); +#else + allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); +#endif removeRunDependency('memory initializer'); }, function(data) { throw 'could not load memory initializer ' + memoryInitializer; @@ -179,7 +181,13 @@ function abort(text) { ABORT = true; EXITSTATUS = 1; - throw 'abort() at ' + stackTrace(); +#if ASSERTIONS == 0 + var extra = '\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.'; +#else + var extra = ''; +#endif + + throw 'abort() at ' + stackTrace() + extra; } Module['abort'] = Module.abort = abort; @@ -202,6 +210,10 @@ if (Module['noInitialRun']) { shouldRunNow = false; } +#if NO_EXIT_RUNTIME +Module["noExitRuntime"] = true; +#endif + run(); // {{POST_RUN_ADDITIONS}} |