| 930 | } |
| 931 | |
| 932 | Result 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 | |
| 957 | Index BinaryReaderInterp::num_func_imports() const { |
| 958 | return func_types_.size() - module_.funcs.size(); |