MCPcopy Create free account
hub / github.com/WebAssembly/wabt / OnEndExpr

Method OnEndExpr

src/interp/binary-reader-interp.cc:1123–1151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121}
1122
1123Result BinaryReaderInterp::OnEndExpr() {
1124 if (label_stack_.size() == 1) {
1125 return Result::Ok;
1126 }
1127 SharedValidator::Label* label;
1128 CHECK_RESULT(validator_.GetLabel(0, &label));
1129 LabelType label_type = label->label_type;
1130 CHECK_RESULT(validator_.OnEnd(GetLocation()));
1131 if (label_type == LabelType::If || label_type == LabelType::Else) {
1132 istream_.ResolveFixupU32(TopLabel()->fixup_offset);
1133 } else if (label_type == LabelType::Try) {
1134 // Catch-less try blocks need to fill in the handler description
1135 // so that it can trigger an exception rethrow when it's reached.
1136 Label* local_label = TopLabel();
1137 HandlerDesc& desc = func_->handlers[local_label->handler_desc_index];
1138 desc.try_end_offset = istream_.end();
1139 assert(desc.catches.size() == 0);
1140 } else if (label_type == LabelType::TryTable) {
1141 // TryTable blocks need a try_end_offset
1142 Label* local_label = TopLabel();
1143 HandlerDesc& desc = func_->handlers[local_label->handler_desc_index];
1144 desc.try_end_offset = istream_.end();
1145 } else if (label_type == LabelType::Catch) {
1146 istream_.EmitCatchDrop(1);
1147 }
1148 FixupTopLabel();
1149 PopLabel();
1150 return Result::Ok;
1151}
1152
1153Result BinaryReaderInterp::OnBrExpr(Index depth) {
1154 Index drop_count, keep_count, catch_drop_count;

Callers

nothing calls this directly

Calls 6

ResolveFixupU32Method · 0.80
EmitCatchDropMethod · 0.80
sizeMethod · 0.45
GetLabelMethod · 0.45
OnEndMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected