blob: ae6edea0799ea5db15d9c32cbb0ba28a2dc84ed8 [file] [log] [blame]
Carl Shapiro69759ea2011-07-21 18:13:35 -07001// Copyright 2011 Google Inc. All Rights Reserved.
Carl Shapiro69759ea2011-07-21 18:13:35 -07002
Brian Carlstrom578bbdc2011-07-21 14:07:47 -07003#include "mark_sweep.h"
Carl Shapiro69759ea2011-07-21 18:13:35 -07004
Carl Shapiro58551df2011-07-24 03:09:51 -07005#include <climits>
6#include <vector>
7
Elliott Hughes410c0c82011-09-01 17:58:25 -07008#include "class_loader.h"
Brian Carlstrom693267a2011-09-06 09:25:34 -07009#include "dex_cache.h"
Carl Shapiro58551df2011-07-24 03:09:51 -070010#include "heap.h"
Elliott Hughes410c0c82011-09-01 17:58:25 -070011#include "indirect_reference_table.h"
12#include "intern_table.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070013#include "logging.h"
14#include "macros.h"
15#include "mark_stack.h"
16#include "object.h"
Brian Carlstrom1f870082011-08-23 16:02:11 -070017#include "runtime.h"
Carl Shapiro58551df2011-07-24 03:09:51 -070018#include "space.h"
Brian Carlstrom578bbdc2011-07-21 14:07:47 -070019#include "thread.h"
Carl Shapiro69759ea2011-07-21 18:13:35 -070020
Carl Shapiro69759ea2011-07-21 18:13:35 -070021namespace art {
22
Carl Shapiro58551df2011-07-24 03:09:51 -070023bool MarkSweep::Init() {
Brian Carlstrom4a289ed2011-08-16 17:17:49 -070024 mark_stack_ = MarkStack::Create();
Carl Shapiro58551df2011-07-24 03:09:51 -070025 if (mark_stack_ == NULL) {
26 return false;
27 }
28
29 mark_bitmap_ = Heap::GetMarkBits();
30 live_bitmap_ = Heap::GetLiveBits();
31
32 // TODO: if concurrent, clear the card table.
33
buzbee0d966cf2011-09-08 17:34:58 -070034 // TODO: if concurrent, enable card marking in compiler
35
Carl Shapiro58551df2011-07-24 03:09:51 -070036 // TODO: check that the mark bitmap is entirely clear.
37
38 return true;
39}
40
Carl Shapiro69759ea2011-07-21 18:13:35 -070041void MarkSweep::MarkObject0(const Object* obj, bool check_finger) {
42 DCHECK(obj != NULL);
43 if (obj < condemned_) {
44 DCHECK(IsMarked(obj));
45 return;
46 }
47 bool is_marked = mark_bitmap_->Test(obj);
48 // This object was not previously marked.
49 if (!is_marked) {
50 mark_bitmap_->Set(obj);
51 if (check_finger && obj < finger_) {
52 // The object must be pushed on to the mark stack.
53 mark_stack_->Push(obj);
54 }
55 }
56}
57
58// Used to mark objects when recursing. Recursion is done by moving
59// the finger across the bitmaps in address order and marking child
60// objects. Any newly-marked objects whose addresses are lower than
61// the finger won't be visited by the bitmap scan, so those objects
62// need to be added to the mark stack.
63void MarkSweep::MarkObject(const Object* obj) {
64 if (obj != NULL) {
65 MarkObject0(obj, true);
66 }
67}
68
Elliott Hughescf4c6c42011-09-01 15:16:42 -070069void MarkSweep::MarkObjectVisitor(const Object* root, void* arg) {
Brian Carlstrom1f870082011-08-23 16:02:11 -070070 DCHECK(root != NULL);
71 DCHECK(arg != NULL);
72 MarkSweep* mark_sweep = reinterpret_cast<MarkSweep*>(arg);
73 mark_sweep->MarkObject0(root, true);
74}
75
Carl Shapiro69759ea2011-07-21 18:13:35 -070076// Marks all objects in the root set.
77void MarkSweep::MarkRoots() {
Brian Carlstrom1f870082011-08-23 16:02:11 -070078 Runtime::Current()->VisitRoots(MarkObjectVisitor, this);
Carl Shapiro69759ea2011-07-21 18:13:35 -070079}
80
Carl Shapiro58551df2011-07-24 03:09:51 -070081void MarkSweep::ScanBitmapCallback(Object* obj, void* finger, void* arg) {
82 MarkSweep* mark_sweep = reinterpret_cast<MarkSweep*>(arg);
83 mark_sweep->finger_ = reinterpret_cast<Object*>(finger);
84 mark_sweep->ScanObject(obj);
85}
86
87// Populates the mark stack based on the set of marked objects and
88// recursively marks until the mark stack is emptied.
89void MarkSweep::RecursiveMark() {
Brian Carlstrom1f870082011-08-23 16:02:11 -070090
91 // RecursiveMark will build the lists of known instances of the Reference classes.
92 // See DelayReferenceReferent for details.
93 CHECK(soft_reference_list_ == NULL);
94 CHECK(weak_reference_list_ == NULL);
95 CHECK(finalizer_reference_list_ == NULL);
96 CHECK(phantom_reference_list_ == NULL);
97 CHECK(cleared_reference_list_ == NULL);
98
Carl Shapiro58551df2011-07-24 03:09:51 -070099 void* arg = reinterpret_cast<void*>(this);
100 const std::vector<Space*>& spaces = Heap::GetSpaces();
101 for (size_t i = 0; i < spaces.size(); ++i) {
102 if (spaces[i]->IsCondemned()) {
103 uintptr_t base = reinterpret_cast<uintptr_t>(spaces[i]->GetBase());
Brian Carlstrom1f870082011-08-23 16:02:11 -0700104 mark_bitmap_->ScanWalk(base, &MarkSweep::ScanBitmapCallback, arg);
Carl Shapiro58551df2011-07-24 03:09:51 -0700105 }
106 }
107 finger_ = reinterpret_cast<Object*>(~0);
108 ProcessMarkStack();
109}
110
111void MarkSweep::ReMarkRoots() {
Elliott Hughes53b61312011-08-12 18:28:20 -0700112 UNIMPLEMENTED(FATAL);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700113}
114
Elliott Hughes410c0c82011-09-01 17:58:25 -0700115void MarkSweep::SweepJniWeakGlobals() {
116 JavaVMExt* vm = Runtime::Current()->GetJavaVM();
117 MutexLock mu(vm->weak_globals_lock);
118 IndirectReferenceTable* table = &vm->weak_globals;
119 typedef IndirectReferenceTable::iterator It; // TODO: C++0x auto
120 for (It it = table->begin(), end = table->end(); it != end; ++it) {
121 const Object** entry = *it;
122 if (!IsMarked(*entry)) {
123 *entry = kClearedJniWeakGlobal;
124 }
125 }
126}
127
128struct InternTableEntryIsUnmarked : public InternTable::Predicate {
129 InternTableEntryIsUnmarked(MarkSweep* ms) : ms_(ms) { }
130
131 bool operator()(const String* s) const {
132 return !ms_->IsMarked(s);
133 }
134
135 MarkSweep* ms_;
136};
137
138void MarkSweep::SweepMonitorList() {
Elliott Hughes53b61312011-08-12 18:28:20 -0700139 UNIMPLEMENTED(FATAL);
Elliott Hughescf4c6c42011-09-01 15:16:42 -0700140 //dvmSweepMonitorList(&gDvm.monitorList, isUnmarkedObject);
Elliott Hughes410c0c82011-09-01 17:58:25 -0700141}
142
143void MarkSweep::SweepSystemWeaks() {
144 Runtime::Current()->GetInternTable()->RemoveWeakIf(InternTableEntryIsUnmarked(this));
145 SweepMonitorList();
146 SweepJniWeakGlobals();
Carl Shapiro58551df2011-07-24 03:09:51 -0700147}
148
Brian Carlstrom78128a62011-09-15 17:21:19 -0700149void MarkSweep::SweepCallback(size_t num_ptrs, void** ptrs, void* arg) {
Carl Shapiro58551df2011-07-24 03:09:51 -0700150 // TODO, lock heap if concurrent
151 Space* space = static_cast<Space*>(arg);
152 for (size_t i = 0; i < num_ptrs; ++i) {
153 Object* obj = static_cast<Object*>(ptrs[i]);
Elliott Hughes92b3b562011-09-08 16:32:26 -0700154 Heap::RecordFreeLocked(space, obj);
Carl Shapiro58551df2011-07-24 03:09:51 -0700155 space->Free(obj);
156 }
157 // TODO, unlock heap if concurrent
158}
159
160void MarkSweep::Sweep() {
161 const std::vector<Space*>& spaces = Heap::GetSpaces();
162 for (size_t i = 0; i < spaces.size(); ++i) {
163 if (spaces[i]->IsCondemned()) {
164 uintptr_t base = reinterpret_cast<uintptr_t>(spaces[i]->GetBase());
165 uintptr_t limit = reinterpret_cast<uintptr_t>(spaces[i]->GetLimit());
166 void* arg = static_cast<void*>(spaces[i]);
167 HeapBitmap::SweepWalk(*live_bitmap_, *mark_bitmap_, base, limit,
168 &MarkSweep::SweepCallback, arg);
169 }
170 }
171}
172
Carl Shapiro69759ea2011-07-21 18:13:35 -0700173// Scans instance fields.
174void MarkSweep::ScanInstanceFields(const Object* obj) {
175 DCHECK(obj != NULL);
Brian Carlstrom4873d462011-08-21 15:23:39 -0700176 Class* klass = obj->GetClass();
177 DCHECK(klass != NULL);
178 ScanFields(obj,
179 klass->GetReferenceInstanceOffsets(),
180 false);
181}
182
183// Scans static storage on a Class.
184void MarkSweep::ScanStaticFields(const Class* klass) {
185 DCHECK(klass != NULL);
Elliott Hughesadb460d2011-10-05 17:02:34 -0700186 ScanFields(klass, klass->GetReferenceStaticOffsets(), true);
Brian Carlstrom4873d462011-08-21 15:23:39 -0700187}
188
189void MarkSweep::ScanFields(const Object* obj,
190 uint32_t ref_offsets,
191 bool is_static) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700192 if (ref_offsets != CLASS_WALK_SUPER) {
193 // Found a reference offset bitmap. Mark the specified offsets.
194 while (ref_offsets != 0) {
195 size_t right_shift = CLZ(ref_offsets);
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700196 MemberOffset byte_offset = CLASS_OFFSET_FROM_CLZ(right_shift);
197 const Object* ref = obj->GetFieldObject<const Object*>(byte_offset, false);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700198 MarkObject(ref);
199 ref_offsets &= ~(CLASS_HIGH_BIT >> right_shift);
200 }
201 } else {
Brian Carlstrom4873d462011-08-21 15:23:39 -0700202 // There is no reference offset bitmap. In the non-static case,
203 // walk up the class inheritance hierarchy and find reference
204 // offsets the hard way. In the static case, just consider this
205 // class.
206 for (const Class* klass = is_static ? obj->AsClass() : obj->GetClass();
Carl Shapiro69759ea2011-07-21 18:13:35 -0700207 klass != NULL;
Brian Carlstrom4873d462011-08-21 15:23:39 -0700208 klass = is_static ? NULL : klass->GetSuperClass()) {
209 size_t num_reference_fields = (is_static
210 ? klass->NumReferenceStaticFields()
211 : klass->NumReferenceInstanceFields());
212 for (size_t i = 0; i < num_reference_fields; ++i) {
213 Field* field = (is_static
214 ? klass->GetStaticField(i)
215 : klass->GetInstanceField(i));
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700216 MemberOffset field_offset = field->GetOffset();
217 const Object* ref = obj->GetFieldObject<const Object*>(field_offset, false);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700218 MarkObject(ref);
219 }
220 }
221 }
222}
223
Carl Shapiro69759ea2011-07-21 18:13:35 -0700224// Scans the header, static field references, and interface pointers
225// of a class object.
226void MarkSweep::ScanClass(const Object* obj) {
227 DCHECK(obj != NULL);
228 DCHECK(obj->IsClass());
229 const Class* klass = obj->AsClass();
230 MarkObject(klass->GetClass());
Brian Carlstrom693267a2011-09-06 09:25:34 -0700231 ScanInstanceFields(obj);
232 MarkObject(klass->GetDescriptor());
233 MarkObject(klass->GetDexCache());
234 MarkObject(klass->GetVerifyErrorClass());
Brian Carlstromb63ec392011-08-27 17:38:27 -0700235 if (klass->IsArrayClass()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700236 MarkObject(klass->GetComponentType());
237 }
238 if (klass->IsLoaded()) {
239 MarkObject(klass->GetSuperClass());
240 }
241 MarkObject(klass->GetClassLoader());
Carl Shapiro69759ea2011-07-21 18:13:35 -0700242 if (klass->IsLoaded()) {
Brian Carlstrom693267a2011-09-06 09:25:34 -0700243 MarkObject(klass->GetInterfaces());
244 MarkObject(klass->GetDirectMethods());
245 MarkObject(klass->GetVirtualMethods());
246 MarkObject(klass->GetIFields());
247 MarkObject(klass->GetSFields());
Carl Shapiro69759ea2011-07-21 18:13:35 -0700248 }
Brian Carlstrom693267a2011-09-06 09:25:34 -0700249 ScanStaticFields(klass);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700250}
251
252// Scans the header of all array objects. If the array object is
253// specialized to a reference type, scans the array data as well.
Brian Carlstrom4873d462011-08-21 15:23:39 -0700254void MarkSweep::ScanArray(const Object* obj) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700255 DCHECK(obj != NULL);
256 DCHECK(obj->GetClass() != NULL);
257 MarkObject(obj->GetClass());
258 if (obj->IsObjectArray()) {
Brian Carlstromdb4d5402011-08-09 12:18:28 -0700259 const ObjectArray<Object>* array = obj->AsObjectArray<Object>();
Elliott Hughesd8ddfd52011-08-15 14:32:53 -0700260 for (int32_t i = 0; i < array->GetLength(); ++i) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700261 const Object* element = array->Get(i);
262 MarkObject(element);
263 }
264 }
265}
266
Carl Shapiro69759ea2011-07-21 18:13:35 -0700267// Process the "referent" field in a java.lang.ref.Reference. If the
268// referent has not yet been marked, put it on the appropriate list in
269// the gcHeap for later processing.
270void MarkSweep::DelayReferenceReferent(Object* obj) {
271 DCHECK(obj != NULL);
Brian Carlstrom1f870082011-08-23 16:02:11 -0700272 Class* klass = obj->GetClass();
273 DCHECK(klass != NULL);
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700274 DCHECK(klass->IsReferenceClass());
275 Object* pending = obj->GetFieldObject<Object*>(Heap::GetReferencePendingNextOffset(), false);
Elliott Hughesadb460d2011-10-05 17:02:34 -0700276 Object* referent = Heap::GetReferenceReferent(obj);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700277 if (pending == NULL && referent != NULL && !IsMarked(referent)) {
Brian Carlstrom4873d462011-08-21 15:23:39 -0700278 Object** list = NULL;
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700279 if (klass->IsSoftReferenceClass()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700280 list = &soft_reference_list_;
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700281 } else if (klass->IsWeakReferenceClass()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700282 list = &weak_reference_list_;
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700283 } else if (klass->IsFinalizerReferenceClass()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700284 list = &finalizer_reference_list_;
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700285 } else if (klass->IsPhantomReferenceClass()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700286 list = &phantom_reference_list_;
287 }
288 DCHECK(list != NULL);
Elliott Hughesadb460d2011-10-05 17:02:34 -0700289 Heap::EnqueuePendingReference(obj, list);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700290 }
291}
292
293// Scans the header and field references of a data object. If the
294// scanned object is a reference subclass, it is scheduled for later
Elliott Hughesadb460d2011-10-05 17:02:34 -0700295// processing.
Carl Shapiro58551df2011-07-24 03:09:51 -0700296void MarkSweep::ScanOther(const Object* obj) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700297 DCHECK(obj != NULL);
Brian Carlstrom1f870082011-08-23 16:02:11 -0700298 Class* klass = obj->GetClass();
299 DCHECK(klass != NULL);
300 MarkObject(klass);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700301 ScanInstanceFields(obj);
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700302 if (klass->IsReferenceClass()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700303 DelayReferenceReferent(const_cast<Object*>(obj));
304 }
305}
306
307// Scans an object reference. Determines the type of the reference
308// and dispatches to a specialized scanning routine.
309void MarkSweep::ScanObject(const Object* obj) {
310 DCHECK(obj != NULL);
311 DCHECK(obj->GetClass() != NULL);
312 DCHECK(IsMarked(obj));
313 if (obj->IsClass()) {
314 ScanClass(obj);
Brian Carlstromb63ec392011-08-27 17:38:27 -0700315 } else if (obj->IsArrayInstance()) {
Carl Shapiro69759ea2011-07-21 18:13:35 -0700316 ScanArray(obj);
317 } else {
Carl Shapiro58551df2011-07-24 03:09:51 -0700318 ScanOther(obj);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700319 }
320}
321
322// Scan anything that's on the mark stack. We can't use the bitmaps
323// anymore, so use a finger that points past the end of them.
324void MarkSweep::ProcessMarkStack() {
325 while (!mark_stack_->IsEmpty()) {
Brian Carlstrom4873d462011-08-21 15:23:39 -0700326 const Object* obj = mark_stack_->Pop();
Carl Shapiro69759ea2011-07-21 18:13:35 -0700327 ScanObject(obj);
328 }
329}
330
331void MarkSweep::ScanDirtyObjects() {
332 ProcessMarkStack();
333}
334
Carl Shapiro69759ea2011-07-21 18:13:35 -0700335// Walks the reference list marking any references subject to the
336// reference clearing policy. References with a black referent are
337// removed from the list. References with white referents biased
338// toward saving are blackened and also removed from the list.
339void MarkSweep::PreserveSomeSoftReferences(Object** list) {
340 DCHECK(list != NULL);
341 Object* clear = NULL;
342 size_t counter = 0;
343 while (*list != NULL) {
Elliott Hughesadb460d2011-10-05 17:02:34 -0700344 Object* ref = Heap::DequeuePendingReference(list);
345 Object* referent = Heap::GetReferenceReferent(ref);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700346 if (referent == NULL) {
347 // Referent was cleared by the user during marking.
348 continue;
349 }
350 bool is_marked = IsMarked(referent);
351 if (!is_marked && ((++counter) & 1)) {
352 // Referent is white and biased toward saving, mark it.
353 MarkObject(referent);
354 is_marked = true;
355 }
356 if (!is_marked) {
357 // Referent is white, queue it for clearing.
Elliott Hughesadb460d2011-10-05 17:02:34 -0700358 Heap::EnqueuePendingReference(ref, &clear);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700359 }
360 }
361 *list = clear;
362 // Restart the mark with the newly black references added to the
363 // root set.
364 ProcessMarkStack();
365}
366
367// Unlink the reference list clearing references objects with white
368// referents. Cleared references registered to a reference queue are
369// scheduled for appending by the heap worker thread.
370void MarkSweep::ClearWhiteReferences(Object** list) {
371 DCHECK(list != NULL);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700372 while (*list != NULL) {
Elliott Hughesadb460d2011-10-05 17:02:34 -0700373 Object* ref = Heap::DequeuePendingReference(list);
374 Object* referent = Heap::GetReferenceReferent(ref);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700375 if (referent != NULL && !IsMarked(referent)) {
376 // Referent is white, clear it.
Elliott Hughesadb460d2011-10-05 17:02:34 -0700377 Heap::ClearReferenceReferent(ref);
378 if (Heap::IsEnqueuable(ref)) {
379 Heap::EnqueueReference(ref, &cleared_reference_list_);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700380 }
381 }
382 }
383 DCHECK(*list == NULL);
384}
385
386// Enqueues finalizer references with white referents. White
387// referents are blackened, moved to the zombie field, and the
388// referent field is cleared.
389void MarkSweep::EnqueueFinalizerReferences(Object** list) {
390 DCHECK(list != NULL);
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700391 MemberOffset zombie_offset = Heap::GetFinalizerReferenceZombieOffset();
Carl Shapiro69759ea2011-07-21 18:13:35 -0700392 bool has_enqueued = false;
393 while (*list != NULL) {
Elliott Hughesadb460d2011-10-05 17:02:34 -0700394 Object* ref = Heap::DequeuePendingReference(list);
395 Object* referent = Heap::GetReferenceReferent(ref);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700396 if (referent != NULL && !IsMarked(referent)) {
397 MarkObject(referent);
398 // If the referent is non-null the reference must queuable.
Elliott Hughesadb460d2011-10-05 17:02:34 -0700399 DCHECK(Heap::IsEnqueuable(ref));
Ian Rogers0cfe1fb2011-08-26 03:29:44 -0700400 ref->SetFieldObject(zombie_offset, referent, false);
Elliott Hughesadb460d2011-10-05 17:02:34 -0700401 Heap::ClearReferenceReferent(ref);
402 Heap::EnqueueReference(ref, &cleared_reference_list_);
Carl Shapiro69759ea2011-07-21 18:13:35 -0700403 has_enqueued = true;
404 }
405 }
406 if (has_enqueued) {
407 ProcessMarkStack();
408 }
409 DCHECK(*list == NULL);
410}
411
Carl Shapiro58551df2011-07-24 03:09:51 -0700412// Process reference class instances and schedule finalizations.
Carl Shapiro69759ea2011-07-21 18:13:35 -0700413void MarkSweep::ProcessReferences(Object** soft_references, bool clear_soft,
414 Object** weak_references,
415 Object** finalizer_references,
416 Object** phantom_references) {
417 DCHECK(soft_references != NULL);
418 DCHECK(weak_references != NULL);
419 DCHECK(finalizer_references != NULL);
420 DCHECK(phantom_references != NULL);
421
422 // Unless we are in the zygote or required to clear soft references
423 // with white references, preserve some white referents.
424 if (clear_soft) {
425 PreserveSomeSoftReferences(soft_references);
426 }
427
428 // Clear all remaining soft and weak references with white
429 // referents.
430 ClearWhiteReferences(soft_references);
431 ClearWhiteReferences(weak_references);
432
433 // Preserve all white objects with finalize methods and schedule
434 // them for finalization.
435 EnqueueFinalizerReferences(finalizer_references);
436
437 // Clear all f-reachable soft and weak references with white
438 // referents.
439 ClearWhiteReferences(soft_references);
440 ClearWhiteReferences(weak_references);
441
442 // Clear all phantom references with white referents.
443 ClearWhiteReferences(phantom_references);
444
445 // At this point all reference lists should be empty.
446 DCHECK(*soft_references == NULL);
447 DCHECK(*weak_references == NULL);
448 DCHECK(*finalizer_references == NULL);
449 DCHECK(*phantom_references == NULL);
450}
451
Carl Shapiro69759ea2011-07-21 18:13:35 -0700452MarkSweep::~MarkSweep() {
Carl Shapiro58551df2011-07-24 03:09:51 -0700453 delete mark_stack_;
Carl Shapiro69759ea2011-07-21 18:13:35 -0700454 mark_bitmap_->Clear();
455}
456
457} // namespace art