From 021a2b85fb9264d9cb4a21c039682d1f0fddbd1c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 15 Oct 2018 16:07:24 -0700 Subject: Support 4GB Memories (#1702) This fixes asm2wasm parsing of the max to allow 4GB, and also changes the internal Memory::kMaxValue values to reflect that. We used to use kMaxValue to also represent "no limit", so I split that out into kUnlimitedValue. --- src/wasm/wasm-s-parser.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/wasm/wasm-s-parser.cpp') diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 7085666bb..ee37f23f3 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -1510,7 +1510,10 @@ void SExpressionWasmBuilder::stringToBinary(const char* input, size_t size, std: Index SExpressionWasmBuilder::parseMemoryLimits(Element& s, Index i) { wasm.memory.initial = getCheckedAddress(s[i++], "excessive memory init"); - if (i == s.size()) return i; + if (i == s.size()) { + wasm.memory.max = Memory::kUnlimitedSize; + return i; + } uint64_t max = atoll(s[i++]->c_str()); if (max > Memory::kMaxSize) throw ParseException("total memory must be <= 4GB"); wasm.memory.max = max; @@ -1764,7 +1767,7 @@ void SExpressionWasmBuilder::parseImport(Element& s) { if (j < inner.size() - 1) { wasm.table.max = getCheckedAddress(inner[j++], "excessive table max size"); } else { - wasm.table.max = Table::kMaxSize; + wasm.table.max = Table::kUnlimitedSize; } // ends with the table element type } else if (kind == ExternalKind::Memory) { -- cgit v1.2.3