diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2015-01-10 01:58:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-10 01:58:16 +0000 |
commit | 313c9c6413b78e0f9ed791ce079490423872c2d8 (patch) | |
tree | a64818c82de21ebc3ed101d04a77f752efc18ceb | |
parent | 1de532495b2669ce4fae9b9d20848d78d83813d8 (diff) | |
parent | a233e03473cd9f0a582447f71946122140a2472c (diff) | |
download | android_art-313c9c6413b78e0f9ed791ce079490423872c2d8.tar.gz android_art-313c9c6413b78e0f9ed791ce079490423872c2d8.tar.bz2 android_art-313c9c6413b78e0f9ed791ce079490423872c2d8.zip |
Merge "[WIP] Fix a rosalloc verification crash."
-rw-r--r-- | runtime/gc/collector/semi_space.cc | 13 | ||||
-rw-r--r-- | runtime/gc/heap.cc | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc index cb9f111058..681bfaac83 100644 --- a/runtime/gc/collector/semi_space.cc +++ b/runtime/gc/collector/semi_space.cc @@ -251,10 +251,13 @@ void SemiSpace::MarkingPhase() { // Note: Freed bytes can be negative if we copy form a compacted space to a free-list backed // space. RecordFree(ObjectBytePair(from_objects - to_objects, from_bytes - to_bytes)); - // Clear and protect the from space. + // Clear the from space. Protect it with PROT_READ here and if + // kProtectFromSpace is true, will protect it with PROT_NONE later + // in FinishPhase() so the rosalloc verification works (can read the + // metadata magic number.) from_space_->Clear(); - VLOG(heap) << "Protecting from_space_: " << *from_space_; - from_space_->GetMemMap()->Protect(kProtectFromSpace ? PROT_NONE : PROT_READ); + VLOG(heap) << "Protecting from_space_ with PROT_READ : " << *from_space_; + from_space_->GetMemMap()->Protect(PROT_READ); heap_->PreSweepingGcVerification(this); if (swap_semi_spaces_) { heap_->SwapSemiSpaces(); @@ -749,6 +752,10 @@ void SemiSpace::SetFromSpace(space::ContinuousMemMapAllocSpace* from_space) { void SemiSpace::FinishPhase() { TimingLogger::ScopedTiming t(__FUNCTION__, GetTimings()); + if (kProtectFromSpace) { + VLOG(heap) << "Protecting from_space_ with PROT_NONE : " << *from_space_; + from_space_->GetMemMap()->Protect(PROT_NONE); + } // Null the "to" and "from" spaces since compacting from one to the other isn't valid until // further action is done by the heap. to_space_ = nullptr; diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index db287d3436..618f1cc220 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -1592,8 +1592,6 @@ HomogeneousSpaceCompactResult Heap::PerformHomogeneousSpaceCompact() { // Make sure that we will have enough room to copy. CHECK_GE(to_space->GetFootprintLimit(), from_space->GetFootprintLimit()); Compact(to_space, from_space, kGcCauseHomogeneousSpaceCompact); - // Leave as prot read so that we can still run ROSAlloc verification on this space. - from_space->GetMemMap()->Protect(PROT_READ); const uint64_t space_size_after_compaction = to_space->Size(); main_space_ = to_space; main_space_backup_.reset(from_space); |