Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 2 | |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 3 | #include "mark_sweep.h" |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 4 | |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 5 | #include <climits> |
| 6 | #include <vector> |
| 7 | |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 8 | #include "class_loader.h" |
Brian Carlstrom | 693267a | 2011-09-06 09:25:34 -0700 | [diff] [blame] | 9 | #include "dex_cache.h" |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 10 | #include "heap.h" |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 11 | #include "indirect_reference_table.h" |
| 12 | #include "intern_table.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 13 | #include "logging.h" |
| 14 | #include "macros.h" |
| 15 | #include "mark_stack.h" |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 16 | #include "monitor.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 17 | #include "object.h" |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 18 | #include "runtime.h" |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 19 | #include "space.h" |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 20 | #include "timing_logger.h" |
Brian Carlstrom | 578bbdc | 2011-07-21 14:07:47 -0700 | [diff] [blame] | 21 | #include "thread.h" |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 22 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 23 | namespace art { |
| 24 | |
Jesse Wilson | 078f9b0 | 2011-11-18 17:51:47 -0500 | [diff] [blame] | 25 | void MarkSweep::Init() { |
Brian Carlstrom | 4a289ed | 2011-08-16 17:17:49 -0700 | [diff] [blame] | 26 | mark_stack_ = MarkStack::Create(); |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 27 | mark_bitmap_ = Heap::GetMarkBits(); |
| 28 | live_bitmap_ = Heap::GetLiveBits(); |
| 29 | |
| 30 | // TODO: if concurrent, clear the card table. |
| 31 | |
buzbee | 0d966cf | 2011-09-08 17:34:58 -0700 | [diff] [blame] | 32 | // TODO: if concurrent, enable card marking in compiler |
| 33 | |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 34 | // TODO: check that the mark bitmap is entirely clear. |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 35 | } |
| 36 | |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 37 | inline void MarkSweep::MarkObject0(const Object* obj, bool check_finger) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 38 | DCHECK(obj != NULL); |
| 39 | if (obj < condemned_) { |
| 40 | DCHECK(IsMarked(obj)); |
| 41 | return; |
| 42 | } |
| 43 | bool is_marked = mark_bitmap_->Test(obj); |
| 44 | // This object was not previously marked. |
| 45 | if (!is_marked) { |
| 46 | mark_bitmap_->Set(obj); |
| 47 | if (check_finger && obj < finger_) { |
| 48 | // The object must be pushed on to the mark stack. |
| 49 | mark_stack_->Push(obj); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // Used to mark objects when recursing. Recursion is done by moving |
| 55 | // the finger across the bitmaps in address order and marking child |
| 56 | // objects. Any newly-marked objects whose addresses are lower than |
| 57 | // the finger won't be visited by the bitmap scan, so those objects |
| 58 | // need to be added to the mark stack. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 59 | inline void MarkSweep::MarkObject(const Object* obj) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 60 | if (obj != NULL) { |
| 61 | MarkObject0(obj, true); |
| 62 | } |
| 63 | } |
| 64 | |
Elliott Hughes | cf4c6c4 | 2011-09-01 15:16:42 -0700 | [diff] [blame] | 65 | void MarkSweep::MarkObjectVisitor(const Object* root, void* arg) { |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 66 | DCHECK(root != NULL); |
| 67 | DCHECK(arg != NULL); |
| 68 | MarkSweep* mark_sweep = reinterpret_cast<MarkSweep*>(arg); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 69 | DCHECK(mark_sweep->finger_ == NULL); // no point to check finger if it is NULL |
| 70 | mark_sweep->MarkObject0(root, false); |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 71 | } |
| 72 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 73 | // Marks all objects in the root set. |
| 74 | void MarkSweep::MarkRoots() { |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 75 | Runtime::Current()->VisitRoots(MarkObjectVisitor, this); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 78 | void MarkSweep::ScanImageRootVisitor(Object* root, void* arg) { |
| 79 | DCHECK(root != NULL); |
| 80 | DCHECK(arg != NULL); |
| 81 | MarkSweep* mark_sweep = reinterpret_cast<MarkSweep*>(arg); |
| 82 | DCHECK(mark_sweep->finger_ == NULL); // no point to check finger if it is NULL |
| 83 | mark_sweep->MarkObject0(root, false); |
| 84 | mark_sweep->ScanObject(root); |
| 85 | } |
| 86 | |
| 87 | // Marks all objects that are in images and have been touched by the mutator |
| 88 | void MarkSweep::ScanDirtyImageRoots() { |
| 89 | const std::vector<Space*>& spaces = Heap::GetSpaces(); |
| 90 | CardTable* card_table = Heap::GetCardTable(); |
| 91 | for (size_t i = 0; i < spaces.size(); ++i) { |
| 92 | if (spaces[i]->IsImageSpace()) { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 93 | byte* begin = spaces[i]->Begin(); |
| 94 | byte* end = spaces[i]->End(); |
| 95 | card_table->Scan(begin, end, ScanImageRootVisitor, this); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | void MarkSweep::CheckBitmapCallback(Object* obj, void* finger, void* arg) { |
| 101 | MarkSweep* mark_sweep = reinterpret_cast<MarkSweep*>(arg); |
| 102 | mark_sweep->finger_ = reinterpret_cast<Object*>(finger); |
| 103 | mark_sweep->CheckObject(obj); |
| 104 | } |
| 105 | |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 106 | void MarkSweep::ScanBitmapCallback(Object* obj, void* finger, void* arg) { |
| 107 | MarkSweep* mark_sweep = reinterpret_cast<MarkSweep*>(arg); |
| 108 | mark_sweep->finger_ = reinterpret_cast<Object*>(finger); |
| 109 | mark_sweep->ScanObject(obj); |
| 110 | } |
| 111 | |
| 112 | // Populates the mark stack based on the set of marked objects and |
| 113 | // recursively marks until the mark stack is emptied. |
| 114 | void MarkSweep::RecursiveMark() { |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 115 | // RecursiveMark will build the lists of known instances of the Reference classes. |
| 116 | // See DelayReferenceReferent for details. |
| 117 | CHECK(soft_reference_list_ == NULL); |
| 118 | CHECK(weak_reference_list_ == NULL); |
| 119 | CHECK(finalizer_reference_list_ == NULL); |
| 120 | CHECK(phantom_reference_list_ == NULL); |
| 121 | CHECK(cleared_reference_list_ == NULL); |
| 122 | |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 123 | void* arg = reinterpret_cast<void*>(this); |
| 124 | const std::vector<Space*>& spaces = Heap::GetSpaces(); |
| 125 | for (size_t i = 0; i < spaces.size(); ++i) { |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 126 | #ifndef NDEBUG |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 127 | uintptr_t begin = reinterpret_cast<uintptr_t>(spaces[i]->Begin()); |
| 128 | uintptr_t end = reinterpret_cast<uintptr_t>(spaces[i]->End()); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 129 | if (!spaces[i]->IsImageSpace()) { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 130 | mark_bitmap_->ScanWalk(begin, end, &MarkSweep::ScanBitmapCallback, arg); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 131 | } else{ |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 132 | mark_bitmap_->ScanWalk(begin, end, &MarkSweep::CheckBitmapCallback, arg); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 133 | } |
| 134 | #else |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 135 | if (!spaces[i]->IsImageSpace()) { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 136 | uintptr_t begin = reinterpret_cast<uintptr_t>(spaces[i]->Begin()); |
| 137 | uintptr_t end = reinterpret_cast<uintptr_t>(spaces[i]->End()); |
| 138 | mark_bitmap_->ScanWalk(begin, end, &MarkSweep::ScanBitmapCallback, arg); |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 139 | } |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 140 | #endif |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 141 | } |
| 142 | finger_ = reinterpret_cast<Object*>(~0); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 143 | // TODO: tune the frequency of emptying the mark stack |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 144 | ProcessMarkStack(); |
| 145 | } |
| 146 | |
| 147 | void MarkSweep::ReMarkRoots() { |
Elliott Hughes | 53b6131 | 2011-08-12 18:28:20 -0700 | [diff] [blame] | 148 | UNIMPLEMENTED(FATAL); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 149 | } |
| 150 | |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 151 | void MarkSweep::SweepJniWeakGlobals() { |
| 152 | JavaVMExt* vm = Runtime::Current()->GetJavaVM(); |
| 153 | MutexLock mu(vm->weak_globals_lock); |
| 154 | IndirectReferenceTable* table = &vm->weak_globals; |
| 155 | typedef IndirectReferenceTable::iterator It; // TODO: C++0x auto |
| 156 | for (It it = table->begin(), end = table->end(); it != end; ++it) { |
| 157 | const Object** entry = *it; |
| 158 | if (!IsMarked(*entry)) { |
| 159 | *entry = kClearedJniWeakGlobal; |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 164 | void MarkSweep::SweepSystemWeaks() { |
Elliott Hughes | c33a32b | 2011-10-11 18:18:07 -0700 | [diff] [blame] | 165 | Runtime::Current()->GetInternTable()->SweepInternTableWeaks(IsMarked, this); |
| 166 | Runtime::Current()->GetMonitorList()->SweepMonitorList(IsMarked, this); |
Elliott Hughes | 410c0c8 | 2011-09-01 17:58:25 -0700 | [diff] [blame] | 167 | SweepJniWeakGlobals(); |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 168 | } |
| 169 | |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 170 | void MarkSweep::SweepCallback(size_t num_ptrs, Object** ptrs, void* arg) { |
Elliott Hughes | 362f9bc | 2011-10-17 18:56:41 -0700 | [diff] [blame] | 171 | // TODO: lock heap if concurrent |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 172 | size_t freed_objects = num_ptrs; |
| 173 | size_t freed_bytes = 0; |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 174 | AllocSpace* space = static_cast<AllocSpace*>(arg); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 175 | // Use a bulk free, that merges consecutive objects before freeing or free per object? |
| 176 | // Documentation suggests better free performance with merging, but this may be at the expensive |
| 177 | // of allocation. |
| 178 | // TODO: investigate performance |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 179 | static const bool kUseFreeList = true; |
| 180 | if (kUseFreeList) { |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 181 | for (size_t i = 0; i < num_ptrs; ++i) { |
| 182 | Object* obj = static_cast<Object*>(ptrs[i]); |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 183 | freed_bytes += space->AllocationSize(obj); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 184 | Heap::GetLiveBits()->Clear(obj); |
| 185 | } |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 186 | // AllocSpace::FreeList clears the value in ptrs, so perform after clearing the live bit |
| 187 | space->FreeList(num_ptrs, ptrs); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 188 | } else { |
| 189 | for (size_t i = 0; i < num_ptrs; ++i) { |
| 190 | Object* obj = static_cast<Object*>(ptrs[i]); |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 191 | freed_bytes += space->AllocationSize(obj); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 192 | Heap::GetLiveBits()->Clear(obj); |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 193 | space->Free(obj); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 194 | } |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 195 | } |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 196 | Heap::RecordFreeLocked(freed_objects, freed_bytes); |
Elliott Hughes | 362f9bc | 2011-10-17 18:56:41 -0700 | [diff] [blame] | 197 | // TODO: unlock heap if concurrent |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | void MarkSweep::Sweep() { |
Elliott Hughes | 2da5036 | 2011-10-10 16:57:08 -0700 | [diff] [blame] | 201 | SweepSystemWeaks(); |
| 202 | |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 203 | const std::vector<Space*>& spaces = Heap::GetSpaces(); |
| 204 | for (size_t i = 0; i < spaces.size(); ++i) { |
Elliott Hughes | 307f75d | 2011-10-12 18:04:40 -0700 | [diff] [blame] | 205 | if (!spaces[i]->IsImageSpace()) { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 206 | uintptr_t begin = reinterpret_cast<uintptr_t>(spaces[i]->Begin()); |
| 207 | uintptr_t end = reinterpret_cast<uintptr_t>(spaces[i]->End()); |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 208 | void* arg = static_cast<void*>(spaces[i]); |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 209 | HeapBitmap::SweepWalk(*live_bitmap_, *mark_bitmap_, begin, end, |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 210 | &MarkSweep::SweepCallback, arg); |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 215 | // Scans instance fields. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 216 | inline void MarkSweep::ScanInstanceFields(const Object* obj) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 217 | DCHECK(obj != NULL); |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 218 | Class* klass = obj->GetClass(); |
| 219 | DCHECK(klass != NULL); |
Elliott Hughes | 2da5036 | 2011-10-10 16:57:08 -0700 | [diff] [blame] | 220 | ScanFields(obj, klass->GetReferenceInstanceOffsets(), false); |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 221 | } |
| 222 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 223 | inline void MarkSweep::CheckInstanceFields(const Object* obj) { |
| 224 | Class* klass = obj->GetClass(); |
| 225 | CheckFields(obj, klass->GetReferenceInstanceOffsets(), false); |
| 226 | } |
| 227 | |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 228 | // Scans static storage on a Class. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 229 | inline void MarkSweep::ScanStaticFields(const Class* klass) { |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 230 | DCHECK(klass != NULL); |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 231 | ScanFields(klass, klass->GetReferenceStaticOffsets(), true); |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 232 | } |
| 233 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 234 | inline void MarkSweep::CheckStaticFields(const Class* klass) { |
| 235 | CheckFields(klass, klass->GetReferenceStaticOffsets(), true); |
| 236 | } |
| 237 | |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 238 | inline void MarkSweep::ScanFields(const Object* obj, uint32_t ref_offsets, bool is_static) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 239 | if (ref_offsets != CLASS_WALK_SUPER) { |
| 240 | // Found a reference offset bitmap. Mark the specified offsets. |
| 241 | while (ref_offsets != 0) { |
| 242 | size_t right_shift = CLZ(ref_offsets); |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 243 | MemberOffset byte_offset = CLASS_OFFSET_FROM_CLZ(right_shift); |
| 244 | const Object* ref = obj->GetFieldObject<const Object*>(byte_offset, false); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 245 | MarkObject(ref); |
| 246 | ref_offsets &= ~(CLASS_HIGH_BIT >> right_shift); |
| 247 | } |
| 248 | } else { |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 249 | // There is no reference offset bitmap. In the non-static case, |
| 250 | // walk up the class inheritance hierarchy and find reference |
| 251 | // offsets the hard way. In the static case, just consider this |
| 252 | // class. |
| 253 | for (const Class* klass = is_static ? obj->AsClass() : obj->GetClass(); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 254 | klass != NULL; |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 255 | klass = is_static ? NULL : klass->GetSuperClass()) { |
| 256 | size_t num_reference_fields = (is_static |
| 257 | ? klass->NumReferenceStaticFields() |
| 258 | : klass->NumReferenceInstanceFields()); |
| 259 | for (size_t i = 0; i < num_reference_fields; ++i) { |
| 260 | Field* field = (is_static |
| 261 | ? klass->GetStaticField(i) |
| 262 | : klass->GetInstanceField(i)); |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 263 | MemberOffset field_offset = field->GetOffset(); |
| 264 | const Object* ref = obj->GetFieldObject<const Object*>(field_offset, false); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 265 | MarkObject(ref); |
| 266 | } |
| 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 271 | inline void MarkSweep::CheckReference(const Object* obj, const Object* ref, MemberOffset offset, bool is_static) { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 272 | AllocSpace* alloc_space = Heap::GetAllocSpace(); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 273 | if (alloc_space->Contains(ref)) { |
| 274 | bool is_marked = mark_bitmap_->Test(ref); |
| 275 | if(!is_marked) { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame^] | 276 | LOG(INFO) << *alloc_space; |
| 277 | LOG(WARNING) << (is_static ? "Static ref'" : "Instance ref'") << PrettyTypeOf(ref) |
| 278 | << "' (" << (void*)ref << ") in '" << PrettyTypeOf(obj) |
| 279 | << "' (" << (void*)obj << ") at offset " |
| 280 | << (void*)offset.Int32Value() << " wasn't marked"; |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 281 | bool obj_marked = Heap::GetCardTable()->IsDirty(obj); |
| 282 | if (!obj_marked) { |
| 283 | LOG(WARNING) << "Object '" << PrettyTypeOf(obj) << "' (" << (void*)obj |
| 284 | << ") contains references to the alloc space, but wasn't card marked"; |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | inline void MarkSweep::CheckFields(const Object* obj, uint32_t ref_offsets, bool is_static) { |
| 291 | if (ref_offsets != CLASS_WALK_SUPER) { |
| 292 | // Found a reference offset bitmap. Mark the specified offsets. |
| 293 | while (ref_offsets != 0) { |
| 294 | size_t right_shift = CLZ(ref_offsets); |
| 295 | MemberOffset field_offset = CLASS_OFFSET_FROM_CLZ(right_shift); |
| 296 | const Object* ref = obj->GetFieldObject<const Object*>(field_offset, false); |
| 297 | CheckReference(obj, ref, field_offset, is_static); |
| 298 | ref_offsets &= ~(CLASS_HIGH_BIT >> right_shift); |
| 299 | } |
| 300 | } else { |
| 301 | // There is no reference offset bitmap. In the non-static case, |
| 302 | // walk up the class inheritance hierarchy and find reference |
| 303 | // offsets the hard way. In the static case, just consider this |
| 304 | // class. |
| 305 | for (const Class* klass = is_static ? obj->AsClass() : obj->GetClass(); |
| 306 | klass != NULL; |
| 307 | klass = is_static ? NULL : klass->GetSuperClass()) { |
| 308 | size_t num_reference_fields = (is_static |
| 309 | ? klass->NumReferenceStaticFields() |
| 310 | : klass->NumReferenceInstanceFields()); |
| 311 | for (size_t i = 0; i < num_reference_fields; ++i) { |
| 312 | Field* field = (is_static |
| 313 | ? klass->GetStaticField(i) |
| 314 | : klass->GetInstanceField(i)); |
| 315 | MemberOffset field_offset = field->GetOffset(); |
| 316 | const Object* ref = obj->GetFieldObject<const Object*>(field_offset, false); |
| 317 | CheckReference(obj, ref, field_offset, is_static); |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 323 | // Scans the header, static field references, and interface pointers |
| 324 | // of a class object. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 325 | inline void MarkSweep::ScanClass(const Object* obj) { |
Elliott Hughes | 352a424 | 2011-10-31 15:15:21 -0700 | [diff] [blame] | 326 | #ifndef NDEBUG |
| 327 | ++class_count_; |
| 328 | #endif |
Brian Carlstrom | 693267a | 2011-09-06 09:25:34 -0700 | [diff] [blame] | 329 | ScanInstanceFields(obj); |
Brian Carlstrom | 40381fb | 2011-10-19 14:13:40 -0700 | [diff] [blame] | 330 | ScanStaticFields(obj->AsClass()); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 331 | } |
| 332 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 333 | inline void MarkSweep::CheckClass(const Object* obj) { |
| 334 | CheckInstanceFields(obj); |
| 335 | CheckStaticFields(obj->AsClass()); |
| 336 | } |
| 337 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 338 | // Scans the header of all array objects. If the array object is |
| 339 | // specialized to a reference type, scans the array data as well. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 340 | inline void MarkSweep::ScanArray(const Object* obj) { |
Elliott Hughes | 352a424 | 2011-10-31 15:15:21 -0700 | [diff] [blame] | 341 | #ifndef NDEBUG |
| 342 | ++array_count_; |
| 343 | #endif |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 344 | MarkObject(obj->GetClass()); |
| 345 | if (obj->IsObjectArray()) { |
Brian Carlstrom | db4d540 | 2011-08-09 12:18:28 -0700 | [diff] [blame] | 346 | const ObjectArray<Object>* array = obj->AsObjectArray<Object>(); |
Elliott Hughes | d8ddfd5 | 2011-08-15 14:32:53 -0700 | [diff] [blame] | 347 | for (int32_t i = 0; i < array->GetLength(); ++i) { |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 348 | const Object* element = array->GetWithoutChecks(i); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 349 | MarkObject(element); |
| 350 | } |
| 351 | } |
| 352 | } |
| 353 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 354 | inline void MarkSweep::CheckArray(const Object* obj) { |
| 355 | CheckReference(obj, obj->GetClass(), Object::ClassOffset(), false); |
| 356 | if (obj->IsObjectArray()) { |
| 357 | const ObjectArray<Object>* array = obj->AsObjectArray<Object>(); |
| 358 | for (int32_t i = 0; i < array->GetLength(); ++i) { |
| 359 | const Object* element = array->GetWithoutChecks(i); |
| 360 | CheckReference(obj, element, MemberOffset(i * sizeof(Object*) + |
| 361 | Array::DataOffset().Int32Value()), false); |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 366 | // Process the "referent" field in a java.lang.ref.Reference. If the |
| 367 | // referent has not yet been marked, put it on the appropriate list in |
| 368 | // the gcHeap for later processing. |
| 369 | void MarkSweep::DelayReferenceReferent(Object* obj) { |
| 370 | DCHECK(obj != NULL); |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 371 | Class* klass = obj->GetClass(); |
| 372 | DCHECK(klass != NULL); |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 373 | DCHECK(klass->IsReferenceClass()); |
| 374 | Object* pending = obj->GetFieldObject<Object*>(Heap::GetReferencePendingNextOffset(), false); |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 375 | Object* referent = Heap::GetReferenceReferent(obj); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 376 | if (pending == NULL && referent != NULL && !IsMarked(referent)) { |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 377 | Object** list = NULL; |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 378 | if (klass->IsSoftReferenceClass()) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 379 | list = &soft_reference_list_; |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 380 | } else if (klass->IsWeakReferenceClass()) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 381 | list = &weak_reference_list_; |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 382 | } else if (klass->IsFinalizerReferenceClass()) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 383 | list = &finalizer_reference_list_; |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 384 | } else if (klass->IsPhantomReferenceClass()) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 385 | list = &phantom_reference_list_; |
| 386 | } |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 387 | DCHECK(list != NULL) << PrettyClass(klass) << " " << std::hex << klass->GetAccessFlags(); |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 388 | Heap::EnqueuePendingReference(obj, list); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 389 | } |
| 390 | } |
| 391 | |
| 392 | // Scans the header and field references of a data object. If the |
| 393 | // scanned object is a reference subclass, it is scheduled for later |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 394 | // processing. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 395 | inline void MarkSweep::ScanOther(const Object* obj) { |
Elliott Hughes | 352a424 | 2011-10-31 15:15:21 -0700 | [diff] [blame] | 396 | #ifndef NDEBUG |
| 397 | ++other_count_; |
| 398 | #endif |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 399 | ScanInstanceFields(obj); |
Elliott Hughes | 352a424 | 2011-10-31 15:15:21 -0700 | [diff] [blame] | 400 | if (obj->GetClass()->IsReferenceClass()) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 401 | DelayReferenceReferent(const_cast<Object*>(obj)); |
| 402 | } |
| 403 | } |
| 404 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 405 | inline void MarkSweep::CheckOther(const Object* obj) { |
| 406 | CheckInstanceFields(obj); |
| 407 | } |
| 408 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 409 | // Scans an object reference. Determines the type of the reference |
| 410 | // and dispatches to a specialized scanning routine. |
Elliott Hughes | b066311 | 2011-10-19 18:16:37 -0700 | [diff] [blame] | 411 | inline void MarkSweep::ScanObject(const Object* obj) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 412 | DCHECK(obj != NULL); |
| 413 | DCHECK(obj->GetClass() != NULL); |
| 414 | DCHECK(IsMarked(obj)); |
| 415 | if (obj->IsClass()) { |
| 416 | ScanClass(obj); |
Brian Carlstrom | b63ec39 | 2011-08-27 17:38:27 -0700 | [diff] [blame] | 417 | } else if (obj->IsArrayInstance()) { |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 418 | ScanArray(obj); |
| 419 | } else { |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 420 | ScanOther(obj); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 421 | } |
| 422 | } |
| 423 | |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 424 | // Check to see that all alloc space references are marked for the given object |
| 425 | inline void MarkSweep::CheckObject(const Object* obj) { |
| 426 | DCHECK(obj != NULL); |
| 427 | DCHECK(obj->GetClass() != NULL); |
| 428 | DCHECK(IsMarked(obj)); |
| 429 | if (obj->IsClass()) { |
| 430 | CheckClass(obj); |
| 431 | } else if (obj->IsArrayInstance()) { |
| 432 | CheckArray(obj); |
| 433 | } else { |
| 434 | CheckOther(obj); |
| 435 | } |
| 436 | } |
| 437 | |
| 438 | // Scan anything that's on the mark stack. |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 439 | void MarkSweep::ProcessMarkStack() { |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 440 | Space* alloc_space = Heap::GetAllocSpace(); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 441 | while (!mark_stack_->IsEmpty()) { |
Brian Carlstrom | 4873d46 | 2011-08-21 15:23:39 -0700 | [diff] [blame] | 442 | const Object* obj = mark_stack_->Pop(); |
Ian Rogers | 5d76c43 | 2011-10-31 21:42:49 -0700 | [diff] [blame] | 443 | if (alloc_space->Contains(obj)) { |
| 444 | ScanObject(obj); |
| 445 | } |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 446 | } |
| 447 | } |
| 448 | |
| 449 | void MarkSweep::ScanDirtyObjects() { |
| 450 | ProcessMarkStack(); |
| 451 | } |
| 452 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 453 | // Walks the reference list marking any references subject to the |
| 454 | // reference clearing policy. References with a black referent are |
| 455 | // removed from the list. References with white referents biased |
| 456 | // toward saving are blackened and also removed from the list. |
| 457 | void MarkSweep::PreserveSomeSoftReferences(Object** list) { |
| 458 | DCHECK(list != NULL); |
| 459 | Object* clear = NULL; |
| 460 | size_t counter = 0; |
| 461 | while (*list != NULL) { |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 462 | Object* ref = Heap::DequeuePendingReference(list); |
| 463 | Object* referent = Heap::GetReferenceReferent(ref); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 464 | if (referent == NULL) { |
| 465 | // Referent was cleared by the user during marking. |
| 466 | continue; |
| 467 | } |
| 468 | bool is_marked = IsMarked(referent); |
| 469 | if (!is_marked && ((++counter) & 1)) { |
| 470 | // Referent is white and biased toward saving, mark it. |
| 471 | MarkObject(referent); |
| 472 | is_marked = true; |
| 473 | } |
| 474 | if (!is_marked) { |
| 475 | // Referent is white, queue it for clearing. |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 476 | Heap::EnqueuePendingReference(ref, &clear); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 477 | } |
| 478 | } |
| 479 | *list = clear; |
| 480 | // Restart the mark with the newly black references added to the |
| 481 | // root set. |
| 482 | ProcessMarkStack(); |
| 483 | } |
| 484 | |
| 485 | // Unlink the reference list clearing references objects with white |
| 486 | // referents. Cleared references registered to a reference queue are |
| 487 | // scheduled for appending by the heap worker thread. |
| 488 | void MarkSweep::ClearWhiteReferences(Object** list) { |
| 489 | DCHECK(list != NULL); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 490 | while (*list != NULL) { |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 491 | Object* ref = Heap::DequeuePendingReference(list); |
| 492 | Object* referent = Heap::GetReferenceReferent(ref); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 493 | if (referent != NULL && !IsMarked(referent)) { |
| 494 | // Referent is white, clear it. |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 495 | Heap::ClearReferenceReferent(ref); |
| 496 | if (Heap::IsEnqueuable(ref)) { |
| 497 | Heap::EnqueueReference(ref, &cleared_reference_list_); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 498 | } |
| 499 | } |
| 500 | } |
| 501 | DCHECK(*list == NULL); |
| 502 | } |
| 503 | |
| 504 | // Enqueues finalizer references with white referents. White |
| 505 | // referents are blackened, moved to the zombie field, and the |
| 506 | // referent field is cleared. |
| 507 | void MarkSweep::EnqueueFinalizerReferences(Object** list) { |
| 508 | DCHECK(list != NULL); |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 509 | MemberOffset zombie_offset = Heap::GetFinalizerReferenceZombieOffset(); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 510 | bool has_enqueued = false; |
| 511 | while (*list != NULL) { |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 512 | Object* ref = Heap::DequeuePendingReference(list); |
| 513 | Object* referent = Heap::GetReferenceReferent(ref); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 514 | if (referent != NULL && !IsMarked(referent)) { |
| 515 | MarkObject(referent); |
| 516 | // If the referent is non-null the reference must queuable. |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 517 | DCHECK(Heap::IsEnqueuable(ref)); |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 518 | ref->SetFieldObject(zombie_offset, referent, false); |
Elliott Hughes | adb460d | 2011-10-05 17:02:34 -0700 | [diff] [blame] | 519 | Heap::ClearReferenceReferent(ref); |
| 520 | Heap::EnqueueReference(ref, &cleared_reference_list_); |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 521 | has_enqueued = true; |
| 522 | } |
| 523 | } |
| 524 | if (has_enqueued) { |
| 525 | ProcessMarkStack(); |
| 526 | } |
| 527 | DCHECK(*list == NULL); |
| 528 | } |
| 529 | |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 530 | // Process reference class instances and schedule finalizations. |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 531 | void MarkSweep::ProcessReferences(Object** soft_references, bool clear_soft, |
| 532 | Object** weak_references, |
| 533 | Object** finalizer_references, |
| 534 | Object** phantom_references) { |
| 535 | DCHECK(soft_references != NULL); |
| 536 | DCHECK(weak_references != NULL); |
| 537 | DCHECK(finalizer_references != NULL); |
| 538 | DCHECK(phantom_references != NULL); |
| 539 | |
| 540 | // Unless we are in the zygote or required to clear soft references |
| 541 | // with white references, preserve some white referents. |
| 542 | if (clear_soft) { |
| 543 | PreserveSomeSoftReferences(soft_references); |
| 544 | } |
| 545 | |
| 546 | // Clear all remaining soft and weak references with white |
| 547 | // referents. |
| 548 | ClearWhiteReferences(soft_references); |
| 549 | ClearWhiteReferences(weak_references); |
| 550 | |
| 551 | // Preserve all white objects with finalize methods and schedule |
| 552 | // them for finalization. |
| 553 | EnqueueFinalizerReferences(finalizer_references); |
| 554 | |
| 555 | // Clear all f-reachable soft and weak references with white |
| 556 | // referents. |
| 557 | ClearWhiteReferences(soft_references); |
| 558 | ClearWhiteReferences(weak_references); |
| 559 | |
| 560 | // Clear all phantom references with white referents. |
| 561 | ClearWhiteReferences(phantom_references); |
| 562 | |
| 563 | // At this point all reference lists should be empty. |
| 564 | DCHECK(*soft_references == NULL); |
| 565 | DCHECK(*weak_references == NULL); |
| 566 | DCHECK(*finalizer_references == NULL); |
| 567 | DCHECK(*phantom_references == NULL); |
| 568 | } |
| 569 | |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 570 | MarkSweep::~MarkSweep() { |
Elliott Hughes | 352a424 | 2011-10-31 15:15:21 -0700 | [diff] [blame] | 571 | #ifndef NDEBUG |
Elliott Hughes | 4dd9b4d | 2011-12-12 18:29:24 -0800 | [diff] [blame] | 572 | VLOG(heap) << "MarkSweep scanned classes=" << class_count_ << " arrays=" << array_count_ << " other=" << other_count_; |
Elliott Hughes | 352a424 | 2011-10-31 15:15:21 -0700 | [diff] [blame] | 573 | #endif |
Carl Shapiro | 58551df | 2011-07-24 03:09:51 -0700 | [diff] [blame] | 574 | delete mark_stack_; |
Carl Shapiro | 69759ea | 2011-07-21 18:13:35 -0700 | [diff] [blame] | 575 | mark_bitmap_->Clear(); |
| 576 | } |
| 577 | |
| 578 | } // namespace art |