summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp51
1 files changed, 1 insertions, 50 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 0184e3284..d1ca5220c 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -63,7 +63,6 @@ struct ValidationInfo {
bool validateWeb;
bool validateGlobally;
bool quiet;
- bool closedWorld;
std::atomic<bool> valid;
@@ -4135,46 +4134,6 @@ static void validateFeatures(Module& module, ValidationInfo& info) {
}
}
-static void validateClosedWorldInterface(Module& module, ValidationInfo& info) {
- // Error if there are any publicly exposed heap types beyond the types of
- // publicly exposed functions. Note that we must include all types in the rec
- // groups that are used, as if a type if public then all types in its rec
- // group are as well.
- std::unordered_set<RecGroup> publicRecGroups;
- ModuleUtils::iterImportedFunctions(module, [&](Function* func) {
- publicRecGroups.insert(func->type.getRecGroup());
- });
- for (auto& ex : module.exports) {
- if (ex->kind == ExternalKind::Function) {
- publicRecGroups.insert(module.getFunction(ex->value)->type.getRecGroup());
- }
- }
-
- std::unordered_set<HeapType> publicTypes;
- for (auto& group : publicRecGroups) {
- for (auto type : group) {
- publicTypes.insert(type);
- }
- }
-
- // 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 (!publicTypes.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();
- }
- info.fail("publicly exposed type disallowed with a closed world: $" +
- name,
- type,
- nullptr);
- }
- }
-}
-
// TODO: If we want the validator to be part of libwasm rather than libpasses,
// then Using PassRunner::getPassDebug causes a circular dependence. We should
// fix that, perhaps by moving some of the pass infrastructure into libsupport.
@@ -4183,7 +4142,6 @@ bool WasmValidator::validate(Module& module, Flags flags) {
info.validateWeb = (flags & Web) != 0;
info.validateGlobally = (flags & Globally) != 0;
info.quiet = (flags & Quiet) != 0;
- info.closedWorld = (flags & ClosedWorld) != 0;
// Parallel function validation.
PassRunner runner(&module);
@@ -4210,9 +4168,6 @@ bool WasmValidator::validate(Module& module, Flags flags) {
validateStart(module, info);
validateModuleMaps(module, info);
validateFeatures(module, info);
- if (info.closedWorld) {
- validateClosedWorldInterface(module, info);
- }
}
// Validate additional internal IR details when in pass-debug mode.
@@ -4231,11 +4186,7 @@ bool WasmValidator::validate(Module& module, Flags flags) {
}
bool WasmValidator::validate(Module& module, const PassOptions& options) {
- Flags flags = options.validateGlobally ? Globally : Minimal;
- if (options.closedWorld) {
- flags |= ClosedWorld;
- }
- return validate(module, flags);
+ return validate(module, options.validateGlobally ? Globally : Minimal);
}
bool WasmValidator::validate(Function* func, Module& module, Flags flags) {