diff options
author | Heejin Ahn <aheejin@gmail.com> | 2021-06-15 01:49:43 -0700 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2021-06-17 20:34:19 -0700 |
commit | 1d891d44f33f99c55e779acaeac4628e4ac9aaaf (patch) | |
tree | ed05e40d4fa4c7001f0da4a088f6e8fc54091091 /llvm/lib/ObjectYAML | |
parent | 6aaf4fa2885600b0e31042071ad06f78218ab0f2 (diff) | |
download | llvm-1d891d44f33f99c55e779acaeac4628e4ac9aaaf.zip llvm-1d891d44f33f99c55e779acaeac4628e4ac9aaaf.tar.gz llvm-1d891d44f33f99c55e779acaeac4628e4ac9aaaf.tar.bz2 |
[WebAssembly] Rename event to tag
We recently decided to change 'event' to 'tag', and '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
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D104423
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r-- | llvm/lib/ObjectYAML/WasmEmitter.cpp | 32 | ||||
-rw-r--r-- | llvm/lib/ObjectYAML/WasmYAML.cpp | 34 |
2 files changed, 33 insertions, 33 deletions
diff --git a/llvm/lib/ObjectYAML/WasmEmitter.cpp b/llvm/lib/ObjectYAML/WasmEmitter.cpp index acc5dff..888ba11 100644 --- a/llvm/lib/ObjectYAML/WasmEmitter.cpp +++ b/llvm/lib/ObjectYAML/WasmEmitter.cpp @@ -41,7 +41,7 @@ private: void writeSectionContent(raw_ostream &OS, WasmYAML::FunctionSection &Section); void writeSectionContent(raw_ostream &OS, WasmYAML::TableSection &Section); void writeSectionContent(raw_ostream &OS, WasmYAML::MemorySection &Section); - void writeSectionContent(raw_ostream &OS, WasmYAML::EventSection &Section); + void writeSectionContent(raw_ostream &OS, WasmYAML::TagSection &Section); void writeSectionContent(raw_ostream &OS, WasmYAML::GlobalSection &Section); void writeSectionContent(raw_ostream &OS, WasmYAML::ExportSection &Section); void writeSectionContent(raw_ostream &OS, WasmYAML::StartSection &Section); @@ -61,7 +61,7 @@ private: uint32_t NumImportedFunctions = 0; uint32_t NumImportedGlobals = 0; uint32_t NumImportedTables = 0; - uint32_t NumImportedEvents = 0; + uint32_t NumImportedTags = 0; bool HasError = false; yaml::ErrorHandler ErrHandler; @@ -189,7 +189,7 @@ void WasmWriter::writeSectionContent(raw_ostream &OS, case wasm::WASM_SYMBOL_TYPE_FUNCTION: case wasm::WASM_SYMBOL_TYPE_GLOBAL: case wasm::WASM_SYMBOL_TYPE_TABLE: - case wasm::WASM_SYMBOL_TYPE_EVENT: + case wasm::WASM_SYMBOL_TYPE_TAG: encodeULEB128(Info.ElementIndex, SubSection.getStream()); if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 || (Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0) @@ -385,10 +385,10 @@ void WasmWriter::writeSectionContent(raw_ostream &OS, writeUint8(OS, Import.GlobalImport.Mutable); NumImportedGlobals++; break; - case wasm::WASM_EXTERNAL_EVENT: - writeUint32(OS, Import.EventImport.Attribute); - writeUint32(OS, Import.EventImport.SigIndex); - NumImportedEvents++; + case wasm::WASM_EXTERNAL_TAG: + writeUint32(OS, Import.TagImport.Attribute); + writeUint32(OS, Import.TagImport.SigIndex); + NumImportedTags++; break; case wasm::WASM_EXTERNAL_MEMORY: writeLimits(Import.Memory, OS); @@ -450,17 +450,17 @@ void WasmWriter::writeSectionContent(raw_ostream &OS, } void WasmWriter::writeSectionContent(raw_ostream &OS, - WasmYAML::EventSection &Section) { - encodeULEB128(Section.Events.size(), OS); - uint32_t ExpectedIndex = NumImportedEvents; - for (auto &Event : Section.Events) { - if (Event.Index != ExpectedIndex) { - reportError("unexpected event index: " + Twine(Event.Index)); + WasmYAML::TagSection &Section) { + encodeULEB128(Section.Tags.size(), OS); + uint32_t ExpectedIndex = NumImportedTags; + for (auto &Tag : Section.Tags) { + if (Tag.Index != ExpectedIndex) { + reportError("unexpected tag index: " + Twine(Tag.Index)); return; } ++ExpectedIndex; - encodeULEB128(Event.Attribute, OS); - encodeULEB128(Event.SigIndex, OS); + encodeULEB128(Tag.Attribute, OS); + encodeULEB128(Tag.SigIndex, OS); } } @@ -626,7 +626,7 @@ bool WasmWriter::writeWasm(raw_ostream &OS) { writeSectionContent(StringStream, *S); else if (auto S = dyn_cast<WasmYAML::MemorySection>(Sec.get())) writeSectionContent(StringStream, *S); - else if (auto S = dyn_cast<WasmYAML::EventSection>(Sec.get())) + else if (auto S = dyn_cast<WasmYAML::TagSection>(Sec.get())) writeSectionContent(StringStream, *S); else if (auto S = dyn_cast<WasmYAML::GlobalSection>(Sec.get())) writeSectionContent(StringStream, *S); diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp index 6b7357c..752654d 100644 --- a/llvm/lib/ObjectYAML/WasmYAML.cpp +++ b/llvm/lib/ObjectYAML/WasmYAML.cpp @@ -120,9 +120,9 @@ static void sectionMapping(IO &IO, WasmYAML::MemorySection &Section) { IO.mapOptional("Memories", Section.Memories); } -static void sectionMapping(IO &IO, WasmYAML::EventSection &Section) { +static void sectionMapping(IO &IO, WasmYAML::TagSection &Section) { commonSectionMapping(IO, Section); - IO.mapOptional("Events", Section.Events); + IO.mapOptional("Tags", Section.Tags); } static void sectionMapping(IO &IO, WasmYAML::GlobalSection &Section) { @@ -229,10 +229,10 @@ void MappingTraits<std::unique_ptr<WasmYAML::Section>>::mapping( Section.reset(new WasmYAML::MemorySection()); sectionMapping(IO, *cast<WasmYAML::MemorySection>(Section.get())); break; - case wasm::WASM_SEC_EVENT: + case wasm::WASM_SEC_TAG: if (!IO.outputting()) - Section.reset(new WasmYAML::EventSection()); - sectionMapping(IO, *cast<WasmYAML::EventSection>(Section.get())); + Section.reset(new WasmYAML::TagSection()); + sectionMapping(IO, *cast<WasmYAML::TagSection>(Section.get())); break; case wasm::WASM_SEC_GLOBAL: if (!IO.outputting()) @@ -284,7 +284,7 @@ void ScalarEnumerationTraits<WasmYAML::SectionType>::enumeration( ECase(TABLE); ECase(MEMORY); ECase(GLOBAL); - ECase(EVENT); + ECase(TAG); ECase(EXPORT); ECase(START); ECase(ELEM); @@ -396,9 +396,9 @@ void MappingTraits<WasmYAML::Import>::mapping(IO &IO, } else if (Import.Kind == wasm::WASM_EXTERNAL_GLOBAL) { IO.mapRequired("GlobalType", Import.GlobalImport.Type); IO.mapRequired("GlobalMutable", Import.GlobalImport.Mutable); - } else if (Import.Kind == wasm::WASM_EXTERNAL_EVENT) { - IO.mapRequired("EventAttribute", Import.EventImport.Attribute); - IO.mapRequired("EventSigIndex", Import.EventImport.SigIndex); + } else if (Import.Kind == wasm::WASM_EXTERNAL_TAG) { + IO.mapRequired("TagAttribute", Import.TagImport.Attribute); + IO.mapRequired("TagSigIndex", Import.TagImport.SigIndex); } else if (Import.Kind == wasm::WASM_EXTERNAL_TABLE) { IO.mapRequired("Table", Import.TableImport); } else if (Import.Kind == wasm::WASM_EXTERNAL_MEMORY) { @@ -510,8 +510,8 @@ void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO, IO.mapRequired("Global", Info.ElementIndex); } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TABLE) { IO.mapRequired("Table", Info.ElementIndex); - } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_EVENT) { - IO.mapRequired("Event", Info.ElementIndex); + } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_TAG) { + IO.mapRequired("Tag", Info.ElementIndex); } else if (Info.Kind == wasm::WASM_SYMBOL_TYPE_DATA) { if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0) { IO.mapRequired("Segment", Info.DataRef.Segment); @@ -525,10 +525,10 @@ void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO, } } -void MappingTraits<WasmYAML::Event>::mapping(IO &IO, WasmYAML::Event &Event) { - IO.mapRequired("Index", Event.Index); - IO.mapRequired("Attribute", Event.Attribute); - IO.mapRequired("SigIndex", Event.SigIndex); +void MappingTraits<WasmYAML::Tag>::mapping(IO &IO, WasmYAML::Tag &Tag) { + IO.mapRequired("Index", Tag.Index); + IO.mapRequired("Attribute", Tag.Attribute); + IO.mapRequired("SigIndex", Tag.SigIndex); } void ScalarBitSetTraits<WasmYAML::LimitFlags>::bitset( @@ -572,7 +572,7 @@ void ScalarEnumerationTraits<WasmYAML::SymbolKind>::enumeration( ECase(GLOBAL); ECase(TABLE); ECase(SECTION); - ECase(EVENT); + ECase(TAG); #undef ECase } @@ -597,7 +597,7 @@ void ScalarEnumerationTraits<WasmYAML::ExportKind>::enumeration( ECase(TABLE); ECase(MEMORY); ECase(GLOBAL); - ECase(EVENT); + ECase(TAG); #undef ECase } |