diff options
author | Heejin Ahn <aheejin@gmail.com> | 2018-11-14 02:46:21 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2018-11-14 02:46:21 +0000 |
commit | da419bdb5e3e167ea90c6923660059f35fa17d67 (patch) | |
tree | 0264ae56ecdddf59399c2b355e1dee8eeffafb63 /llvm/include/llvm/BinaryFormat/Wasm.h | |
parent | 6a3c279d1cdcd4205a233952b4bacd5941cd355e (diff) | |
download | bcm5719-llvm-da419bdb5e3e167ea90c6923660059f35fa17d67.tar.gz bcm5719-llvm-da419bdb5e3e167ea90c6923660059f35fa17d67.zip |
[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/include/llvm/BinaryFormat/Wasm.h')
-rw-r--r-- | llvm/include/llvm/BinaryFormat/Wasm.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h index 3d25c9d15e4..fbca8df7382 100644 --- a/llvm/include/llvm/BinaryFormat/Wasm.h +++ b/llvm/include/llvm/BinaryFormat/Wasm.h @@ -75,6 +75,18 @@ struct WasmGlobal { StringRef SymbolName; // from the "linking" section }; +struct WasmEventType { + // Kind of event. Currently only WASM_EVENT_ATTRIBUTE_EXCEPTION is possible. + uint32_t Attribute; + uint32_t SigIndex; +}; + +struct WasmEvent { + uint32_t Index; + WasmEventType Type; + StringRef SymbolName; // from the "linking" section +}; + struct WasmImport { StringRef Module; StringRef Field; @@ -84,6 +96,7 @@ struct WasmImport { WasmGlobalType Global; WasmTable Table; WasmLimits Memory; + WasmEventType Event; }; }; @@ -178,7 +191,8 @@ enum : unsigned { WASM_SEC_START = 8, // Start function declaration WASM_SEC_ELEM = 9, // Elements section WASM_SEC_CODE = 10, // Function bodies (code) - WASM_SEC_DATA = 11 // Data segments + WASM_SEC_DATA = 11, // Data segments + WASM_SEC_EVENT = 12 // Event declarations }; // Type immediate encodings used in various contexts. @@ -200,6 +214,7 @@ enum : unsigned { WASM_EXTERNAL_TABLE = 0x1, WASM_EXTERNAL_MEMORY = 0x2, WASM_EXTERNAL_GLOBAL = 0x3, + WASM_EXTERNAL_EVENT = 0x4, }; // Opcodes used in initializer expressions. @@ -243,6 +258,12 @@ enum WasmSymbolType : unsigned { WASM_SYMBOL_TYPE_DATA = 0x1, WASM_SYMBOL_TYPE_GLOBAL = 0x2, WASM_SYMBOL_TYPE_SECTION = 0x3, + WASM_SYMBOL_TYPE_EVENT = 0x4, +}; + +// Kinds of event attributes. +enum WasmEventAttribute : unsigned { + WASM_EVENT_ATTRIBUTE_EXCEPTION = 0x0, }; const unsigned WASM_SYMBOL_BINDING_MASK = 0x3; |