diff options
| author | 2025-01-22 20:48:14 +0000 | |
|---|---|---|
| committer | 2025-01-22 16:15:13 -0800 | |
| commit | 74d140050d566f40ecc021c3c80393931fff2d7f (patch) | |
| tree | 4f9e8f00d46bd9bf3b3cdc22aff8c46a7012d33d | |
| parent | b0af4d2bc412e5509232c3bb3db602cbe30a285b (diff) | |
Avoid setting live-bit for nullptr in large-object space with CMC
It's not only wrong, later, when sweeping large-object space, it fails
assertions and possibly crash.
Test: art/test/testrunner/testrunner.py --host
Change-Id: I9977338d466c234bac5abc95bbc9a82be9aa7c13
| -rw-r--r-- | runtime/gc/accounting/space_bitmap-inl.h | 2 | ||||
| -rw-r--r-- | runtime/gc/heap.cc | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h index a8dabde716..702a78731d 100644 --- a/runtime/gc/accounting/space_bitmap-inl.h +++ b/runtime/gc/accounting/space_bitmap-inl.h @@ -32,6 +32,7 @@ namespace accounting { template<size_t kAlignment> inline bool SpaceBitmap<kAlignment>::AtomicTestAndSet(const mirror::Object* obj) { + DCHECK(obj != nullptr); uintptr_t addr = reinterpret_cast<uintptr_t>(obj); DCHECK_GE(addr, heap_begin_); const uintptr_t offset = addr - heap_begin_; @@ -232,6 +233,7 @@ void SpaceBitmap<kAlignment>::Walk(Visitor&& visitor) { template<size_t kAlignment> template<bool kSetBit> inline bool SpaceBitmap<kAlignment>::Modify(const mirror::Object* obj) { + DCHECK(obj != nullptr); uintptr_t addr = reinterpret_cast<uintptr_t>(obj); DCHECK_GE(addr, heap_begin_); DCHECK(HasAddress(obj)) << obj; diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 531cbcf97b..dcb25a08d7 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -2688,7 +2688,7 @@ void Heap::MarkAllocStack(accounting::ContinuousSpaceBitmap* bitmap1, const auto* limit = stack->End(); for (auto* it = stack->Begin(); it != limit; ++it) { const mirror::Object* obj = it->AsMirrorPtr(); - if (!kUseThreadLocalAllocationStack || obj != nullptr) { + if (obj != nullptr) { if (bitmap1->HasAddress(obj)) { bitmap1->Set(obj); } else if (bitmap2->HasAddress(obj)) { |