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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_MIRROR_OBJECT_ARRAY_INL_H_ |
| 18 | #define ART_RUNTIME_MIRROR_OBJECT_ARRAY_INL_H_ |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 19 | |
| 20 | #include "object_array.h" |
| 21 | |
Ian Rogers | 7e70b00 | 2014-10-08 11:47:24 -0700 | [diff] [blame] | 22 | #include "array-inl.h" |
Ian Rogers | 576ca0c | 2014-06-06 15:58:22 -0700 | [diff] [blame] | 23 | #include "base/stringprintf.h" |
Ian Rogers | 1d54e73 | 2013-05-02 21:10:01 -0700 | [diff] [blame] | 24 | #include "gc/heap.h" |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 25 | #include "mirror/art_field.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 26 | #include "mirror/class.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 27 | #include "runtime.h" |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 28 | #include "handle_scope-inl.h" |
Sebastien Hertz | 6bdd8f4 | 2013-05-17 14:44:01 +0200 | [diff] [blame] | 29 | #include "thread.h" |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 30 | #include <string> |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 31 | |
| 32 | namespace art { |
| 33 | namespace mirror { |
| 34 | |
| 35 | template<class T> |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 36 | inline ObjectArray<T>* ObjectArray<T>::Alloc(Thread* self, Class* object_array_class, |
| 37 | int32_t length, gc::AllocatorType allocator_type) { |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 38 | Array* array = Array::Alloc<true>(self, object_array_class, length, |
Hiroshi Yamauchi | f0edfc3 | 2014-09-25 11:46:46 -0700 | [diff] [blame] | 39 | ComponentSizeShiftWidth<sizeof(HeapReference<Object>)>(), |
| 40 | allocator_type); |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 41 | if (UNLIKELY(array == nullptr)) { |
| 42 | return nullptr; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 43 | } else { |
Hiroshi Yamauchi | f0edfc3 | 2014-09-25 11:46:46 -0700 | [diff] [blame] | 44 | DCHECK_EQ(array->GetClass()->GetComponentSizeShift(), |
| 45 | ComponentSizeShiftWidth<sizeof(HeapReference<Object>)>()); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 46 | return array->AsObjectArray<T>(); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | template<class T> |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 51 | inline ObjectArray<T>* ObjectArray<T>::Alloc(Thread* self, Class* object_array_class, |
| 52 | int32_t length) { |
| 53 | return Alloc(self, object_array_class, length, |
| 54 | Runtime::Current()->GetHeap()->GetCurrentAllocator()); |
| 55 | } |
| 56 | |
| 57 | template<class T> |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 58 | inline T* ObjectArray<T>::Get(int32_t i) { |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 59 | if (!CheckIsValidIndex(i)) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 60 | DCHECK(Thread::Current()->IsExceptionPending()); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 61 | return NULL; |
| 62 | } |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 63 | return GetFieldObject<T>(OffsetOfElement(i)); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 64 | } |
| 65 | |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 66 | template<class T> template<VerifyObjectFlags kVerifyFlags> |
Sebastien Hertz | 6bdd8f4 | 2013-05-17 14:44:01 +0200 | [diff] [blame] | 67 | inline bool ObjectArray<T>::CheckAssignable(T* object) { |
| 68 | if (object != NULL) { |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 69 | Class* element_class = GetClass<kVerifyFlags>()->GetComponentType(); |
Sebastien Hertz | 6bdd8f4 | 2013-05-17 14:44:01 +0200 | [diff] [blame] | 70 | if (UNLIKELY(!object->InstanceOf(element_class))) { |
| 71 | ThrowArrayStoreException(object); |
| 72 | return false; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 73 | } |
Sebastien Hertz | 6bdd8f4 | 2013-05-17 14:44:01 +0200 | [diff] [blame] | 74 | } |
| 75 | return true; |
| 76 | } |
| 77 | |
| 78 | template<class T> |
| 79 | inline void ObjectArray<T>::Set(int32_t i, T* object) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 80 | if (Runtime::Current()->IsActiveTransaction()) { |
| 81 | Set<true>(i, object); |
| 82 | } else { |
| 83 | Set<false>(i, object); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | template<class T> |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 88 | template<bool kTransactionActive, bool kCheckTransaction, VerifyObjectFlags kVerifyFlags> |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 89 | inline void ObjectArray<T>::Set(int32_t i, T* object) { |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 90 | if (CheckIsValidIndex(i) && CheckAssignable<kVerifyFlags>(object)) { |
| 91 | SetFieldObject<kTransactionActive, kCheckTransaction, kVerifyFlags>(OffsetOfElement(i), object); |
Sebastien Hertz | 6bdd8f4 | 2013-05-17 14:44:01 +0200 | [diff] [blame] | 92 | } else { |
| 93 | DCHECK(Thread::Current()->IsExceptionPending()); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 94 | } |
| 95 | } |
| 96 | |
| 97 | template<class T> |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 98 | template<bool kTransactionActive, bool kCheckTransaction, VerifyObjectFlags kVerifyFlags> |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 99 | inline void ObjectArray<T>::SetWithoutChecks(int32_t i, T* object) { |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 100 | DCHECK(CheckIsValidIndex<kVerifyFlags>(i)); |
| 101 | DCHECK(CheckAssignable<static_cast<VerifyObjectFlags>(kVerifyFlags & ~kVerifyThis)>(object)); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 102 | SetFieldObject<kTransactionActive, kCheckTransaction, kVerifyFlags>(OffsetOfElement(i), object); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | template<class T> |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 106 | template<bool kTransactionActive, bool kCheckTransaction, VerifyObjectFlags kVerifyFlags> |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 107 | inline void ObjectArray<T>::SetWithoutChecksAndWriteBarrier(int32_t i, T* object) { |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 108 | DCHECK(CheckIsValidIndex<kVerifyFlags>(i)); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 109 | // TODO: enable this check. It fails when writing the image in ImageWriter::FixupObjectArray. |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 110 | // DCHECK(CheckAssignable(object)); |
Mathieu Chartier | 4e30541 | 2014-02-19 10:54:44 -0800 | [diff] [blame] | 111 | SetFieldObjectWithoutWriteBarrier<kTransactionActive, kCheckTransaction, kVerifyFlags>( |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 112 | OffsetOfElement(i), object); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | template<class T> |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 116 | inline T* ObjectArray<T>::GetWithoutChecks(int32_t i) { |
Sebastien Hertz | abff643 | 2014-01-27 18:01:39 +0100 | [diff] [blame] | 117 | DCHECK(CheckIsValidIndex(i)); |
Ian Rogers | b0fa5dc | 2014-04-28 16:47:08 -0700 | [diff] [blame] | 118 | return GetFieldObject<T>(OffsetOfElement(i)); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | template<class T> |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 122 | inline void ObjectArray<T>::AssignableMemmove(int32_t dst_pos, ObjectArray<T>* src, |
| 123 | int32_t src_pos, int32_t count) { |
| 124 | if (kIsDebugBuild) { |
| 125 | for (int i = 0; i < count; ++i) { |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 126 | // The get will perform the VerifyObject. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 127 | src->GetWithoutChecks(src_pos + i); |
| 128 | } |
| 129 | } |
| 130 | // Perform the memmove using int memmove then perform the write barrier. |
| 131 | CHECK_EQ(sizeof(HeapReference<T>), sizeof(uint32_t)); |
| 132 | IntArray* dstAsIntArray = reinterpret_cast<IntArray*>(this); |
| 133 | IntArray* srcAsIntArray = reinterpret_cast<IntArray*>(src); |
Hiroshi Yamauchi | 7971928 | 2014-04-10 12:46:22 -0700 | [diff] [blame] | 134 | if (kUseBakerOrBrooksReadBarrier) { |
| 135 | // TODO: Optimize this later? |
| 136 | const bool copy_forward = (src != this) || (dst_pos < src_pos) || (dst_pos - src_pos >= count); |
| 137 | if (copy_forward) { |
| 138 | // Forward copy. |
| 139 | for (int i = 0; i < count; ++i) { |
| 140 | // We need a RB here. ObjectArray::GetWithoutChecks() contains a RB. |
| 141 | Object* obj = src->GetWithoutChecks(src_pos + i); |
| 142 | SetWithoutChecks<false>(dst_pos + i, obj); |
| 143 | } |
| 144 | } else { |
| 145 | // Backward copy. |
| 146 | for (int i = count - 1; i >= 0; --i) { |
| 147 | // We need a RB here. ObjectArray::GetWithoutChecks() contains a RB. |
| 148 | Object* obj = src->GetWithoutChecks(src_pos + i); |
| 149 | SetWithoutChecks<false>(dst_pos + i, obj); |
| 150 | } |
| 151 | } |
| 152 | } else { |
| 153 | dstAsIntArray->Memmove(dst_pos, srcAsIntArray, src_pos, count); |
| 154 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 155 | Runtime::Current()->GetHeap()->WriteBarrierArray(this, dst_pos, count); |
| 156 | if (kIsDebugBuild) { |
| 157 | for (int i = 0; i < count; ++i) { |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 158 | // The get will perform the VerifyObject. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 159 | GetWithoutChecks(dst_pos + i); |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | template<class T> |
| 165 | inline void ObjectArray<T>::AssignableMemcpy(int32_t dst_pos, ObjectArray<T>* src, |
| 166 | int32_t src_pos, int32_t count) { |
| 167 | if (kIsDebugBuild) { |
| 168 | for (int i = 0; i < count; ++i) { |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 169 | // The get will perform the VerifyObject. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 170 | src->GetWithoutChecks(src_pos + i); |
| 171 | } |
| 172 | } |
| 173 | // Perform the memmove using int memcpy then perform the write barrier. |
| 174 | CHECK_EQ(sizeof(HeapReference<T>), sizeof(uint32_t)); |
| 175 | IntArray* dstAsIntArray = reinterpret_cast<IntArray*>(this); |
| 176 | IntArray* srcAsIntArray = reinterpret_cast<IntArray*>(src); |
Hiroshi Yamauchi | 7971928 | 2014-04-10 12:46:22 -0700 | [diff] [blame] | 177 | if (kUseBakerOrBrooksReadBarrier) { |
| 178 | // TODO: Optimize this later? |
| 179 | for (int i = 0; i < count; ++i) { |
| 180 | // We need a RB here. ObjectArray::GetWithoutChecks() contains a RB. |
| 181 | T* obj = src->GetWithoutChecks(src_pos + i); |
| 182 | SetWithoutChecks<false>(dst_pos + i, obj); |
| 183 | } |
| 184 | } else { |
| 185 | dstAsIntArray->Memcpy(dst_pos, srcAsIntArray, src_pos, count); |
| 186 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 187 | Runtime::Current()->GetHeap()->WriteBarrierArray(this, dst_pos, count); |
| 188 | if (kIsDebugBuild) { |
| 189 | for (int i = 0; i < count; ++i) { |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 190 | // The get will perform the VerifyObject. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 191 | GetWithoutChecks(dst_pos + i); |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | template<class T> |
| 197 | inline void ObjectArray<T>::AssignableCheckingMemcpy(int32_t dst_pos, ObjectArray<T>* src, |
| 198 | int32_t src_pos, int32_t count, |
| 199 | bool throw_exception) { |
| 200 | DCHECK_NE(this, src) |
| 201 | << "This case should be handled with memmove that handles overlaps correctly"; |
| 202 | // We want to avoid redundant IsAssignableFrom checks where possible, so we cache a class that |
| 203 | // we know is assignable to the destination array's component type. |
| 204 | Class* dst_class = GetClass()->GetComponentType(); |
| 205 | Class* lastAssignableElementClass = dst_class; |
| 206 | |
| 207 | Object* o = nullptr; |
| 208 | int i = 0; |
| 209 | for (; i < count; ++i) { |
| 210 | // The follow get operations force the objects to be verified. |
Hiroshi Yamauchi | 7971928 | 2014-04-10 12:46:22 -0700 | [diff] [blame] | 211 | // We need a RB here. ObjectArray::GetWithoutChecks() contains a RB. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 212 | o = src->GetWithoutChecks(src_pos + i); |
| 213 | if (o == nullptr) { |
| 214 | // Null is always assignable. |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 215 | SetWithoutChecks<false>(dst_pos + i, nullptr); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 216 | } else { |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 217 | // TODO: use the underlying class reference to avoid uncompression when not necessary. |
| 218 | Class* o_class = o->GetClass(); |
| 219 | if (LIKELY(lastAssignableElementClass == o_class)) { |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 220 | SetWithoutChecks<false>(dst_pos + i, o); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 221 | } else if (LIKELY(dst_class->IsAssignableFrom(o_class))) { |
| 222 | lastAssignableElementClass = o_class; |
Sebastien Hertz | d2fe10a | 2014-01-15 10:20:56 +0100 | [diff] [blame] | 223 | SetWithoutChecks<false>(dst_pos + i, o); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 224 | } else { |
| 225 | // Can't put this element into the array, break to perform write-barrier and throw |
| 226 | // exception. |
| 227 | break; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 228 | } |
| 229 | } |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 230 | } |
| 231 | Runtime::Current()->GetHeap()->WriteBarrierArray(this, dst_pos, count); |
| 232 | if (UNLIKELY(i != count)) { |
| 233 | std::string actualSrcType(PrettyTypeOf(o)); |
| 234 | std::string dstType(PrettyTypeOf(this)); |
| 235 | Thread* self = Thread::Current(); |
| 236 | ThrowLocation throw_location = self->GetCurrentLocationForThrow(); |
| 237 | if (throw_exception) { |
| 238 | self->ThrowNewExceptionF(throw_location, "Ljava/lang/ArrayStoreException;", |
| 239 | "source[%d] of type %s cannot be stored in destination array of type %s", |
| 240 | src_pos + i, actualSrcType.c_str(), dstType.c_str()); |
| 241 | } else { |
| 242 | LOG(FATAL) << StringPrintf("source[%d] of type %s cannot be stored in destination array of type %s", |
| 243 | src_pos + i, actualSrcType.c_str(), dstType.c_str()); |
| 244 | } |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 245 | } |
| 246 | } |
| 247 | |
| 248 | template<class T> |
| 249 | inline ObjectArray<T>* ObjectArray<T>::CopyOf(Thread* self, int32_t new_length) { |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 250 | DCHECK_GE(new_length, 0); |
Mathieu Chartier | 590fee9 | 2013-09-13 13:46:47 -0700 | [diff] [blame] | 251 | // We may get copied by a compacting GC. |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 252 | StackHandleScope<1> hs(self); |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 253 | Handle<ObjectArray<T>> h_this(hs.NewHandle(this)); |
Mathieu Chartier | cbb2d20 | 2013-11-14 17:45:16 -0800 | [diff] [blame] | 254 | gc::Heap* heap = Runtime::Current()->GetHeap(); |
| 255 | gc::AllocatorType allocator_type = heap->IsMovableObject(this) ? heap->GetCurrentAllocator() : |
| 256 | heap->GetCurrentNonMovingAllocator(); |
| 257 | ObjectArray<T>* new_array = Alloc(self, GetClass(), new_length, allocator_type); |
Mathieu Chartier | 590fee9 | 2013-09-13 13:46:47 -0700 | [diff] [blame] | 258 | if (LIKELY(new_array != nullptr)) { |
Mathieu Chartier | eb8167a | 2014-05-07 15:43:14 -0700 | [diff] [blame] | 259 | new_array->AssignableMemcpy(0, h_this.Get(), 0, std::min(h_this->GetLength(), new_length)); |
Ian Rogers | a436fde | 2013-08-27 23:34:06 -0700 | [diff] [blame] | 260 | } |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 261 | return new_array; |
| 262 | } |
| 263 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 264 | template<class T> |
| 265 | inline MemberOffset ObjectArray<T>::OffsetOfElement(int32_t i) { |
| 266 | return MemberOffset(DataOffset(sizeof(HeapReference<Object>)).Int32Value() + |
| 267 | (i * sizeof(HeapReference<Object>))); |
| 268 | } |
| 269 | |
Mathieu Chartier | 407f702 | 2014-02-18 14:37:05 -0800 | [diff] [blame] | 270 | template<class T> template<const bool kVisitClass, typename Visitor> |
| 271 | void ObjectArray<T>::VisitReferences(const Visitor& visitor) { |
| 272 | if (kVisitClass) { |
| 273 | visitor(this, ClassOffset(), false); |
| 274 | } |
| 275 | const size_t length = static_cast<size_t>(GetLength()); |
| 276 | for (size_t i = 0; i < length; ++i) { |
| 277 | visitor(this, OffsetOfElement(i), false); |
| 278 | } |
| 279 | } |
| 280 | |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 281 | } // namespace mirror |
| 282 | } // namespace art |
| 283 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 284 | #endif // ART_RUNTIME_MIRROR_OBJECT_ARRAY_INL_H_ |