Skip to content

Commit

Permalink
[EH] Make tag attribute's encoding uint8
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
aheejin committed Jun 26, 2021
1 parent 9500425 commit 8a6796d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/binary-reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2119,8 +2119,8 @@ Result BinaryReader::ReadLinkingSection(Offset section_size) {
}

Result BinaryReader::ReadTagType(Index* out_sig_index) {
uint32_t attribute;
CHECK_RESULT(ReadU32Leb128(&attribute, "tag attribute"));
uint8_t attribute;
CHECK_RESULT(ReadU8(&attribute, "tag attribute"));
ERROR_UNLESS(attribute == 0, "tag attribute must be 0");
CHECK_RESULT(ReadIndex(out_sig_index, "tag signature index"));
return Result::Ok;
Expand Down
2 changes: 1 addition & 1 deletion src/binary-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ void BinaryWriter::WriteGlobalHeader(const Global* global) {
}

void BinaryWriter::WriteTagType(const Tag* tag) {
WriteU32Leb128(stream_, 0, "tag attribute");
stream_->WriteU8(0, "tag attribute");
WriteU32Leb128(stream_, module_->GetFuncTypeIndex(tag->decl),
"tag signature index");
}
Expand Down

0 comments on commit 8a6796d

Please sign in to comment.