diff options
Diffstat (limited to 'src/ir')
-rw-r--r-- | src/ir/ReFinalize.cpp | 2 | ||||
-rw-r--r-- | src/ir/import-utils.h | 18 | ||||
-rw-r--r-- | src/ir/module-splitting.cpp | 14 | ||||
-rw-r--r-- | src/ir/module-utils.h | 28 | ||||
-rw-r--r-- | src/ir/names.h | 4 | ||||
-rw-r--r-- | src/ir/utils.h | 4 |
6 files changed, 34 insertions, 36 deletions
diff --git a/src/ir/ReFinalize.cpp b/src/ir/ReFinalize.cpp index b024c94be..6f1a22095 100644 --- a/src/ir/ReFinalize.cpp +++ b/src/ir/ReFinalize.cpp @@ -184,7 +184,7 @@ void ReFinalize::visitElementSegment(ElementSegment* curr) { WASM_UNREACHABLE("unimp"); } void ReFinalize::visitMemory(Memory* curr) { WASM_UNREACHABLE("unimp"); } -void ReFinalize::visitEvent(Event* curr) { WASM_UNREACHABLE("unimp"); } +void ReFinalize::visitTag(Tag* curr) { WASM_UNREACHABLE("unimp"); } void ReFinalize::visitModule(Module* curr) { WASM_UNREACHABLE("unimp"); } void ReFinalize::updateBreakValueType(Name name, Type type) { diff --git a/src/ir/import-utils.h b/src/ir/import-utils.h index e4a656379..2e7a4f44c 100644 --- a/src/ir/import-utils.h +++ b/src/ir/import-utils.h @@ -30,7 +30,7 @@ struct ImportInfo { std::vector<Global*> importedGlobals; std::vector<Function*> importedFunctions; std::vector<Table*> importedTables; - std::vector<Event*> importedEvents; + std::vector<Tag*> importedTags; ImportInfo(Module& wasm) : wasm(wasm) { for (auto& import : wasm.globals) { @@ -48,9 +48,9 @@ struct ImportInfo { importedTables.push_back(import.get()); } } - for (auto& import : wasm.events) { + for (auto& import : wasm.tags) { if (import->imported()) { - importedEvents.push_back(import.get()); + importedTags.push_back(import.get()); } } } @@ -73,8 +73,8 @@ struct ImportInfo { return nullptr; } - Event* getImportedEvent(Name module, Name base) { - for (auto* import : importedEvents) { + Tag* getImportedTag(Name module, Name base) { + for (auto* import : importedTags) { if (import->module == module && import->base == base) { return import; } @@ -88,11 +88,11 @@ struct ImportInfo { Index getNumImportedTables() { return importedTables.size(); } - Index getNumImportedEvents() { return importedEvents.size(); } + Index getNumImportedTags() { return importedTags.size(); } Index getNumImports() { return getNumImportedGlobals() + getNumImportedFunctions() + - getNumImportedEvents() + (wasm.memory.imported() ? 1 : 0) + + getNumImportedTags() + (wasm.memory.imported() ? 1 : 0) + getNumImportedTables(); } @@ -108,9 +108,7 @@ struct ImportInfo { return wasm.tables.size() - getNumImportedTables(); } - Index getNumDefinedEvents() { - return wasm.events.size() - getNumImportedEvents(); - } + Index getNumDefinedTags() { return wasm.tags.size() - getNumImportedTags(); } }; } // namespace wasm diff --git a/src/ir/module-splitting.cpp b/src/ir/module-splitting.cpp index 9c5c66641..8ad501fe1 100644 --- a/src/ir/module-splitting.cpp +++ b/src/ir/module-splitting.cpp @@ -18,7 +18,7 @@ // // 1. Create the new secondary module. // -// 2. Export globals, events, tables, and memories from the primary module and +// 2. Export globals, tags, tables, and memories from the primary module and // import them in the secondary module. // // 3. Move the deferred functions from the primary to the secondary module. @@ -648,12 +648,12 @@ void ModuleSplitter::shareImportableItems() { secondary.addGlobal(std::move(secondaryGlobal)); } - for (auto& event : primary.events) { - auto secondaryEvent = std::make_unique<Event>(); - secondaryEvent->attribute = event->attribute; - secondaryEvent->sig = event->sig; - makeImportExport(*event, *secondaryEvent, "event", ExternalKind::Event); - secondary.addEvent(std::move(secondaryEvent)); + for (auto& tag : primary.tags) { + auto secondaryTag = std::make_unique<Tag>(); + secondaryTag->attribute = tag->attribute; + secondaryTag->sig = tag->sig; + makeImportExport(*tag, *secondaryTag, "tag", ExternalKind::Tag); + secondary.addTag(std::move(secondaryTag)); } } diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h index aaf484036..c93b24293 100644 --- a/src/ir/module-utils.h +++ b/src/ir/module-utils.h @@ -63,12 +63,12 @@ inline Global* copyGlobal(Global* global, Module& out) { return ret; } -inline Event* copyEvent(Event* event, Module& out) { - auto* ret = new Event(); - ret->name = event->name; - ret->attribute = event->attribute; - ret->sig = event->sig; - out.addEvent(ret); +inline Tag* copyTag(Tag* tag, Module& out) { + auto* ret = new Tag(); + ret->name = tag->name; + ret->attribute = tag->attribute; + ret->sig = tag->sig; + out.addTag(ret); return ret; } @@ -120,8 +120,8 @@ inline void copyModule(const Module& in, Module& out) { for (auto& curr : in.globals) { copyGlobal(curr.get(), out); } - for (auto& curr : in.events) { - copyEvent(curr.get(), out); + for (auto& curr : in.tags) { + copyTag(curr.get(), out); } for (auto& curr : in.elementSegments) { copyElementSegment(curr.get(), out); @@ -278,16 +278,16 @@ template<typename T> inline void iterDefinedFunctions(Module& wasm, T visitor) { } } -template<typename T> inline void iterImportedEvents(Module& wasm, T visitor) { - for (auto& import : wasm.events) { +template<typename T> inline void iterImportedTags(Module& wasm, T visitor) { + for (auto& import : wasm.tags) { if (import->imported()) { visitor(import.get()); } } } -template<typename T> inline void iterDefinedEvents(Module& wasm, T visitor) { - for (auto& import : wasm.events) { +template<typename T> inline void iterDefinedTags(Module& wasm, T visitor) { + for (auto& import : wasm.tags) { if (!import->imported()) { visitor(import.get()); } @@ -299,7 +299,7 @@ template<typename T> inline void iterImports(Module& wasm, T visitor) { iterImportedTables(wasm, visitor); iterImportedGlobals(wasm, visitor); iterImportedFunctions(wasm, visitor); - iterImportedEvents(wasm, visitor); + iterImportedTags(wasm, visitor); } // Helper class for performing an operation on all the functions in the module, @@ -514,7 +514,7 @@ inline void collectHeapTypes(Module& wasm, // Collect module-level info. Counts counts; CodeScanner(counts).walkModuleCode(&wasm); - for (auto& curr : wasm.events) { + for (auto& curr : wasm.tags) { counts.note(curr->sig); } for (auto& curr : wasm.tables) { diff --git a/src/ir/names.h b/src/ir/names.h index 46cb239ef..5fe77dd2b 100644 --- a/src/ir/names.h +++ b/src/ir/names.h @@ -78,9 +78,9 @@ inline Name getValidTableName(Module& module, Name root) { return getValidName(root, [&](Name test) { return !module.getTableOrNull(test); }); } -inline Name getValidEventName(Module& module, Name root) { +inline Name getValidTagName(Module& module, Name root) { return getValidName(root, - [&](Name test) { return !module.getEventOrNull(test); }); + [&](Name test) { return !module.getTagOrNull(test); }); } inline Name getValidElementSegmentName(Module& module, Name root) { return getValidName( diff --git a/src/ir/utils.h b/src/ir/utils.h index 40f5aeb9a..78b546962 100644 --- a/src/ir/utils.h +++ b/src/ir/utils.h @@ -122,7 +122,7 @@ struct ReFinalize void visitTable(Table* curr); void visitElementSegment(ElementSegment* curr); void visitMemory(Memory* curr); - void visitEvent(Event* curr); + void visitTag(Tag* curr); void visitModule(Module* curr); private: @@ -146,7 +146,7 @@ struct ReFinalizeNode : public OverriddenVisitor<ReFinalizeNode> { void visitTable(Table* curr) { WASM_UNREACHABLE("unimp"); } void visitElementSegment(ElementSegment* curr) { WASM_UNREACHABLE("unimp"); } void visitMemory(Memory* curr) { WASM_UNREACHABLE("unimp"); } - void visitEvent(Event* curr) { WASM_UNREACHABLE("unimp"); } + void visitTag(Tag* curr) { WASM_UNREACHABLE("unimp"); } void visitModule(Module* curr) { WASM_UNREACHABLE("unimp"); } // given a stack of nested expressions, update them all from child to parent |