| 878 | } |
| 879 | |
| 880 | Result BinaryReaderInterp::BeginFunctionBody(Index index, Offset size) { |
| 881 | Index defined_index = index - num_func_imports(); |
| 882 | func_ = &module_.funcs[defined_index]; |
| 883 | func_->code_offset = istream_.end(); |
| 884 | |
| 885 | depth_fixups_.Clear(); |
| 886 | label_stack_.clear(); |
| 887 | |
| 888 | // The fixups map is keyed by actual function index (not defined_index) |
| 889 | // (function imports don't have code and won't appear in the fixups map, |
| 890 | // but they still use function indexes) |
| 891 | func_fixups_.Resolve(istream_, index); |
| 892 | |
| 893 | CHECK_RESULT(validator_.BeginFunctionBody(GetLocation(), index)); |
| 894 | |
| 895 | // Push implicit func label (equivalent to return). |
| 896 | // With exception handling it acts as a catch-less try block, which is |
| 897 | // needed to support delegating to the caller of a function using the |
| 898 | // try-delegate instruction. |
| 899 | PushLabel(LabelKind::Try, Istream::kInvalidOffset, Istream::kInvalidOffset, |
| 900 | func_->handlers.size()); |
| 901 | return Result::Ok; |
| 902 | } |
| 903 | |
| 904 | Result BinaryReaderInterp::EndFunctionBody(Index index) { |
| 905 | FixupTopLabel(); |