blob: 001598f92dd2d4863fb58d7749dcf0a16d211935 [file] [log] [blame]
Vladimir Marko7624d252014-05-02 14:40:15 +01001/*
2 * Copyright (C) 2014 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_RUNTIME_INL_H_
18#define ART_RUNTIME_RUNTIME_INL_H_
19
20#include "runtime.h"
21
Ian Rogerse63db272014-07-15 15:36:11 -070022#include "read_barrier-inl.h"
23
Vladimir Marko7624d252014-05-02 14:40:15 +010024namespace art {
25
Hiroshi Yamauchiab088112014-07-14 13:00:14 -070026inline QuickMethodFrameInfo Runtime::GetRuntimeMethodFrameInfo(mirror::ArtMethod* method) {
Vladimir Marko7624d252014-05-02 14:40:15 +010027 DCHECK(method != nullptr);
28 // Cannot be imt-conflict-method or resolution-method.
29 DCHECK(method != GetImtConflictMethod());
30 DCHECK(method != GetResolutionMethod());
31 // Don't use GetCalleeSaveMethod(), some tests don't set all callee save methods.
Hiroshi Yamauchiab088112014-07-14 13:00:14 -070032 if (method == GetCalleeSaveMethodUnchecked(Runtime::kRefsAndArgs)) {
Vladimir Marko7624d252014-05-02 14:40:15 +010033 return GetCalleeSaveMethodFrameInfo(Runtime::kRefsAndArgs);
Hiroshi Yamauchiab088112014-07-14 13:00:14 -070034 } else if (method == GetCalleeSaveMethodUnchecked(Runtime::kSaveAll)) {
Vladimir Marko7624d252014-05-02 14:40:15 +010035 return GetCalleeSaveMethodFrameInfo(Runtime::kSaveAll);
36 } else {
Hiroshi Yamauchiab088112014-07-14 13:00:14 -070037 DCHECK(method == GetCalleeSaveMethodUnchecked(Runtime::kRefsOnly));
Vladimir Marko7624d252014-05-02 14:40:15 +010038 return GetCalleeSaveMethodFrameInfo(Runtime::kRefsOnly);
39 }
40}
41
Ian Rogerse63db272014-07-15 15:36:11 -070042inline mirror::ArtMethod* Runtime::GetResolutionMethod() {
43 CHECK(HasResolutionMethod());
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070044 return resolution_method_.Read();
Ian Rogerse63db272014-07-15 15:36:11 -070045}
46
47inline mirror::ArtMethod* Runtime::GetImtConflictMethod() {
48 CHECK(HasImtConflictMethod());
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070049 return imt_conflict_method_.Read();
Ian Rogerse63db272014-07-15 15:36:11 -070050}
51
Mathieu Chartier1fb463e2014-10-23 16:48:06 -070052inline mirror::ArtMethod* Runtime::GetImtUnimplementedMethod() {
53 CHECK(!imt_unimplemented_method_.IsNull());
54 return imt_unimplemented_method_.Read();
55}
56
Ian Rogerse63db272014-07-15 15:36:11 -070057inline mirror::ObjectArray<mirror::ArtMethod>* Runtime::GetDefaultImt()
58 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
59 CHECK(HasDefaultImt());
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070060 return default_imt_.Read();
Ian Rogerse63db272014-07-15 15:36:11 -070061}
62
63inline mirror::ArtMethod* Runtime::GetCalleeSaveMethod(CalleeSaveType type)
64 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
65 DCHECK(HasCalleeSaveMethod(type));
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070066 return callee_save_methods_[type].Read();
Ian Rogerse63db272014-07-15 15:36:11 -070067}
68
69inline mirror::ArtMethod* Runtime::GetCalleeSaveMethodUnchecked(CalleeSaveType type)
70 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Hiroshi Yamauchi94f7b492014-07-22 18:08:23 -070071 return callee_save_methods_[type].Read();
Ian Rogerse63db272014-07-15 15:36:11 -070072}
73
Vladimir Marko7624d252014-05-02 14:40:15 +010074} // namespace art
75
76#endif // ART_RUNTIME_RUNTIME_INL_H_