blob: 74c3e33531c933ff9c558afbd656e22baeb74d9a [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"
24
25namespace art {
26namespace verifier {
27
Vladimir Marko0f982052014-01-21 19:08:16 +000028inline const DexFile::CodeItem* MethodVerifier::CodeItem() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000029 return code_item_;
30}
31
Vladimir Marko0f982052014-01-21 19:08:16 +000032inline RegisterLine* MethodVerifier::GetRegLine(uint32_t dex_pc) {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000033 return reg_table_.GetLine(dex_pc);
34}
35
Vladimir Marko0f982052014-01-21 19:08:16 +000036inline const InstructionFlags& MethodVerifier::GetInstructionFlags(size_t index) const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000037 return insn_flags_[index];
38}
39
Vladimir Marko0f982052014-01-21 19:08:16 +000040inline mirror::ClassLoader* MethodVerifier::GetClassLoader() {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000041 return class_loader_->get();
42}
43
Vladimir Marko0f982052014-01-21 19:08:16 +000044inline mirror::DexCache* MethodVerifier::GetDexCache() {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000045 return dex_cache_->get();
46}
47
Vladimir Marko0f982052014-01-21 19:08:16 +000048inline MethodReference MethodVerifier::GetMethodReference() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000049 return MethodReference(dex_file_, dex_method_idx_);
50}
51
Vladimir Marko0f982052014-01-21 19:08:16 +000052inline uint32_t MethodVerifier::GetAccessFlags() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000053 return method_access_flags_;
54}
55
Vladimir Marko0f982052014-01-21 19:08:16 +000056inline bool MethodVerifier::HasCheckCasts() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000057 return has_check_casts_;
58}
59
Vladimir Marko0f982052014-01-21 19:08:16 +000060inline bool MethodVerifier::HasVirtualOrInterfaceInvokes() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000061 return has_virtual_or_interface_invokes_;
62}
63
Vladimir Marko0f982052014-01-21 19:08:16 +000064inline bool MethodVerifier::HasFailures() const {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000065 return !failure_messages_.empty();
66}
67
Vladimir Marko0f982052014-01-21 19:08:16 +000068inline const RegType& MethodVerifier::ResolveCheckedClass(uint32_t class_idx) {
Vladimir Marko2b5eaa22013-12-13 13:59:30 +000069 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_