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

Method EndLocalDecls

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

Source from the content-addressed store, hash-verified

930}
931
932Result BinaryReaderInterp::EndLocalDecls() {
933 if (local_count_ != 0) {
934 istream_.Emit(Opcode::InterpAlloca, local_count_);
935 for (Index i = 0; i < local_count_; i++) {
936 if (func_->GetLocalType(func_->type.params.size() + i).IsRef()) {
937 istream_.Emit(Opcode::InterpMarkRef, local_count_ - i);
938 }
939 }
940 }
941 // Continuation of the implicit func label, used for exception handling. (See
942 // BeginFunctionBody.)
943 // We need the local count for this, which is only available after processing
944 // all local decls.
945 // NOTE: we don't count the parameters, as they're not part of the frame.
946 func_->handlers.push_back(HandlerDesc{HandlerKind::Catch,
947 istream_.end(),
948 Istream::kInvalidOffset,
949 {},
950 {Istream::kInvalidOffset},
951 static_cast<u32>(local_count_),
952 0});
953
954 return Result::Ok;
955}
956
957Index BinaryReaderInterp::num_func_imports() const {
958 return func_types_.size() - module_.funcs.size();

Callers

nothing calls this directly

Calls 6

EmitMethod · 0.80
IsRefMethod · 0.45
GetLocalTypeMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected