From 28e88b9f993a2e45662fde0b10920aa22e7b1b7f Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Fri, 18 Jun 2021 14:20:03 -0700 Subject: [EH] Replace event with tag (#3937) We recently decided to change 'event' to 'tag', and to 'event section' to 'tag section', out of the rationale that the section contains a generalized tag that references a type, which may be used for something other than exceptions, and the name 'event' can be confusing in the web context. See - https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130 - https://github.com/WebAssembly/exception-handling/pull/161 --- src/passes/RemoveUnusedModuleElements.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/passes/RemoveUnusedModuleElements.cpp') diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp index a26fd5d45..2b460a0fd 100644 --- a/src/passes/RemoveUnusedModuleElements.cpp +++ b/src/passes/RemoveUnusedModuleElements.cpp @@ -16,7 +16,7 @@ // // Removes module elements that are are never used: functions, globals, and -// events, which may be imported or not, and function types (which we merge and +// tags, which may be imported or not, and function types (which we merge and // remove if unneeded) // @@ -30,7 +30,7 @@ namespace wasm { -enum class ModuleElementKind { Function, Global, Event, Table, ElementSegment }; +enum class ModuleElementKind { Function, Global, Tag, Table, ElementSegment }; typedef std::pair ModuleElement; @@ -129,11 +129,11 @@ struct ReachabilityAnalyzer : public PostWalker { maybeAdd(ModuleElement(ModuleElementKind::Function, curr->func)); } void visitThrow(Throw* curr) { - maybeAdd(ModuleElement(ModuleElementKind::Event, curr->event)); + maybeAdd(ModuleElement(ModuleElementKind::Tag, curr->tag)); } void visitTry(Try* curr) { - for (auto event : curr->catchEvents) { - maybeAdd(ModuleElement(ModuleElementKind::Event, event)); + for (auto tag : curr->catchTags) { + maybeAdd(ModuleElement(ModuleElementKind::Tag, tag)); } } }; @@ -176,8 +176,8 @@ struct RemoveUnusedModuleElements : public Pass { roots.emplace_back(ModuleElementKind::Function, curr->value); } else if (curr->kind == ExternalKind::Global) { roots.emplace_back(ModuleElementKind::Global, curr->value); - } else if (curr->kind == ExternalKind::Event) { - roots.emplace_back(ModuleElementKind::Event, curr->value); + } else if (curr->kind == ExternalKind::Tag) { + roots.emplace_back(ModuleElementKind::Tag, curr->value); } else if (curr->kind == ExternalKind::Table) { roots.emplace_back(ModuleElementKind::Table, curr->value); ModuleUtils::iterTableSegments( @@ -209,9 +209,9 @@ struct RemoveUnusedModuleElements : public Pass { return analyzer.reachable.count( ModuleElement(ModuleElementKind::Global, curr->name)) == 0; }); - module->removeEvents([&](Event* curr) { + module->removeTags([&](Tag* curr) { return analyzer.reachable.count( - ModuleElement(ModuleElementKind::Event, curr->name)) == 0; + ModuleElement(ModuleElementKind::Tag, curr->name)) == 0; }); module->removeElementSegments([&](ElementSegment* curr) { return curr->data.empty() || -- cgit v1.2.3