Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 1 | /* |
| 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 Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame^] | 22 | #include "read_barrier-inl.h" |
| 23 | |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 24 | namespace art { |
| 25 | |
Hiroshi Yamauchi | ab08811 | 2014-07-14 13:00:14 -0700 | [diff] [blame] | 26 | inline QuickMethodFrameInfo Runtime::GetRuntimeMethodFrameInfo(mirror::ArtMethod* method) { |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 27 | 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 Yamauchi | ab08811 | 2014-07-14 13:00:14 -0700 | [diff] [blame] | 32 | if (method == GetCalleeSaveMethodUnchecked(Runtime::kRefsAndArgs)) { |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 33 | return GetCalleeSaveMethodFrameInfo(Runtime::kRefsAndArgs); |
Hiroshi Yamauchi | ab08811 | 2014-07-14 13:00:14 -0700 | [diff] [blame] | 34 | } else if (method == GetCalleeSaveMethodUnchecked(Runtime::kSaveAll)) { |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 35 | return GetCalleeSaveMethodFrameInfo(Runtime::kSaveAll); |
| 36 | } else { |
Hiroshi Yamauchi | ab08811 | 2014-07-14 13:00:14 -0700 | [diff] [blame] | 37 | DCHECK(method == GetCalleeSaveMethodUnchecked(Runtime::kRefsOnly)); |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 38 | return GetCalleeSaveMethodFrameInfo(Runtime::kRefsOnly); |
| 39 | } |
| 40 | } |
| 41 | |
Ian Rogers | e63db27 | 2014-07-15 15:36:11 -0700 | [diff] [blame^] | 42 | inline mirror::ArtMethod* Runtime::GetResolutionMethod() { |
| 43 | CHECK(HasResolutionMethod()); |
| 44 | return ReadBarrier::BarrierForRoot<mirror::ArtMethod, kWithReadBarrier>(&resolution_method_); |
| 45 | } |
| 46 | |
| 47 | inline mirror::ArtMethod* Runtime::GetImtConflictMethod() { |
| 48 | CHECK(HasImtConflictMethod()); |
| 49 | return ReadBarrier::BarrierForRoot<mirror::ArtMethod, kWithReadBarrier>(&imt_conflict_method_); |
| 50 | } |
| 51 | |
| 52 | inline mirror::ObjectArray<mirror::ArtMethod>* Runtime::GetDefaultImt() |
| 53 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 54 | CHECK(HasDefaultImt()); |
| 55 | return ReadBarrier::BarrierForRoot<mirror::ObjectArray<mirror::ArtMethod>, kWithReadBarrier>( |
| 56 | &default_imt_); |
| 57 | } |
| 58 | |
| 59 | inline mirror::ArtMethod* Runtime::GetCalleeSaveMethod(CalleeSaveType type) |
| 60 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 61 | DCHECK(HasCalleeSaveMethod(type)); |
| 62 | return ReadBarrier::BarrierForRoot<mirror::ArtMethod, kWithReadBarrier>( |
| 63 | &callee_save_methods_[type]); |
| 64 | } |
| 65 | |
| 66 | inline mirror::ArtMethod* Runtime::GetCalleeSaveMethodUnchecked(CalleeSaveType type) |
| 67 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
| 68 | return ReadBarrier::BarrierForRoot<mirror::ArtMethod, kWithReadBarrier>( |
| 69 | &callee_save_methods_[type]); |
| 70 | } |
| 71 | |
Vladimir Marko | 7624d25 | 2014-05-02 14:40:15 +0100 | [diff] [blame] | 72 | } // namespace art |
| 73 | |
| 74 | #endif // ART_RUNTIME_RUNTIME_INL_H_ |