aboutsummaryrefslogtreecommitdiff
path: root/src/postamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/postamble.js')
-rw-r--r--src/postamble.js21
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 + ")";