summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/wasm-type.cpp23
-rw-r--r--src/wasm/wasm-validator.cpp6
2 files changed, 28 insertions, 1 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index ba38231b6..4ce72582c 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -2580,6 +2580,29 @@ void TypeBuilder::dump() {
}
}
+std::unordered_set<HeapType> getIgnorablePublicTypes() {
+ auto array8 = Array(Field(Field::i8, Mutable));
+ auto array16 = Array(Field(Field::i16, Mutable));
+ TypeBuilder builder(4);
+ // We handle final and non-final here, but should remove one of them
+ // eventually TODO
+ builder[0] = array8;
+ builder[0].setOpen(false);
+ builder[1] = array16;
+ builder[1].setOpen(false);
+ builder[2] = array8;
+ builder[2].setOpen(true);
+ builder[3] = array16;
+ builder[3].setOpen(true);
+ auto result = builder.build();
+ assert(result);
+ std::unordered_set<HeapType> ret;
+ for (auto type : *result) {
+ ret.insert(type);
+ }
+ return ret;
+}
+
} // namespace wasm
namespace std {
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 2d00c4b67..3baaacb16 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -3726,8 +3726,12 @@ static void validateClosedWorldInterface(Module& module, ValidationInfo& info) {
}
}
+ // Ignorable public types are public, but we can ignore them for purposes of
+ // erroring here: It is always ok that they are public.
+ auto ignorable = getIgnorablePublicTypes();
+
for (auto type : ModuleUtils::getPublicHeapTypes(module)) {
- if (!publicFuncTypes.count(type)) {
+ if (!publicFuncTypes.count(type) && !ignorable.count(type)) {
auto name = type.toString();
if (auto it = module.typeNames.find(type); it != module.typeNames.end()) {
name = it->second.name.toString();