summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-07-09 11:02:45 -0700
committerGitHub <noreply@github.com>2021-07-09 11:02:45 -0700
commitf77e8ddc8c0da06cc0cd2c063237660e8ec4020b (patch)
tree9a50adc8cc905a2193d9f9fd04447110870b082a /src
parenta533488572de0c8916add42b01530f0244ca4623 (diff)
downloadbinaryen-f77e8ddc8c0da06cc0cd2c063237660e8ec4020b.tar.gz
binaryen-f77e8ddc8c0da06cc0cd2c063237660e8ec4020b.tar.bz2
binaryen-f77e8ddc8c0da06cc0cd2c063237660e8ec4020b.zip
[Memory64] further memory limit fixes (#3865)
That were somehow missed.. triggered by emscripten tests
Diffstat (limited to 'src')
-rw-r--r--src/passes/Memory64Lowering.cpp3
-rw-r--r--src/wasm/wasm-binary.cpp13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/passes/Memory64Lowering.cpp b/src/passes/Memory64Lowering.cpp
index 5e1004797..c376ed6c6 100644
--- a/src/passes/Memory64Lowering.cpp
+++ b/src/passes/Memory64Lowering.cpp
@@ -98,6 +98,9 @@ struct Memory64Lowering : public WalkerPass<PostWalker<Memory64Lowering>> {
}
// This is visited last.
memory->indexType = Type::i32;
+ if (memory->hasMax() && memory->max > Memory::kMaxSize32) {
+ memory->max = Memory::kMaxSize32;
+ }
}
};
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 0b3ed0b53..43ab509a8 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -107,9 +107,16 @@ void WasmBinaryWriter::writeResizableLimits(
(shared ? (uint32_t)BinaryConsts::IsShared : 0U) |
(is64 ? (uint32_t)BinaryConsts::Is64 : 0U);
o << U32LEB(flags);
- o << U32LEB(initial);
- if (hasMaximum) {
- o << U32LEB(maximum);
+ if (is64) {
+ o << U64LEB(initial);
+ if (hasMaximum) {
+ o << U64LEB(maximum);
+ }
+ } else {
+ o << U32LEB(initial);
+ if (hasMaximum) {
+ o << U32LEB(maximum);
+ }
}
}