summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2024-11-07 15:53:01 -0800
committerGitHub <noreply@github.com>2024-11-07 23:53:01 +0000
commita3d940ff8020ad8adb525b4ab018fcd86d08c54a (patch)
tree35b5f3fada3b53f36c949825a288c3dec8884cd1 /src/wasm/wasm-validator.cpp
parent7a0e738e363d13880ec25018134e178d57c5ba6a (diff)
downloadbinaryen-a3d940ff8020ad8adb525b4ab018fcd86d08c54a.tar.gz
binaryen-a3d940ff8020ad8adb525b4ab018fcd86d08c54a.tar.bz2
binaryen-a3d940ff8020ad8adb525b4ab018fcd86d08c54a.zip
Rename indexType -> addressType. NFC (#7060)
See https://github.com/WebAssembly/memory64/pull/92
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp58
1 files changed, 30 insertions, 28 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 5867c04a0..339a3c7a1 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -993,7 +993,7 @@ void FunctionValidator::visitCallIndirect(CallIndirect* curr) {
if (shouldBeTrue(!!table, curr, "call-indirect table must exist")) {
shouldBeEqualOrFirstIsUnreachable(
curr->target->type,
- table->indexType,
+ table->addressType,
curr,
"call-indirect call target must match the table index type");
shouldBeTrue(!!table, curr, "call-indirect table must exist");
@@ -1095,7 +1095,7 @@ void FunctionValidator::visitLoad(Load* curr) {
validateAlignment(curr->align, curr->type, curr->bytes, curr->isAtomic, curr);
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"load pointer type must match memory index type");
if (curr->isAtomic) {
@@ -1128,7 +1128,7 @@ void FunctionValidator::visitStore(Store* curr) {
curr->align, curr->valueType, curr->bytes, curr->isAtomic, curr);
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"store pointer must match memory index type");
shouldBeUnequal(curr->value->type,
@@ -1152,7 +1152,7 @@ void FunctionValidator::visitAtomicRMW(AtomicRMW* curr) {
validateMemBytes(curr->bytes, curr->type, curr);
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"AtomicRMW pointer type must match memory index type");
shouldBeEqualOrFirstIsUnreachable(curr->type,
@@ -1172,7 +1172,7 @@ void FunctionValidator::visitAtomicCmpxchg(AtomicCmpxchg* curr) {
validateMemBytes(curr->bytes, curr->type, curr);
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"cmpxchg pointer must match memory index type");
if (curr->expected->type != Type::unreachable &&
@@ -1206,7 +1206,7 @@ void FunctionValidator::visitAtomicWait(AtomicWait* curr) {
curr->type, Type(Type::i32), curr, "AtomicWait must have type i32");
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"AtomicWait pointer must match memory index type");
shouldBeIntOrUnreachable(
@@ -1232,7 +1232,7 @@ void FunctionValidator::visitAtomicNotify(AtomicNotify* curr) {
curr->type, Type(Type::i32), curr, "AtomicNotify must have type i32");
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"AtomicNotify pointer must match memory index type");
shouldBeEqualOrFirstIsUnreachable(
@@ -1408,7 +1408,7 @@ void FunctionValidator::visitSIMDLoad(SIMDLoad* curr) {
curr->type, Type(Type::v128), curr, "load_splat must have type v128");
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"load_splat address must match memory index type");
Type memAlignType = Type::none;
@@ -1450,7 +1450,7 @@ void FunctionValidator::visitSIMDLoadStoreLane(SIMDLoadStoreLane* curr) {
}
shouldBeEqualOrFirstIsUnreachable(
curr->ptr->type,
- memory->indexType,
+ memory->addressType,
curr,
"loadX_lane or storeX_lane address must match memory index type");
shouldBeEqualOrFirstIsUnreachable(
@@ -1500,7 +1500,7 @@ void FunctionValidator::visitMemoryInit(MemoryInit* curr) {
curr->type, Type(Type::none), curr, "memory.init must have type none");
shouldBeEqualOrFirstIsUnreachable(
curr->dest->type,
- memory->indexType,
+ memory->addressType,
curr,
"memory.init dest must match memory index type");
shouldBeEqualOrFirstIsUnreachable(curr->offset->type,
@@ -1542,22 +1542,22 @@ void FunctionValidator::visitMemoryCopy(MemoryCopy* curr) {
shouldBeTrue(!!sourceMemory, curr, "memory.copy sourceMemory must exist");
shouldBeEqualOrFirstIsUnreachable(
curr->dest->type,
- destMemory->indexType,
+ destMemory->addressType,
curr,
"memory.copy dest must match destMemory index type");
shouldBeEqualOrFirstIsUnreachable(
curr->source->type,
- sourceMemory->indexType,
+ sourceMemory->addressType,
curr,
"memory.copy source must match sourceMemory index type");
shouldBeEqualOrFirstIsUnreachable(
curr->size->type,
- destMemory->indexType,
+ destMemory->addressType,
curr,
"memory.copy size must match destMemory index type");
shouldBeEqualOrFirstIsUnreachable(
curr->size->type,
- sourceMemory->indexType,
+ sourceMemory->addressType,
curr,
"memory.copy size must match destMemory index type");
}
@@ -1572,7 +1572,7 @@ void FunctionValidator::visitMemoryFill(MemoryFill* curr) {
curr->type, Type(Type::none), curr, "memory.fill must have type none");
shouldBeEqualOrFirstIsUnreachable(
curr->dest->type,
- memory->indexType,
+ memory->addressType,
curr,
"memory.fill dest must match memory index type");
shouldBeEqualOrFirstIsUnreachable(curr->value->type,
@@ -1581,7 +1581,7 @@ void FunctionValidator::visitMemoryFill(MemoryFill* curr) {
"memory.fill value must be an i32");
shouldBeEqualOrFirstIsUnreachable(
curr->size->type,
- memory->indexType,
+ memory->addressType,
curr,
"memory.fill size must match memory index type");
shouldBeTrue(!!memory, curr, "memory.fill memory must exist");
@@ -2257,7 +2257,7 @@ void FunctionValidator::visitMemoryGrow(MemoryGrow* curr) {
auto* memory = getModule()->getMemoryOrNull(curr->memory);
shouldBeTrue(!!memory, curr, "memory.grow memory must exist");
shouldBeEqualOrFirstIsUnreachable(curr->delta->type,
- memory->indexType,
+ memory->addressType,
curr,
"memory.grow must match memory index type");
}
@@ -2399,7 +2399,7 @@ void FunctionValidator::visitTableGet(TableGet* curr) {
}
shouldBeEqualOrFirstIsUnreachable(
curr->index->type,
- table->indexType,
+ table->addressType,
curr,
"table.get index must match the table index type.");
}
@@ -2419,7 +2419,7 @@ void FunctionValidator::visitTableSet(TableSet* curr) {
}
shouldBeEqualOrFirstIsUnreachable(
curr->index->type,
- table->indexType,
+ table->addressType,
curr,
"table.set index must match the table index type.");
}
@@ -2447,7 +2447,7 @@ void FunctionValidator::visitTableGrow(TableGrow* curr) {
curr,
"table.grow value must have right type");
shouldBeEqual(curr->delta->type,
- table->indexType,
+ table->addressType,
curr,
"table.grow must match table index type");
}
@@ -2467,12 +2467,12 @@ void FunctionValidator::visitTableFill(TableFill* curr) {
"table.fill value must have right type");
shouldBeEqualOrFirstIsUnreachable(
curr->dest->type,
- table->indexType,
+ table->addressType,
curr,
"table.fill dest must match table index type");
shouldBeEqualOrFirstIsUnreachable(
curr->size->type,
- table->indexType,
+ table->addressType,
curr,
"table.fill size must match table index type");
}
@@ -2492,11 +2492,11 @@ void FunctionValidator::visitTableCopy(TableCopy* curr) {
"table.copy source must have right type for dest");
}
shouldBeEqualOrFirstIsUnreachable(curr->dest->type,
- destTable->indexType,
+ destTable->addressType,
curr,
"table.copy dest must be valid");
shouldBeEqualOrFirstIsUnreachable(curr->source->type,
- sourceTable->indexType,
+ sourceTable->addressType,
curr,
"table.copy source must be valid");
Type sizeType =
@@ -2518,8 +2518,10 @@ void FunctionValidator::visitTableInit(TableInit* curr) {
curr,
"table.init source must have right type for dest");
}
- shouldBeEqualOrFirstIsUnreachable(
- curr->dest->type, table->indexType, curr, "table.init dest must be valid");
+ shouldBeEqualOrFirstIsUnreachable(curr->dest->type,
+ table->addressType,
+ curr,
+ "table.init dest must be valid");
shouldBeEqualOrFirstIsUnreachable(curr->offset->type,
Type(Type::i32),
curr,
@@ -3905,7 +3907,7 @@ static void validateDataSegments(Module& module, ValidationInfo& info) {
continue;
}
info.shouldBeEqual(segment->offset->type,
- memory->indexType,
+ memory->addressType,
segment->offset,
"segment offset must match memory index type");
info.shouldBeTrue(
@@ -4000,7 +4002,7 @@ static void validateTables(Module& module, ValidationInfo& info) {
info.shouldBeTrue(
!!segment->offset, "elem", "table segment offset must have an offset");
info.shouldBeEqual(segment->offset->type,
- table->indexType,
+ table->addressType,
segment->offset,
"element segment offset must match table index type");
info.shouldBeTrue(