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

Method BeginFunctionBody

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

Source from the content-addressed store, hash-verified

878}
879
880Result 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
904Result BinaryReaderInterp::EndFunctionBody(Index index) {
905 FixupTopLabel();

Callers

nothing calls this directly

Calls 5

ResolveMethod · 0.80
endMethod · 0.45
ClearMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected