| Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2011 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_SRC_MIRROR_FIELD_INL_H_ |
| 18 | #define ART_SRC_MIRROR_FIELD_INL_H_ |
| 19 | |
| 20 | #include "field.h" |
| 21 | |
| 22 | namespace art { |
| 23 | namespace mirror { |
| 24 | |
| 25 | inline Class* Field::GetDeclaringClass() const { |
| 26 | Class* result = GetFieldObject<Class*>(OFFSET_OF_OBJECT_MEMBER(Field, declaring_class_), false); |
| 27 | DCHECK(result != NULL); |
| 28 | DCHECK(result->IsLoaded() || result->IsErroneous()); |
| 29 | return result; |
| 30 | } |
| 31 | |
| 32 | inline void Field::SetDeclaringClass(Class *new_declaring_class) { |
| 33 | SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Field, declaring_class_), new_declaring_class, false); |
| 34 | } |
| 35 | |
| 36 | inline uint32_t Field::GetAccessFlags() const { |
| 37 | DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); |
| 38 | return GetField32(OFFSET_OF_OBJECT_MEMBER(Field, access_flags_), false); |
| 39 | } |
| 40 | |
| 41 | inline MemberOffset Field::GetOffset() const { |
| 42 | DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous()); |
| 43 | return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), false)); |
| 44 | } |
| 45 | |
| 46 | inline MemberOffset Field::GetOffsetDuringLinking() const { |
| 47 | DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); |
| 48 | return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), false)); |
| 49 | } |
| 50 | |
| 51 | } // namespace mirror |
| 52 | } // namespace art |
| 53 | |
| 54 | #endif // ART_SRC_MIRROR_FIELD_INL_H_ |