blob: 363bd8f54fb30f57cc5270c8b93c9c836fde70c6 [file] [log] [blame]
Vladimir Marko2b5eaa22013-12-13 13:59:30 +00001/*
2 * Copyright (C) 2013 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
17#ifndef ART_RUNTIME_VERIFIER_METHOD_VERIFIER_INL_H_
18#define ART_RUNTIME_VERIFIER_METHOD_VERIFIER_INL_H_
19
20#include "base/logging.h"
21#include "method_verifier.h"
22#include "mirror/class_loader.h"
23#include "mirror/dex_cache.h"
Mathieu Chartiereb8167a2014-05-07 15:43:14 -070024#include "handle_scope-inl.h"
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000025
26namespace art {
27namespace verifier {
28
Vladimir Marko0f982052014-01-21 19:08:16 +000029inline const DexFile::CodeItem* MethodVerifier::CodeItem() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000030 return code_item_;
31}
32
Vladimir Marko0f982052014-01-21 19:08:16 +000033inline RegisterLine* MethodVerifier::GetRegLine(uint32_t dex_pc) {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000034 return reg_table_.GetLine(dex_pc);
35}
36
Vladimir Marko0f982052014-01-21 19:08:16 +000037inline const InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000038 return insn_flags_[index];
39}
40
Mathieu Chartierde40d472015-10-15 17:47:48 -070041inline InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) {
42 return insn_flags_[index];
43}
44
Vladimir Marko0f982052014-01-21 19:08:16 +000045inline mirror::ClassLoader* MethodVerifier::GetClassLoader() {
Mathieu Chartierbf99f772014-08-23 16:37:27 -070046 return class_loader_.Get();
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000047}
48
Vladimir Marko0f982052014-01-21 19:08:16 +000049inline mirror::DexCache* MethodVerifier::GetDexCache() {
Mathieu Chartierbf99f772014-08-23 16:37:27 -070050 return dex_cache_.Get();
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000051}
52
Vladimir Markobe10e8e2016-01-22 12:09:44 +000053inline ArtMethod* MethodVerifier::GetMethod() const {
54 return mirror_method_;
55}
56
Vladimir Marko0f982052014-01-21 19:08:16 +000057inline MethodReference MethodVerifier::GetMethodReference() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000058 return MethodReference(dex_file_, dex_method_idx_);
59}
60
Vladimir Marko0f982052014-01-21 19:08:16 +000061inline uint32_t MethodVerifier::GetAccessFlags() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000062 return method_access_flags_;
63}
64
Vladimir Marko0f982052014-01-21 19:08:16 +000065inline bool MethodVerifier::HasCheckCasts() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000066 return has_check_casts_;
67}
68
Vladimir Marko0f982052014-01-21 19:08:16 +000069inline bool MethodVerifier::HasVirtualOrInterfaceInvokes() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000070 return has_virtual_or_interface_invokes_;
71}
72
Vladimir Marko0f982052014-01-21 19:08:16 +000073inline bool MethodVerifier::HasFailures() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000074 return !failure_messages_.empty();
75}
76
Andreas Gampea5b09a62016-11-17 15:21:22 -080077inline const RegType& MethodVerifier::ResolveCheckedClass(dex::TypeIndex class_idx) {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000078 DCHECK(!HasFailures());
Ian Rogersd8f69b02014-09-10 21:43:52 +000079 const RegType& result = ResolveClassAndCheckAccess(class_idx);
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000080 DCHECK(!HasFailures());
81 return result;
82}
83
84} // namespace verifier
85} // namespace art
86
87#endif // ART_RUNTIME_VERIFIER_METHOD_VERIFIER_INL_H_