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 
GetClassLoader()41 inline mirror::ClassLoader* MethodVerifier::GetClassLoader() {
42   return class_loader_->Get();
43 }
44 
GetDexCache()45 inline mirror::DexCache* MethodVerifier::GetDexCache() {
46   return dex_cache_->Get();
47 }
48 
GetMethodReference()49 inline MethodReference MethodVerifier::GetMethodReference() const {
50   return MethodReference(dex_file_, dex_method_idx_);
51 }
52 
GetAccessFlags()53 inline uint32_t MethodVerifier::GetAccessFlags() const {
54   return method_access_flags_;
55 }
56 
HasCheckCasts()57 inline bool MethodVerifier::HasCheckCasts() const {
58   return has_check_casts_;
59 }
60 
HasVirtualOrInterfaceInvokes()61 inline bool MethodVerifier::HasVirtualOrInterfaceInvokes() const {
62   return has_virtual_or_interface_invokes_;
63 }
64 
HasFailures()65 inline bool MethodVerifier::HasFailures() const {
66   return !failure_messages_.empty();
67 }
68 
ResolveCheckedClass(uint32_t class_idx)69 inline RegType& MethodVerifier::ResolveCheckedClass(uint32_t class_idx) {
70   DCHECK(!HasFailures());
71   RegType& result = ResolveClassAndCheckAccess(class_idx);
72   DCHECK(!HasFailures());
73   return result;
74 }
75 
76 }  // namespace verifier
77 }  // namespace art
78 
79 #endif  // ART_RUNTIME_VERIFIER_METHOD_VERIFIER_INL_H_
80