Skip to content

Commit a958e7b

Browse files
wip
1 parent 93bc8d9 commit a958e7b

File tree

4 files changed

+13
-270
lines changed

4 files changed

+13
-270
lines changed

src/passes/Print.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3940,4 +3940,10 @@ std::ostream& operator<<(std::ostream& o, wasm::ModuleHeapType pair) {
39403940
return o << "(unnamed)";
39413941
}
39423942

3943+
std::ostream& operator<<(std::ostream& o, wasm::Memory& memory) {
3944+
wasm::PrintSExpression printer(o);
3945+
printer.visitMemory(&memory);
3946+
return o;
3947+
}
3948+
39433949
} // namespace std

src/wasm-interpreter.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,7 +3275,8 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
32753275
};
32763276

32773277
// Trap if types don't match between all imports and their corresponding
3278-
// exports. Imported memories must also be a subtype of their export.
3278+
// exports. Imported memories and tables must also be a subtype of their
3279+
// export.
32793280
void validateImports() {
32803281
ModuleUtils::iterImportable(
32813282
wasm,
@@ -3311,7 +3312,10 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
33113312
Memory* exportedMemory =
33123313
importedInstance->wasm.getMemory(*export_->getInternalName());
33133314
if (!(*memory)->isSubType(*exportedMemory)) {
3314-
trap("Imported memory isn't compatible");
3315+
trap((std::stringstream()
3316+
<< "Imported memory isn't compatible. Imported memory: "
3317+
<< **memory << ". Exported memory: " << *exportedMemory)
3318+
.str());
33153319
}
33163320
}
33173321

src/wasm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,6 +2692,7 @@ std::ostream& operator<<(std::ostream& o, wasm::ModuleExpression pair);
26922692
std::ostream& operator<<(std::ostream& o, wasm::ShallowExpression expression);
26932693
std::ostream& operator<<(std::ostream& o, wasm::ModuleType pair);
26942694
std::ostream& operator<<(std::ostream& o, wasm::ModuleHeapType pair);
2695+
std::ostream& operator<<(std::ostream& o, wasm::Memory& memory);
26952696

26962697
} // namespace std
26972698

test/spec/exact-func-import.wast

Lines changed: 0 additions & 268 deletions
This file was deleted.

0 commit comments

Comments
 (0)