summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-03 11:00:55 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-03 11:00:55 -0800
commita4c2588fd5144b0b8759865d42138e1f6bb228a9 (patch)
treefa9df94c66575e1625921c59e43d4e3f93b07030 /src
parent948f9255e2adac2b9e8b290742f06a515c14d043 (diff)
downloadbinaryen-a4c2588fd5144b0b8759865d42138e1f6bb228a9.tar.gz
binaryen-a4c2588fd5144b0b8759865d42138e1f6bb228a9.tar.bz2
binaryen-a4c2588fd5144b0b8759865d42138e1f6bb228a9.zip
add memorySize to Module
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);