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