blob: 92cfb45e6812d6da516ca029183eccf309aaf892 [file] [log] [blame]
Ian Rogers776ac1f2012-04-13 23:36:36 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Brian Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_
18#define ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_
Ian Rogers776ac1f2012-04-13 23:36:36 -070019
Ian Rogers700a4022014-05-19 16:49:03 -070020#include <memory>
Vladimir Marko637ee0b2015-09-04 12:47:41 +010021#include <sstream>
Ian Rogers776ac1f2012-04-13 23:36:36 -070022#include <vector>
23
Andreas Gampe51de69e2019-04-19 15:14:14 -070024#include <android-base/logging.h>
25
Mathieu Chartierde40d472015-10-15 17:47:48 -070026#include "base/arena_allocator.h"
Elliott Hughes76160052012-12-12 16:31:20 -080027#include "base/macros.h"
Mathieu Chartierde40d472015-10-15 17:47:48 -070028#include "base/scoped_arena_containers.h"
Andreas Gampe9fcfb8a2016-02-04 20:52:54 -080029#include "base/value_object.h"
David Sehr9e734c72018-01-04 17:56:19 -080030#include "dex/code_item_accessors.h"
David Sehr9e734c72018-01-04 17:56:19 -080031#include "dex/dex_file_types.h"
David Sehr312f3b22018-03-19 08:39:26 -070032#include "dex/method_reference.h"
Hiroshi Yamauchidc376172014-08-22 11:13:12 -070033#include "handle.h"
Ian Rogers7b3ddd22013-02-21 15:19:52 -080034#include "instruction_flags.h"
Ian Rogers576ca0c2014-06-06 15:58:22 -070035#include "reg_type_cache.h"
Andreas Gampe8cf9cb32017-07-19 09:28:38 -070036#include "register_line.h"
Andreas Gampe6d7abbd2017-04-24 13:19:09 -070037#include "verifier_enums.h"
Ian Rogers776ac1f2012-04-13 23:36:36 -070038
39namespace art {
40
Andreas Gamped482e732017-04-24 17:59:09 -070041class ClassLinker;
Andreas Gampe3f1dcd32018-12-28 09:39:56 -080042class DexFile;
Ian Rogers8e1f4f82014-11-05 11:07:30 -080043class Instruction;
Ian Rogers776ac1f2012-04-13 23:36:36 -070044struct ReferenceMap2Visitor;
Mathieu Chartierd0ad2ee2015-03-31 14:59:59 -070045class Thread;
Vladimir Marko8f1e08a2015-06-26 12:06:30 +010046class VariableIndentationOutputStream;
Ian Rogers776ac1f2012-04-13 23:36:36 -070047
Andreas Gampe3f1dcd32018-12-28 09:39:56 -080048namespace dex {
49struct ClassDef;
50struct CodeItem;
51} // namespace dex
52
Andreas Gamped482e732017-04-24 17:59:09 -070053namespace mirror {
54class DexCache;
55} // namespace mirror
56
Ian Rogers776ac1f2012-04-13 23:36:36 -070057namespace verifier {
58
Ian Rogers8e1f4f82014-11-05 11:07:30 -080059class MethodVerifier;
60class RegisterLine;
Mathieu Chartier361e04a2016-02-16 14:06:35 -080061using RegisterLineArenaUniquePtr = std::unique_ptr<RegisterLine, RegisterLineArenaDelete>;
Ian Rogers8e1f4f82014-11-05 11:07:30 -080062class RegType;
Andreas Gampe2ad6cce2019-04-11 16:17:39 -070063struct ScopedNewLine;
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +000064class VerifierDeps;
Ian Rogers776ac1f2012-04-13 23:36:36 -070065
Ian Rogers2bcb4a42012-11-08 10:39:18 -080066// A mapping from a dex pc to the register line statuses as they are immediately prior to the
67// execution of that instruction.
Ian Rogers776ac1f2012-04-13 23:36:36 -070068class PcToRegisterLineTable {
69 public:
Vladimir Marko69d310e2017-10-09 14:12:23 +010070 explicit PcToRegisterLineTable(ScopedArenaAllocator& allocator);
Ian Rogersd0fbd852013-09-24 18:17:04 -070071 ~PcToRegisterLineTable();
Ian Rogers776ac1f2012-04-13 23:36:36 -070072
73 // Initialize the RegisterTable. Every instruction address can have a different set of information
74 // about what's in which register, but for verification purposes we only need to store it at
75 // branch target addresses (because we merge into that).
Nicolas Geoffray2cb25272021-07-15 14:24:29 +010076 void Init(InstructionFlags* flags,
Andreas Gamped09c0592019-04-19 15:44:05 -070077 uint32_t insns_size,
78 uint16_t registers_size,
79 ScopedArenaAllocator& allocator,
Nicolas Geoffray2cb25272021-07-15 14:24:29 +010080 RegTypeCache* reg_types,
81 uint32_t interesting_dex_pc);
Ian Rogers776ac1f2012-04-13 23:36:36 -070082
Andreas Gampe077d9db2018-01-19 18:54:14 -080083 bool IsInitialized() const {
84 return !register_lines_.empty();
85 }
86
Mathieu Chartierde40d472015-10-15 17:47:48 -070087 RegisterLine* GetLine(size_t idx) const {
88 return register_lines_[idx].get();
Ian Rogers776ac1f2012-04-13 23:36:36 -070089 }
90
91 private:
Mathieu Chartier361e04a2016-02-16 14:06:35 -080092 ScopedArenaVector<RegisterLineArenaUniquePtr> register_lines_;
Ian Rogers8e1f4f82014-11-05 11:07:30 -080093
94 DISALLOW_COPY_AND_ASSIGN(PcToRegisterLineTable);
Ian Rogers776ac1f2012-04-13 23:36:36 -070095};
96
97// The verifier
98class MethodVerifier {
99 public:
Vladimir Marko8f1e08a2015-06-26 12:06:30 +0100100 static MethodVerifier* VerifyMethodAndDump(Thread* self,
101 VariableIndentationOutputStream* vios,
102 uint32_t method_idx,
Andreas Gampe2ed8def2014-08-28 14:41:02 -0700103 const DexFile* dex_file,
Andreas Gampe5a4b8a22014-09-11 08:30:08 -0700104 Handle<mirror::DexCache> dex_cache,
105 Handle<mirror::ClassLoader> class_loader,
Andreas Gampe3f1dcd32018-12-28 09:39:56 -0800106 const dex::ClassDef& class_def,
Nicolas Geoffray2ec38232021-07-02 16:36:29 +0100107 const dex::CodeItem* code_item,
Andreas Gampe6cc23ac2018-08-24 15:22:43 -0700108 uint32_t method_access_flags,
109 uint32_t api_level)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700110 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogers2bcb4a42012-11-08 10:39:18 -0800111
Nicolas Geoffray2cb25272021-07-15 14:24:29 +0100112 // Calculates the type information at the given `dex_pc`.
113 // No classes will be loaded.
Alex Lighte2ddce32019-05-22 17:08:35 +0000114 static MethodVerifier* CalculateVerificationInfo(Thread* self,
115 ArtMethod* method,
Nicolas Geoffray2cb25272021-07-15 14:24:29 +0100116 uint32_t dex_pc)
Alex Lighte2ddce32019-05-22 17:08:35 +0000117 REQUIRES_SHARED(Locks::mutator_lock_);
118
David Brazdilca3c8c32016-09-06 14:04:48 +0100119 const DexFile& GetDexFile() const {
120 DCHECK(dex_file_ != nullptr);
121 return *dex_file_;
122 }
123
Nicolas Geoffray1960c422020-11-04 08:45:32 +0000124 const dex::ClassDef& GetClassDef() const {
125 return class_def_;
126 }
127
Ian Rogers776ac1f2012-04-13 23:36:36 -0700128 RegTypeCache* GetRegTypeCache() {
129 return &reg_types_;
130 }
131
Ian Rogersad0b3a32012-04-16 14:50:24 -0700132 // Log a verification failure.
Andreas Gampe4146e062019-07-10 13:18:04 -0700133 std::ostream& Fail(VerifyError error, bool pending_exc = true);
Ian Rogers776ac1f2012-04-13 23:36:36 -0700134
Ian Rogersad0b3a32012-04-16 14:50:24 -0700135 // Log for verification information.
Andreas Gampe2ad6cce2019-04-11 16:17:39 -0700136 ScopedNewLine LogVerifyInfo();
Ian Rogers776ac1f2012-04-13 23:36:36 -0700137
Andreas Gampeaaf0d382017-11-27 14:10:21 -0800138 // Information structure for a lock held at a certain point in time.
139 struct DexLockInfo {
140 // The registers aliasing the lock.
141 std::set<uint32_t> dex_registers;
142 // The dex PC of the monitor-enter instruction.
143 uint32_t dex_pc;
144
145 explicit DexLockInfo(uint32_t dex_pc_in) {
146 dex_pc = dex_pc_in;
147 }
148 };
Elliott Hughes08fc03a2012-06-26 17:34:00 -0700149 // Fills 'monitor_enter_dex_pcs' with the dex pcs of the monitor-enter instructions corresponding
Sebastien Hertz2d6ba512013-05-17 11:31:37 +0200150 // to the locks held at 'dex_pc' in method 'm'.
Nicolas Geoffrayb041a402017-11-13 15:16:22 +0000151 // Note: this is the only situation where the verifier will visit quickened instructions.
Andreas Gampe6cc23ac2018-08-24 15:22:43 -0700152 static void FindLocksAtDexPc(ArtMethod* m,
153 uint32_t dex_pc,
154 std::vector<DexLockInfo>* monitor_enter_dex_pcs,
155 uint32_t api_level)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700156 REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes08fc03a2012-06-26 17:34:00 -0700157
Andreas Gampee0bbab92019-07-25 12:28:22 -0700158 static void Init(ClassLinker* class_linker) REQUIRES_SHARED(Locks::mutator_lock_);
Elliott Hughes0a1038b2012-06-14 16:24:17 -0700159 static void Shutdown();
Ian Rogers776ac1f2012-04-13 23:36:36 -0700160
Andreas Gampefc25ae92019-04-19 22:22:57 -0700161 virtual ~MethodVerifier();
Sebastien Hertz33691ab2013-08-02 14:19:57 +0200162
Mathieu Chartierbb87e0f2015-04-03 11:21:55 -0700163 static void VisitStaticRoots(RootVisitor* visitor)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700164 REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartierbb87e0f2015-04-03 11:21:55 -0700165 void VisitRoots(RootVisitor* visitor, const RootInfo& roots)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700166 REQUIRES_SHARED(Locks::mutator_lock_);
Mathieu Chartierc528dba2013-11-26 12:00:11 -0800167
Mathieu Chartier3da1d0f2017-11-06 20:02:24 -0800168 const CodeItemDataAccessor& CodeItem() const {
169 return code_item_accessor_;
170 }
Vladimir Marko2b5eaa22013-12-13 13:59:30 +0000171 RegisterLine* GetRegLine(uint32_t dex_pc);
Mathieu Chartierde40d472015-10-15 17:47:48 -0700172 ALWAYS_INLINE const InstructionFlags& GetInstructionFlags(size_t index) const;
Andreas Gampe51de69e2019-04-19 15:14:14 -0700173
Vladimir Marko2b5eaa22013-12-13 13:59:30 +0000174 MethodReference GetMethodReference() const;
Vladimir Marko2b5eaa22013-12-13 13:59:30 +0000175 bool HasFailures() const;
Nicolas Geoffray4824c272015-06-24 15:53:03 +0100176 bool HasInstructionThatWillThrow() const {
Nicolas Geoffray2ec38232021-07-02 16:36:29 +0100177 return (encountered_failure_types_ & VERIFY_ERROR_RUNTIME_THROW) != 0;
Nicolas Geoffray4824c272015-06-24 15:53:03 +0100178 }
179
Andreas Gampefc25ae92019-04-19 22:22:57 -0700180 virtual const RegType& ResolveCheckedClass(dex::TypeIndex class_idx)
181 REQUIRES_SHARED(Locks::mutator_lock_) = 0;
Vladimir Marko2b5eaa22013-12-13 13:59:30 +0000182
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000183 uint32_t GetEncounteredFailureTypes() const {
Andreas Gampe0760a812015-08-26 17:12:51 -0700184 return encountered_failure_types_;
185 }
186
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000187 ClassLinker* GetClassLinker() const {
Andreas Gampee0bbab92019-07-25 12:28:22 -0700188 return class_linker_;
189 }
190
Andreas Gampefef91cc2019-07-25 14:13:23 -0700191 bool IsAotMode() const {
192 return flags_.aot_mode_;
193 }
194
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000195 VerifierDeps* GetVerifierDeps() const {
196 return verifier_deps_;
197 }
198
Andreas Gampefc25ae92019-04-19 22:22:57 -0700199 protected:
Andreas Gampe53e32d12015-12-09 21:03:23 -0800200 MethodVerifier(Thread* self,
Andreas Gampee0bbab92019-07-25 12:28:22 -0700201 ClassLinker* class_linker,
Andreas Gampef1468b52019-07-26 09:22:39 -0700202 ArenaPool* arena_pool,
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000203 VerifierDeps* verifier_deps,
Andreas Gampe53e32d12015-12-09 21:03:23 -0800204 const DexFile* dex_file,
Nicolas Geoffray1960c422020-11-04 08:45:32 +0000205 const dex::ClassDef& class_def,
Andreas Gampe3f1dcd32018-12-28 09:39:56 -0800206 const dex::CodeItem* code_item,
Andreas Gampefc25ae92019-04-19 22:22:57 -0700207 uint32_t dex_method_idx,
Andreas Gampe53e32d12015-12-09 21:03:23 -0800208 bool can_load_classes,
Andreas Gampe6cc23ac2018-08-24 15:22:43 -0700209 bool allow_thread_suspension,
Andreas Gampefef91cc2019-07-25 14:13:23 -0700210 bool aot_mode)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700211 REQUIRES_SHARED(Locks::mutator_lock_);
Andreas Gampe2ed8def2014-08-28 14:41:02 -0700212
Andreas Gampe9fcfb8a2016-02-04 20:52:54 -0800213 // Verification result for method(s). Includes a (maximum) failure kind, and (the union of)
214 // all failure types.
215 struct FailureData : ValueObject {
Andreas Gampe6d7abbd2017-04-24 13:19:09 -0700216 FailureKind kind = FailureKind::kNoFailure;
Andreas Gampe9fcfb8a2016-02-04 20:52:54 -0800217 uint32_t types = 0U;
218
219 // Merge src into this. Uses the most severe failure kind, and the union of types.
220 void Merge(const FailureData& src);
221 };
222
Ian Rogers776ac1f2012-04-13 23:36:36 -0700223 /*
224 * Perform verification on a single method.
225 *
226 * We do this in three passes:
227 * (1) Walk through all code units, determining instruction locations,
228 * widths, and other characteristics.
229 * (2) Walk through all code units, performing static checks on
230 * operands.
231 * (3) Iterate through the method, checking type safety and looking
232 * for code flow problems.
Ian Rogerse1758fe2012-04-19 11:31:15 -0700233 */
David Brazdilca3c8c32016-09-06 14:04:48 +0100234 static FailureData VerifyMethod(Thread* self,
Andreas Gampee0bbab92019-07-25 12:28:22 -0700235 ClassLinker* class_linker,
Andreas Gampef1468b52019-07-26 09:22:39 -0700236 ArenaPool* arena_pool,
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000237 VerifierDeps* verifier_deps,
David Brazdilca3c8c32016-09-06 14:04:48 +0100238 uint32_t method_idx,
Andreas Gampeec6e6c12015-11-05 20:39:56 -0800239 const DexFile* dex_file,
Andreas Gampe5a4b8a22014-09-11 08:30:08 -0700240 Handle<mirror::DexCache> dex_cache,
241 Handle<mirror::ClassLoader> class_loader,
Andreas Gampe3f1dcd32018-12-28 09:39:56 -0800242 const dex::ClassDef& class_def_idx,
243 const dex::CodeItem* code_item,
Andreas Gampeec6e6c12015-11-05 20:39:56 -0800244 uint32_t method_access_flags,
Andreas Gampe5fd66d02016-09-12 20:22:19 -0700245 HardFailLogMode log_level,
Andreas Gampe6cc23ac2018-08-24 15:22:43 -0700246 uint32_t api_level,
Andreas Gampefef91cc2019-07-25 14:13:23 -0700247 bool aot_mode,
Andreas Gampeec6e6c12015-11-05 20:39:56 -0800248 std::string* hard_failure_msg)
Andreas Gampebdf7f1c2016-08-30 16:38:47 -0700249 REQUIRES_SHARED(Locks::mutator_lock_);
Ian Rogerse1758fe2012-04-19 11:31:15 -0700250
Andreas Gampe99db7bb2019-04-19 23:05:47 -0700251 template <bool kVerifierDebug>
252 static FailureData VerifyMethod(Thread* self,
Andreas Gampee0bbab92019-07-25 12:28:22 -0700253 ClassLinker* class_linker,
Andreas Gampef1468b52019-07-26 09:22:39 -0700254 ArenaPool* arena_pool,
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000255 VerifierDeps* verifier_deps,
Andreas Gampe99db7bb2019-04-19 23:05:47 -0700256 uint32_t method_idx,
257 const DexFile* dex_file,
258 Handle<mirror::DexCache> dex_cache,
259 Handle<mirror::ClassLoader> class_loader,
260 const dex::ClassDef& class_def_idx,
261 const dex::CodeItem* code_item,
Andreas Gampe99db7bb2019-04-19 23:05:47 -0700262 uint32_t method_access_flags,
Andreas Gampe99db7bb2019-04-19 23:05:47 -0700263 HardFailLogMode log_level,
Andreas Gampe99db7bb2019-04-19 23:05:47 -0700264 uint32_t api_level,
Andreas Gampefef91cc2019-07-25 14:13:23 -0700265 bool aot_mode,
Andreas Gampe99db7bb2019-04-19 23:05:47 -0700266 std::string* hard_failure_msg)
267 REQUIRES_SHARED(Locks::mutator_lock_);
268
Andreas Gampefc25ae92019-04-19 22:22:57 -0700269 // For VerifierDepsTest. TODO: Refactor.
Andreas Gampe51de69e2019-04-19 15:14:14 -0700270
271 // Run verification on the method. Returns true if verification completes and false if the input
272 // has an irrecoverable corruption.
Andreas Gampefc25ae92019-04-19 22:22:57 -0700273 virtual bool Verify() REQUIRES_SHARED(Locks::mutator_lock_) = 0;
274 static MethodVerifier* CreateVerifier(Thread* self,
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000275 VerifierDeps* verifier_deps,
Andreas Gampefc25ae92019-04-19 22:22:57 -0700276 const DexFile* dex_file,
277 Handle<mirror::DexCache> dex_cache,
278 Handle<mirror::ClassLoader> class_loader,
279 const dex::ClassDef& class_def,
280 const dex::CodeItem* code_item,
281 uint32_t method_idx,
Andreas Gampefc25ae92019-04-19 22:22:57 -0700282 uint32_t access_flags,
283 bool can_load_classes,
Andreas Gampefc25ae92019-04-19 22:22:57 -0700284 bool verify_to_dump,
285 bool allow_thread_suspension,
286 uint32_t api_level)
287 REQUIRES_SHARED(Locks::mutator_lock_);
Andreas Gampe51de69e2019-04-19 15:14:14 -0700288
Nicolas Geoffraycd133d82021-06-25 16:10:39 +0100289 virtual bool PotentiallyMarkRuntimeThrow() = 0;
Nicolas Geoffray44dc8a32021-06-21 15:23:49 +0100290
Ian Rogers7b078e82014-09-10 14:44:24 -0700291 // The thread we're verifying on.
292 Thread* const self_;
293
Mathieu Chartierde40d472015-10-15 17:47:48 -0700294 // Arena allocator.
295 ArenaStack arena_stack_;
Vladimir Marko69d310e2017-10-09 14:12:23 +0100296 ScopedArenaAllocator allocator_;
Mathieu Chartierde40d472015-10-15 17:47:48 -0700297
Ian Rogers776ac1f2012-04-13 23:36:36 -0700298 RegTypeCache reg_types_;
299
300 PcToRegisterLineTable reg_table_;
301
302 // Storage for the register status we're currently working on.
Mathieu Chartier361e04a2016-02-16 14:06:35 -0800303 RegisterLineArenaUniquePtr work_line_;
Ian Rogers776ac1f2012-04-13 23:36:36 -0700304
305 // The address of the instruction we're currently working on, note that this is in 2 byte
306 // quantities
307 uint32_t work_insn_idx_;
308
309 // Storage for the register status we're saving for later.
Mathieu Chartier361e04a2016-02-16 14:06:35 -0800310 RegisterLineArenaUniquePtr saved_line_;
Ian Rogers776ac1f2012-04-13 23:36:36 -0700311
Nicolas Geoffray1960c422020-11-04 08:45:32 +0000312 const uint32_t dex_method_idx_; // The method we're working on.
313 const DexFile* const dex_file_; // The dex file containing the method.
314 const dex::ClassDef& class_def_; // The class being verified.
Mathieu Chartier3da1d0f2017-11-06 20:02:24 -0800315 const CodeItemDataAccessor code_item_accessor_;
Andreas Gampefc25ae92019-04-19 22:22:57 -0700316
Ian Rogers7b3ddd22013-02-21 15:19:52 -0800317 // Instruction widths and flags, one entry per code unit.
Mathieu Chartierde40d472015-10-15 17:47:48 -0700318 // Owned, but not unique_ptr since insn_flags_ are allocated in arenas.
319 ArenaUniquePtr<InstructionFlags[]> insn_flags_;
Elliott Hughes08fc03a2012-06-26 17:34:00 -0700320
Ian Rogersad0b3a32012-04-16 14:50:24 -0700321 // The types of any error that occurs.
322 std::vector<VerifyError> failures_;
323 // Error messages associated with failures.
324 std::vector<std::ostringstream*> failure_messages_;
Andreas Gampe43884b22019-06-27 14:05:52 -0700325 struct {
326 // Is there a pending hard failure?
327 bool have_pending_hard_failure_ : 1;
Ian Rogers776ac1f2012-04-13 23:36:36 -0700328
Andreas Gampe43884b22019-06-27 14:05:52 -0700329 // Is there a pending runtime throw failure? A runtime throw failure is when an instruction
330 // would fail at runtime throwing an exception. Such an instruction causes the following code
331 // to be unreachable. This is set by Fail and used to ensure we don't process unreachable
332 // instructions that would hard fail the verification.
333 // Note: this flag is reset after processing each instruction.
334 bool have_pending_runtime_throw_failure_ : 1;
335
Andreas Gampefef91cc2019-07-25 14:13:23 -0700336 // Verify in AoT mode?
337 bool aot_mode_ : 1;
Andreas Gampe43884b22019-06-27 14:05:52 -0700338 } flags_;
Andreas Gamped12e7822015-06-25 10:26:40 -0700339
Ian Rogersad0b3a32012-04-16 14:50:24 -0700340 // Info message log use primarily for verifier diagnostics.
Ian Rogers776ac1f2012-04-13 23:36:36 -0700341 std::ostringstream info_messages_;
342
Andreas Gampe0760a812015-08-26 17:12:51 -0700343 // Bitset of the encountered failure types. Bits are according to the values in VerifyError.
344 uint32_t encountered_failure_types_;
345
Elliott Hughes80537bb2013-01-04 16:37:26 -0800346 const bool can_load_classes_;
Jeff Haoee988952013-04-16 14:23:47 -0700347
Andreas Gampee0bbab92019-07-25 12:28:22 -0700348 // Classlinker to use when resolving.
349 ClassLinker* class_linker_;
350
Nicolas Geoffray5b0b2e12021-03-19 14:48:40 +0000351 // The verifier deps object we are going to report type assigability
352 // constraints to. Can be null for runtime verification.
353 VerifierDeps* verifier_deps_;
354
Mathieu Chartierd0ad2ee2015-03-31 14:59:59 -0700355 // Link, for the method verifier root linked list.
356 MethodVerifier* link_;
357
358 friend class art::Thread;
Andreas Gampea43ba3d2019-03-13 15:49:20 -0700359 friend class ClassVerifier;
David Brazdilca3c8c32016-09-06 14:04:48 +0100360 friend class VerifierDepsTest;
Jeff Hao848f70a2014-01-15 13:49:50 -0800361
Ian Rogers8e1f4f82014-11-05 11:07:30 -0800362 DISALLOW_COPY_AND_ASSIGN(MethodVerifier);
Ian Rogers776ac1f2012-04-13 23:36:36 -0700363};
Ian Rogers776ac1f2012-04-13 23:36:36 -0700364
365} // namespace verifier
366} // namespace art
367
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700368#endif // ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_