diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/decompiler-ast.h | 5 | ||||
-rw-r--r-- | src/decompiler-naming.h | 3 | ||||
-rw-r--r-- | src/interp/binary-reader-interp.cc | 7 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/decompiler-ast.h b/src/decompiler-ast.h index 584a8373..e5dd358e 100644 --- a/src/decompiler-ast.h +++ b/src/decompiler-ast.h @@ -226,6 +226,11 @@ struct AST { mc.GetLabel(cast<BrIfExpr>(&e)->var)->label_type; return; } + case ExprType::BrTable: { + InsertNode(NodeType::Expr, ExprType::BrTable, &e, 1).u.lt = + mc.GetLabel(cast<BrTableExpr>(&e)->default_target)->label_type; + return; + } default: { InsertNode(NodeType::Expr, e.type(), &e, arity.nargs); return; diff --git a/src/decompiler-naming.h b/src/decompiler-naming.h index 91f841f8..bb7a0819 100644 --- a/src/decompiler-naming.h +++ b/src/decompiler-naming.h @@ -85,6 +85,9 @@ inline void RenameToIdentifier(std::string& name, if (s.size() > max_identifier_length) { s.resize(max_identifier_length); } + if (s.empty()) { + s = "__empty"; + } // Remove original binding first, such that it doesn't match with our // new name. bh.erase(name); diff --git a/src/interp/binary-reader-interp.cc b/src/interp/binary-reader-interp.cc index e1696ce2..05296220 100644 --- a/src/interp/binary-reader-interp.cc +++ b/src/interp/binary-reader-interp.cc @@ -1139,6 +1139,9 @@ Result BinaryReaderInterp::OnCallIndirectExpr(Index sig_index, } Result BinaryReaderInterp::OnReturnCallExpr(Index func_index) { + CHECK_RESULT( + validator_.OnReturnCall(GetLocation(), Var(func_index, GetLocation()))); + FuncType& func_type = func_types_[func_index]; Index drop_count, keep_count, catch_drop_count; @@ -1169,6 +1172,10 @@ Result BinaryReaderInterp::OnReturnCallExpr(Index func_index) { Result BinaryReaderInterp::OnReturnCallIndirectExpr(Index sig_index, Index table_index) { + CHECK_RESULT(validator_.OnReturnCallIndirect( + GetLocation(), Var(sig_index, GetLocation()), + Var(table_index, GetLocation()))); + FuncType& func_type = module_.func_types[sig_index]; Index drop_count, keep_count, catch_drop_count; |