summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm-features.h1
-rw-r--r--src/wasm/wasm-validator.cpp6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm-features.h b/src/wasm-features.h
index 6e74e0b29..a2bb52971 100644
--- a/src/wasm-features.h
+++ b/src/wasm-features.h
@@ -91,6 +91,7 @@ struct FeatureSet {
bool hasReferenceTypes() const { return (features & ReferenceTypes) != 0; }
bool hasMultivalue() const { return (features & Multivalue) != 0; }
bool hasGC() const { return (features & GC) != 0; }
+ bool hasMemory64() const { return (features & Memory64) != 0; }
bool hasAll() const { return (features & All) != 0; }
void makeMVP() { features = MVP; }
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 96871ad8e..644358c04 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -2519,7 +2519,11 @@ static void validateMemory(Module& module, ValidationInfo& info) {
auto& curr = module.memory;
info.shouldBeFalse(
curr.initial > curr.max, "memory", "memory max >= initial");
- if (!curr.is64()) {
+ if (curr.is64()) {
+ info.shouldBeTrue(module.features.hasMemory64(),
+ "memory",
+ "memory is 64-bit, but memory64 is disabled");
+ } else {
info.shouldBeTrue(curr.initial <= Memory::kMaxSize32,
"memory",
"initial memory must be <= 4GB");