summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2021-06-21 21:24:11 -0700
committerGitHub <noreply@github.com>2021-06-21 21:24:11 -0700
commite773dfd026ff939e9f4cb91816863bdc5292ff4e (patch)
tree879d2311861c8aa41e6d5e688a66c394042fe443 /src/wasm/wasm-binary.cpp
parent9fc276298b36080658236f0bc93d94cdf774492c (diff)
downloadbinaryen-e773dfd026ff939e9f4cb91816863bdc5292ff4e.tar.gz
binaryen-e773dfd026ff939e9f4cb91816863bdc5292ff4e.tar.bz2
binaryen-e773dfd026ff939e9f4cb91816863bdc5292ff4e.zip
[EH] Make tag's attribute encoding detail (#3947)
This removes `attribute` field from `Tag` class, making the reserved and unused field known only to binary encoder and decoder. This also removes the `attribute` parameter from `makeTag` and `addTag` methods in wasm-builder.h, C API, and Binaryen JS API. Suggested in https://github.com/WebAssembly/binaryen/pull/3946#pullrequestreview-687756523.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index b7c074377..a824ac12d 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -282,7 +282,7 @@ void WasmBinaryWriter::writeImports() {
BYN_TRACE("write one tag\n");
writeImportHeader(tag);
o << U32LEB(int32_t(ExternalKind::Tag));
- o << U32LEB(tag->attribute);
+ o << U32LEB(0); // Reserved 'attribute' field. Always 0.
o << U32LEB(getTypeIndex(tag->sig));
});
if (wasm->memory.imported()) {
@@ -656,7 +656,7 @@ void WasmBinaryWriter::writeTags() {
o << U32LEB(num);
ModuleUtils::iterDefinedTags(*wasm, [&](Tag* tag) {
BYN_TRACE("write one\n");
- o << U32LEB(tag->attribute);
+ o << U32LEB(0); // Reserved 'attribute' field. Always 0.
o << U32LEB(getTypeIndex(tag->sig));
});
@@ -2071,10 +2071,9 @@ void WasmBinaryBuilder::readImports() {
}
case ExternalKind::Tag: {
Name name(std::string("eimport$") + std::to_string(tagCounter++));
- auto attribute = getU32LEB();
+ getU32LEB(); // Reserved 'attribute' field
auto index = getU32LEB();
- auto curr =
- builder.makeTag(name, attribute, getSignatureByTypeIndex(index));
+ auto curr = builder.makeTag(name, getSignatureByTypeIndex(index));
curr->module = module;
curr->base = base;
wasm.addTag(std::move(curr));
@@ -2908,10 +2907,9 @@ void WasmBinaryBuilder::readTags() {
BYN_TRACE("num: " << numTags << std::endl);
for (size_t i = 0; i < numTags; i++) {
BYN_TRACE("read one\n");
- auto attribute = getU32LEB();
+ getU32LEB(); // Reserved 'attribute' field
auto typeIndex = getU32LEB();
wasm.addTag(Builder::makeTag("tag$" + std::to_string(i),
- attribute,
getSignatureByTypeIndex(typeIndex)));
}
}