Skip to content

Commit cdc1b45

Browse files
authored
[EH] Make tag attribute's encoding uint8 (#1681)
This changes the encoding of the `attribute` field, which currently only contains the value `0` denoting this tag is for an exception, from `varuint32` to `uint8`. This field is effectively unused at the moment and reserved for future use, and it is not likely to need `varuint32` even in future. See WebAssembly/exception-handling#162. This does not change any encoded binaries because `0` is encoded in the same way both in `varuint32` and `uint8`.
1 parent f6ecccb commit cdc1b45

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/binary-reader.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,8 +2119,8 @@ Result BinaryReader::ReadLinkingSection(Offset section_size) {
21192119
}
21202120

21212121
Result BinaryReader::ReadTagType(Index* out_sig_index) {
2122-
uint32_t attribute;
2123-
CHECK_RESULT(ReadU32Leb128(&attribute, "tag attribute"));
2122+
uint8_t attribute;
2123+
CHECK_RESULT(ReadU8(&attribute, "tag attribute"));
21242124
ERROR_UNLESS(attribute == 0, "tag attribute must be 0");
21252125
CHECK_RESULT(ReadIndex(out_sig_index, "tag signature index"));
21262126
return Result::Ok;

src/binary-writer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ void BinaryWriter::WriteGlobalHeader(const Global* global) {
11101110
}
11111111

11121112
void BinaryWriter::WriteTagType(const Tag* tag) {
1113-
WriteU32Leb128(stream_, 0, "tag attribute");
1113+
stream_->WriteU8(0, "tag attribute");
11141114
WriteU32Leb128(stream_, module_->GetFuncTypeIndex(tag->decl),
11151115
"tag signature index");
11161116
}

0 commit comments

Comments
 (0)