summaryrefslogtreecommitdiff
path: root/src/binary-reader-logging.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2018-06-14 15:16:43 -0700
committerGitHub <noreply@github.com>2018-06-14 15:16:43 -0700
commitd23c99d036ab31f7de21bc4a90b651c4cfd4a356 (patch)
tree7e352f593a161accef670ad0553a8aa6257d4364 /src/binary-reader-logging.cc
parentace6f17fae2ae6511e1c676217d76143ddf0f23d (diff)
downloadwabt-d23c99d036ab31f7de21bc4a90b651c4cfd4a356.tar.gz
wabt-d23c99d036ab31f7de21bc4a90b651c4cfd4a356.tar.bz2
wabt-d23c99d036ab31f7de21bc4a90b651c4cfd4a356.zip
Add support for multi-value proposal (#861)
Use the `--enable-multi-value` flag to enable. A lot of code already "worked" with multi-value, and just needed to remove the restrictions. Most of the other changes are modifying the callback APIs to be more general, e.g. taking more than 1 result type. * Types are now stored as the negative values; this works nicely with the encoding of inline function types (used for block signatures), which are always positive values. * Remove `BlockSignature` and use `BlockDeclaration` instead, which is just a typedef to `FuncSignature`. This allows for explicit or implicit type specifications on the block signatures. * Allow for >1 "keep" values in the DropKeep interpreter instruction
Diffstat (limited to 'src/binary-reader-logging.cc')
-rw-r--r--src/binary-reader-logging.cc46
1 files changed, 26 insertions, 20 deletions
diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc
index b1896c73..f730a865 100644
--- a/src/binary-reader-logging.cc
+++ b/src/binary-reader-logging.cc
@@ -76,10 +76,18 @@ void BinaryReaderLogging::WriteIndent() {
}
}
+void BinaryReaderLogging::LogType(Type type) {
+ if (IsTypeIndex(type)) {
+ LOGF_NOINDENT("funcidx[%d]", static_cast<int>(type));
+ } else {
+ LOGF_NOINDENT("%s", GetTypeName(type));
+ }
+}
+
void BinaryReaderLogging::LogTypes(Index type_count, Type* types) {
LOGF_NOINDENT("[");
for (Index i = 0; i < type_count; ++i) {
- LOGF_NOINDENT("%s", GetTypeName(types[i]));
+ LogType(types[i]);
if (i != type_count - 1) {
LOGF_NOINDENT(", ");
}
@@ -254,11 +262,11 @@ Result BinaryReaderLogging::OnLocalDecl(Index decl_index,
return reader_->OnLocalDecl(decl_index, count, type);
}
-Result BinaryReaderLogging::OnBlockExpr(Index num_types, Type* sig_types) {
+Result BinaryReaderLogging::OnBlockExpr(Type sig_type) {
LOGF("OnBlockExpr(sig: ");
- LogTypes(num_types, sig_types);
+ LogType(sig_type);
LOGF_NOINDENT(")\n");
- return reader_->OnBlockExpr(num_types, sig_types);
+ return reader_->OnBlockExpr(sig_type);
}
Result BinaryReaderLogging::OnBrExpr(Index depth) {
@@ -323,34 +331,32 @@ Result BinaryReaderLogging::OnI64ConstExpr(uint64_t value) {
return reader_->OnI64ConstExpr(value);
}
-Result BinaryReaderLogging::OnIfExpr(Index num_types, Type* sig_types) {
+Result BinaryReaderLogging::OnIfExpr(Type sig_type) {
LOGF("OnIfExpr(sig: ");
- LogTypes(num_types, sig_types);
+ LogType(sig_type);
LOGF_NOINDENT(")\n");
- return reader_->OnIfExpr(num_types, sig_types);
+ return reader_->OnIfExpr(sig_type);
}
-Result BinaryReaderLogging::OnIfExceptExpr(Index num_types,
- Type* sig_types,
- Index except_index) {
+Result BinaryReaderLogging::OnIfExceptExpr(Type sig_type, Index except_index) {
LOGF("OnIfExceptExpr(sig: ");
- LogTypes(num_types, sig_types);
+ LogType(sig_type);
LOGF_NOINDENT(", except: %" PRIindex ")\n", except_index);
- return reader_->OnIfExceptExpr(num_types, sig_types, except_index);
+ return reader_->OnIfExceptExpr(sig_type, except_index);
}
-Result BinaryReaderLogging::OnLoopExpr(Index num_types, Type* sig_types) {
+Result BinaryReaderLogging::OnLoopExpr(Type sig_type) {
LOGF("OnLoopExpr(sig: ");
- LogTypes(num_types, sig_types);
+ LogType(sig_type);
LOGF_NOINDENT(")\n");
- return reader_->OnLoopExpr(num_types, sig_types);
+ return reader_->OnLoopExpr(sig_type);
}
-Result BinaryReaderLogging::OnTryExpr(Index num_types, Type* sig_types) {
+Result BinaryReaderLogging::OnTryExpr(Type sig_type) {
LOGF("OnTryExpr(sig: ");
- LogTypes(num_types, sig_types);
+ LogType(sig_type);
LOGF_NOINDENT(")\n");
- return reader_->OnTryExpr(num_types, sig_types);
+ return reader_->OnTryExpr(sig_type);
}
Result BinaryReaderLogging::OnSimdLaneOpExpr(Opcode opcode, uint64_t value) {
@@ -753,8 +759,8 @@ Result BinaryReaderLogging::OnOpcodeV128(v128 value) {
return reader_->OnOpcodeV128(value);
}
-Result BinaryReaderLogging::OnOpcodeBlockSig(Index num_types, Type* sig_types) {
- return reader_->OnOpcodeBlockSig(num_types, sig_types);
+Result BinaryReaderLogging::OnOpcodeBlockSig(Type sig_type) {
+ return reader_->OnOpcodeBlockSig(sig_type);
}
Result BinaryReaderLogging::OnEndFunc() {