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