1 /*
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"
24 #include "handle_scope-inl.h"
25 
26 namespace art {
27 namespace verifier {
28 
CodeItem()29 inline const DexFile::CodeItem* MethodVerifier::CodeItem() const {
30   return code_item_;
31 }
32 
GetRegLine(uint32_t dex_pc)33 inline RegisterLine* MethodVerifier::GetRegLine(uint32_t dex_pc) {
34   return reg_table_.GetLine(dex_pc);
35 }
36 
GetInstructionFlags(size_t index)37 inline const InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) const {
38   return insn_flags_[index];
39 }
40 
GetInstructionFlags(size_t index)41 inline InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) {
42   return insn_flags_[index];
43 }
44 
GetClassLoader()45 inline mirror::ClassLoader* MethodVerifier::GetClassLoader() {
46   return class_loader_.Get();
47 }
48 
GetDexCache()49 inline mirror::DexCache* MethodVerifier::GetDexCache() {
50   return dex_cache_.Get();
51 }
52 
GetMethod()53 inline ArtMethod* MethodVerifier::GetMethod() const {
54   return mirror_method_;
55 }
56 
GetMethodReference()57 inline MethodReference MethodVerifier::GetMethodReference() const {
58   return MethodReference(dex_file_, dex_method_idx_);
59 }
60 
GetAccessFlags()61 inline uint32_t MethodVerifier::GetAccessFlags() const {
62   return method_access_flags_;
63 }
64 
HasCheckCasts()65 inline bool MethodVerifier::HasCheckCasts() const {
66   return has_check_casts_;
67 }
68 
HasVirtualOrInterfaceInvokes()69 inline bool MethodVerifier::HasVirtualOrInterfaceInvokes() const {
70   return has_virtual_or_interface_invokes_;
71 }
72 
HasFailures()73 inline bool MethodVerifier::HasFailures() const {
74   return !failure_messages_.empty();
75 }
76 
ResolveCheckedClass(dex::TypeIndex class_idx)77 inline const RegType& MethodVerifier::ResolveCheckedClass(dex::TypeIndex class_idx) {
78   DCHECK(!HasFailures());
79   const RegType& result = ResolveClassAndCheckAccess(class_idx);
80   DCHECK(!HasFailures());
81   return result;
82 }
83 
84 }  // namespace verifier
85 }  // namespace art
86 
87 #endif  // ART_RUNTIME_VERIFIER_METHOD_VERIFIER_INL_H_
88