diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 16:15:15 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-13 16:15:15 -0700 |
commit | 73579052dae38b12067b350be0a11a74090d0dfe (patch) | |
tree | c23d4dd6c83ed67c4878385460732f395646ec22 /src/postamble.js | |
parent | 1fc6762e3176843ffc378c8b4f43dd73fed25ebe (diff) |
refactor memory initializer code to use run dependenciesfailure
Diffstat (limited to 'src/postamble.js')
-rw-r--r-- | src/postamble.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/postamble.js b/src/postamble.js index 88986dea..8f585b86 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -1,6 +1,27 @@ // === Auto-generated postamble setup entry stuff === +if (memoryInitializer) { + function applyData(data) { +#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); + removeRunDependency('memory initializer'); + }, function(data) { + throw 'could not load memory initializer ' + memoryInitializer; + }); + } +} + function ExitStatus(status) { this.name = "ExitStatus"; this.message = "Program terminated with exit(" + status + ")"; |