1 /* 2 * Copyright (C) 2016 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_MIRROR_METHOD_HANDLE_IMPL_INL_H_ 18 #define ART_RUNTIME_MIRROR_METHOD_HANDLE_IMPL_INL_H_ 19 20 #include "method_handle_impl.h" 21 22 #include "art_method-inl.h" 23 #include "object-inl.h" 24 25 namespace art { 26 namespace mirror { 27 GetHandleKind()28inline MethodHandle::Kind MethodHandle::GetHandleKind() REQUIRES_SHARED(Locks::mutator_lock_) { 29 const int32_t handle_kind = GetField32(OFFSET_OF_OBJECT_MEMBER(MethodHandle, handle_kind_)); 30 DCHECK(handle_kind >= 0 && handle_kind <= static_cast<int32_t>(Kind::kLastValidKind)); 31 return static_cast<Kind>(handle_kind); 32 } 33 GetMethodType()34inline ObjPtr<mirror::MethodType> MethodHandle::GetMethodType() 35 REQUIRES_SHARED(Locks::mutator_lock_) { 36 return GetFieldObject<mirror::MethodType>(OFFSET_OF_OBJECT_MEMBER(MethodHandle, method_type_)); 37 } 38 GetAsTypeCache()39inline ObjPtr<mirror::MethodHandle> MethodHandle::GetAsTypeCache() 40 REQUIRES_SHARED(Locks::mutator_lock_) { 41 return GetFieldObject<mirror::MethodHandle>( 42 OFFSET_OF_OBJECT_MEMBER(MethodHandle, as_type_cache_)); 43 } 44 GetTargetField()45inline ArtField* MethodHandle::GetTargetField() REQUIRES_SHARED(Locks::mutator_lock_) { 46 return reinterpret_cast<ArtField*>( 47 GetField64(OFFSET_OF_OBJECT_MEMBER(MethodHandle, art_field_or_method_))); 48 } 49 GetTargetMethod()50inline ArtMethod* MethodHandle::GetTargetMethod() REQUIRES_SHARED(Locks::mutator_lock_) { 51 return reinterpret_cast<ArtMethod*>( 52 GetField64(OFFSET_OF_OBJECT_MEMBER(MethodHandle, art_field_or_method_))); 53 } 54 55 } // namespace mirror 56 } // namespace art 57 58 #endif // ART_RUNTIME_MIRROR_METHOD_HANDLE_IMPL_INL_H_ 59