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