diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-10-15 16:07:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 16:07:24 -0700 |
commit | 021a2b85fb9264d9cb4a21c039682d1f0fddbd1c (patch) | |
tree | 96f39abb25e77769b337aa3d7858c4722c6ba1b4 /src/wasm/wasm-s-parser.cpp | |
parent | 66dbc57d32bb2c8c01deefba7a035ebed5a42e2c (diff) | |
download | binaryen-021a2b85fb9264d9cb4a21c039682d1f0fddbd1c.tar.gz binaryen-021a2b85fb9264d9cb4a21c039682d1f0fddbd1c.tar.bz2 binaryen-021a2b85fb9264d9cb4a21c039682d1f0fddbd1c.zip |
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.
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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) { |