aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/obj2yaml/wasm2yaml.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2018-11-14 02:46:21 +0000
committerHeejin Ahn <aheejin@gmail.com>2018-11-14 02:46:21 +0000
commitda419bdb5e3e167ea90c6923660059f35fa17d67 (patch)
tree0264ae56ecdddf59399c2b355e1dee8eeffafb63 /llvm/tools/obj2yaml/wasm2yaml.cpp
parent6a3c279d1cdcd4205a233952b4bacd5941cd355e (diff)
downloadllvm-da419bdb5e3e167ea90c6923660059f35fa17d67.zip
llvm-da419bdb5e3e167ea90c6923660059f35fa17d67.tar.gz
llvm-da419bdb5e3e167ea90c6923660059f35fa17d67.tar.bz2
[WebAssembly] Add support for the event section
Summary: This adds support for the 'event section' specified in the exception handling proposal. (This was named 'exception section' first, but later renamed to 'event section' to take possibilities of other kinds of events into consideration. But currently we only store exception info in this section.) The event section is added between the global section and the export section. This is for ease of validation per request of the V8 team. This patch: - Creates the event symbol type, which is a weak symbol - Makes 'throw' instruction take the event symbol '__cpp_exception' - Adds relocation support for events - Adds WasmObjectWriter / WasmObjectFile (Reader) support - Adds obj2yaml / yaml2obj support - Adds '.eventtype' printing support Reviewers: dschuff, sbc100, aardappel Subscribers: jgravelle-google, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D54096 llvm-svn: 346825
Diffstat (limited to 'llvm/tools/obj2yaml/wasm2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/wasm2yaml.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp
index a1120a9..8bbc9fb 100644
--- a/llvm/tools/obj2yaml/wasm2yaml.cpp
+++ b/llvm/tools/obj2yaml/wasm2yaml.cpp
@@ -107,6 +107,7 @@ WasmDumper::dumpCustomSection(const WasmSection &WasmSec) {
break;
case wasm::WASM_SYMBOL_TYPE_FUNCTION:
case wasm::WASM_SYMBOL_TYPE_GLOBAL:
+ case wasm::WASM_SYMBOL_TYPE_EVENT:
Info.ElementIndex = Symbol.ElementIndex;
break;
case wasm::WASM_SYMBOL_TYPE_SECTION:
@@ -182,6 +183,10 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
Im.GlobalImport.Type = Import.Global.Type;
Im.GlobalImport.Mutable = Import.Global.Mutable;
break;
+ case wasm::WASM_EXTERNAL_EVENT:
+ Im.EventImport.Attribute = Import.Event.Attribute;
+ Im.EventImport.SigIndex = Import.Event.SigIndex;
+ break;
case wasm::WASM_EXTERNAL_TABLE:
Im.TableImport = make_table(Import.Table);
break;
@@ -231,6 +236,18 @@ ErrorOr<WasmYAML::Object *> WasmDumper::dump() {
S = std::move(GlobalSec);
break;
}
+ case wasm::WASM_SEC_EVENT: {
+ auto EventSec = make_unique<WasmYAML::EventSection>();
+ for (auto &Event : Obj.events()) {
+ WasmYAML::Event E;
+ E.Index = Event.Index;
+ E.Attribute = Event.Type.Attribute;
+ E.SigIndex = Event.Type.SigIndex;
+ EventSec->Events.push_back(E);
+ }
+ S = std::move(EventSec);
+ break;
+ }
case wasm::WASM_SEC_START: {
auto StartSec = make_unique<WasmYAML::StartSection>();
StartSec->StartFunction = Obj.startFunction();