blob: 62ecf4b49f8ef3d1f384d386d65b68781343e490 [file] [log] [blame]
Vladimir Marko2b5eaa22013-12-13 13:59:30 +00001/*
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 Chartiereb8167a2014-05-07 15:43:14 -070024#include "handle_scope-inl.h"
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000025
26namespace art {
27namespace verifier {
28
Vladimir Marko0f982052014-01-21 19:08:16 +000029inline const DexFile::CodeItem* MethodVerifier::CodeItem() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000030 return code_item_;
31}
32
Vladimir Marko0f982052014-01-21 19:08:16 +000033inline RegisterLine* MethodVerifier::GetRegLine(uint32_t dex_pc) {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000034 return reg_table_.GetLine(dex_pc);
35}
36
Vladimir Marko0f982052014-01-21 19:08:16 +000037inline const InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000038 return insn_flags_[index];
39}
40
Vladimir Marko0f982052014-01-21 19:08:16 +000041inline mirror::ClassLoader* MethodVerifier::GetClassLoader() {
Mathieu Chartiereb8167a2014-05-07 15:43:14 -070042 return class_loader_->Get();
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000043}
44
Vladimir Marko0f982052014-01-21 19:08:16 +000045inline mirror::DexCache* MethodVerifier::GetDexCache() {
Mathieu Chartiereb8167a2014-05-07 15:43:14 -070046 return dex_cache_->Get();
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000047}
48
Vladimir Marko0f982052014-01-21 19:08:16 +000049inline MethodReference MethodVerifier::GetMethodReference() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000050 return MethodReference(dex_file_, dex_method_idx_);
51}
52
Vladimir Marko0f982052014-01-21 19:08:16 +000053inline uint32_t MethodVerifier::GetAccessFlags() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000054 return method_access_flags_;
55}
56
Vladimir Marko0f982052014-01-21 19:08:16 +000057inline bool MethodVerifier::HasCheckCasts() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000058 return has_check_casts_;
59}
60
Vladimir Marko0f982052014-01-21 19:08:16 +000061inline bool MethodVerifier::HasVirtualOrInterfaceInvokes() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000062 return has_virtual_or_interface_invokes_;
63}
64
Vladimir Marko0f982052014-01-21 19:08:16 +000065inline bool MethodVerifier::HasFailures() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000066 return !failure_messages_.empty();
67}
68
Vladimir Marko0f982052014-01-21 19:08:16 +000069inline const RegType& MethodVerifier::ResolveCheckedClass(uint32_t class_idx) {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000070 DCHECK(!HasFailures());
71 const 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_