diff options
-rw-r--r-- | src/asm2wasm-main.cpp | 1 | ||||
-rw-r--r-- | src/wasm-js.cpp | 1 | ||||
-rw-r--r-- | src/wasm.h | 3 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.wast | 2 | ||||
-rw-r--r-- | test/emcc_hello_world.wast | 2 | ||||
-rw-r--r-- | test/hello_world.wast | 2 | ||||
-rw-r--r-- | test/unit.wast | 2 |
7 files changed, 8 insertions, 5 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); diff --git a/test/emcc_O2_hello_world.wast b/test/emcc_O2_hello_world.wast index e9b95ce16..9aae649a1 100644 --- a/test/emcc_O2_hello_world.wast +++ b/test/emcc_O2_hello_world.wast @@ -1,5 +1,5 @@ (module - (memory 16777216) + (memory 16777216 16777216) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) diff --git a/test/emcc_hello_world.wast b/test/emcc_hello_world.wast index 96e96c614..6ed6b3d65 100644 --- a/test/emcc_hello_world.wast +++ b/test/emcc_hello_world.wast @@ -1,5 +1,5 @@ (module - (memory 16777216) + (memory 16777216 16777216) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) diff --git a/test/hello_world.wast b/test/hello_world.wast index e36b85c4a..1c8f9d359 100644 --- a/test/hello_world.wast +++ b/test/hello_world.wast @@ -1,5 +1,5 @@ (module - (memory 16777216) + (memory 16777216 16777216) (export "add" $add) (func $add (param $x i32) (param $y i32) (result i32) (i32.add diff --git a/test/unit.wast b/test/unit.wast index 4f68a6a33..e999c02a2 100644 --- a/test/unit.wast +++ b/test/unit.wast @@ -1,5 +1,5 @@ (module - (memory 16777216) + (memory 16777216 16777216) (export "big_negative" $big_negative) (table $z $big_negative $importedDoubles $z) (func $big_negative |