summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm-main.cpp1
-rw-r--r--src/wasm-js.cpp1
-rw-r--r--src/wasm.h3
3 files changed, 4 insertions, 1 deletions
diff --git a/src/asm2wasm-main.cpp b/src/asm2wasm-main.cpp
index c09a2345b..1a338831c 100644
--- a/src/asm2wasm-main.cpp
+++ b/src/asm2wasm-main.cpp
@@ -52,6 +52,7 @@ int main(int argc, char **argv) {
if (debug) std::cerr << "wasming...\n";
Module wasm;
+ wasm.memorySize = 16*1024*1024; // we would normally receive this from the compiler
Asm2WasmBuilder asm2wasm(wasm);
asm2wasm.processAsm(asmjs);
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index dc385e5e3..ab0923fb8 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -53,6 +53,7 @@ extern "C" void EMSCRIPTEN_KEEPALIVE load_asm(char *input) {
Ref asmjs = builder.parseToplevel(input);
module = new Module();
+ module->memorySize = 16*1024*1024; // TODO: receive this from emscripten
if (debug) std::cerr << "wasming...\n";
asm2wasm = new Asm2WasmBuilder(*module);
diff --git a/src/wasm.h b/src/wasm.h
index 553bb8728..5193e1728 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -781,6 +781,7 @@ public:
std::vector<Export> exports;
Table table;
std::vector<Function*> functions;
+ size_t memorySize;
Module() {}
@@ -789,7 +790,7 @@ public:
printOpening(o, "module", true);
incIndent(o, indent);
doIndent(o, indent);
- printOpening(o, "memory") << " 16777216)\n"; // XXX
+ printOpening(o, "memory") << " " << module.memorySize << " " << module.memorySize << ")\n";
for (auto& curr : module.functionTypes) {
doIndent(o, indent);
curr.second->print(o, indent, true);