summaryrefslogtreecommitdiffstats
path: root/runtime/gc/collector/garbage_collector.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-02-03 14:00:42 -0800
committerMathieu Chartier <mathieuc@google.com>2014-02-03 16:00:05 -0800
commit1f3b5358b28a83f0929bdd8ce738f06908677fb7 (patch)
tree81545b9a91de8bde45f55c7dbc8a9d5358a89bdb /runtime/gc/collector/garbage_collector.cc
parent1f00671edaaa34578319d0fdaf605600ed539d41 (diff)
downloadart-1f3b5358b28a83f0929bdd8ce738f06908677fb7.zip
art-1f3b5358b28a83f0929bdd8ce738f06908677fb7.tar.gz
art-1f3b5358b28a83f0929bdd8ce738f06908677fb7.tar.bz2
Move SwapBitmaps to ContinuousMemMapAllocSpace.
Moved the SwapBitmaps function to ContinuousMemMapAllocSpace since the zygote space uses this function during full GC. Fixed a place where we were casting a ZygoteSpace to a MallocSpace, somehow this didn't cause any issues in non-debug builds. Moved the CollectGarbage in PreZygoteFork before the lock to prevent an occasional lock level violation caused by attempting to enqueue java lang references with the a lock. Bug: 12876255 Change-Id: I77439e46d5b26b37724bdcee3a0948410f1b0eb4
Diffstat (limited to 'runtime/gc/collector/garbage_collector.cc')
-rw-r--r--runtime/gc/collector/garbage_collector.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc
index 25e8966..ae04074 100644
--- a/runtime/gc/collector/garbage_collector.cc
+++ b/runtime/gc/collector/garbage_collector.cc
@@ -151,10 +151,11 @@ void GarbageCollector::SwapBitmaps() {
space->GetGcRetentionPolicy() == space::kGcRetentionPolicyFullCollect)) {
accounting::SpaceBitmap* live_bitmap = space->GetLiveBitmap();
accounting::SpaceBitmap* mark_bitmap = space->GetMarkBitmap();
- if (live_bitmap != mark_bitmap) {
+ if (live_bitmap != nullptr && live_bitmap != mark_bitmap) {
heap_->GetLiveBitmap()->ReplaceBitmap(live_bitmap, mark_bitmap);
heap_->GetMarkBitmap()->ReplaceBitmap(mark_bitmap, live_bitmap);
- space->AsMallocSpace()->SwapBitmaps();
+ CHECK(space->IsContinuousMemMapAllocSpace());
+ space->AsContinuousMemMapAllocSpace()->SwapBitmaps();
}
}
}