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/tools | |
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/tools')
-rw-r--r-- | src/tools/asm2wasm.cpp | 8 | ||||
-rw-r--r-- | src/tools/fuzzing.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/asm2wasm.cpp b/src/tools/asm2wasm.cpp index 1cf7947ce..cc9464434 100644 --- a/src/tools/asm2wasm.cpp +++ b/src/tools/asm2wasm.cpp @@ -197,11 +197,11 @@ int main(int argc, const char *argv[]) { // Set the max memory size, if requested const auto &memMax = options.extra.find("mem max"); if (memMax != options.extra.end()) { - int max = atoi(memMax->second.c_str()); - if (max >= 0) { + uint64_t max = strtoull(memMax->second.c_str(), nullptr, 10); + if (max != uint64_t(-1)) { wasm.memory.max = max / Memory::kPageSize; } else { - wasm.memory.max = Memory::kMaxSize; + wasm.memory.max = Memory::kUnlimitedSize; } } // Set the table sizes, if requested @@ -211,7 +211,7 @@ int main(int argc, const char *argv[]) { if (max >= 0) { wasm.table.max = max; } else { - wasm.table.max = Table::kMaxSize; + wasm.table.max = Table::kUnlimitedSize; } } diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 062fc29a6..fe31290d6 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -268,7 +268,7 @@ private: void finalizeTable() { wasm.table.initial = wasm.table.segments[0].data.size(); - wasm.table.max = oneIn(2) ? Address(Table::kMaxSize) : wasm.table.initial; + wasm.table.max = oneIn(2) ? Address(Table::kUnlimitedSize) : wasm.table.initial; } const Name HANG_LIMIT_GLOBAL = "hangLimit"; |