Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 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 | |
| 25 | namespace art { |
| 26 | namespace verifier { |
| 27 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 28 | inline const DexFile::CodeItem* MethodVerifier::CodeItem() const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 29 | return code_item_; |
| 30 | } |
| 31 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 32 | inline RegisterLine* MethodVerifier::GetRegLine(uint32_t dex_pc) { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 33 | return reg_table_.GetLine(dex_pc); |
| 34 | } |
| 35 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 36 | inline const InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 37 | return insn_flags_[index]; |
| 38 | } |
| 39 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 40 | inline mirror::ClassLoader* MethodVerifier::GetClassLoader() { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 41 | return class_loader_->get(); |
| 42 | } |
| 43 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 44 | inline mirror::DexCache* MethodVerifier::GetDexCache() { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 45 | return dex_cache_->get(); |
| 46 | } |
| 47 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 48 | inline MethodReference MethodVerifier::GetMethodReference() const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 49 | return MethodReference(dex_file_, dex_method_idx_); |
| 50 | } |
| 51 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 52 | inline uint32_t MethodVerifier::GetAccessFlags() const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 53 | return method_access_flags_; |
| 54 | } |
| 55 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 56 | inline bool MethodVerifier::HasCheckCasts() const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 57 | return has_check_casts_; |
| 58 | } |
| 59 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 60 | inline bool MethodVerifier::HasVirtualOrInterfaceInvokes() const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 61 | return has_virtual_or_interface_invokes_; |
| 62 | } |
| 63 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 64 | inline bool MethodVerifier::HasFailures() const { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 65 | return !failure_messages_.empty(); |
| 66 | } |
| 67 | |
Vladimir Marko | 0f98205 | 2014-01-21 19:08:16 +0000 | [diff] [blame^] | 68 | inline const RegType& MethodVerifier::ResolveCheckedClass(uint32_t class_idx) { |
Vladimir Marko | 2b5eaa2 | 2013-12-13 13:59:30 +0000 | [diff] [blame] | 69 | DCHECK(!HasFailures()); |
| 70 | const RegType& result = ResolveClassAndCheckAccess(class_idx); |
| 71 | DCHECK(!HasFailures()); |
| 72 | return result; |
| 73 | } |
| 74 | |
| 75 | } // namespace verifier |
| 76 | } // namespace art |
| 77 | |
| 78 | #endif // ART_RUNTIME_VERIFIER_METHOD_VERIFIER_INL_H_ |