Revert "Disable the from-space memory protection under debug/gcstress."
Bug: 31172841
This reverts commit 7a2d267b907000c56f401ab3c51f155cee9752a9.
Change-Id: I8ef4639f255118aba278f8051adf356271116507
diff --git a/runtime/gc/collector/semi_space.cc b/runtime/gc/collector/semi_space.cc
index fc04f30..0146150 100644
--- a/runtime/gc/collector/semi_space.cc
+++ b/runtime/gc/collector/semi_space.cc
@@ -265,20 +265,16 @@
RecordFree(ObjectBytePair(from_objects - to_objects, from_bytes - to_bytes));
// Clear and protect the from space.
from_space_->Clear();
- // b/31172841. Temporarily disable the from-space protection under gcstress mode with debug build
- // due to some protection issue in the build server.
- if (kProtectFromSpace && !(kIsDebugBuild && heap_->gc_stress_mode_)) {
- if (!from_space_->IsRosAllocSpace()) {
- // Protect with PROT_NONE.
- VLOG(heap) << "Protecting from_space_ : " << *from_space_;
- from_space_->GetMemMap()->Protect(PROT_NONE);
- } else {
- // If RosAllocSpace, we'll leave it as PROT_READ here so the
- // rosaloc verification can read the metadata magic number and
- // protect it with PROT_NONE later in FinishPhase().
- VLOG(heap) << "Protecting from_space_ with PROT_READ : " << *from_space_;
- from_space_->GetMemMap()->Protect(PROT_READ);
- }
+ if (kProtectFromSpace && !from_space_->IsRosAllocSpace()) {
+ // Protect with PROT_NONE.
+ VLOG(heap) << "Protecting from_space_ : " << *from_space_;
+ from_space_->GetMemMap()->Protect(PROT_NONE);
+ } else {
+ // If RosAllocSpace, we'll leave it as PROT_READ here so the
+ // rosaloc verification can read the metadata magic number and
+ // protect it with PROT_NONE later in FinishPhase().
+ VLOG(heap) << "Protecting from_space_ with PROT_READ : " << *from_space_;
+ from_space_->GetMemMap()->Protect(PROT_READ);
}
heap_->PreSweepingGcVerification(this);
if (swap_semi_spaces_) {
@@ -794,13 +790,9 @@
void SemiSpace::FinishPhase() {
TimingLogger::ScopedTiming t(__FUNCTION__, GetTimings());
- // b/31172841. Temporarily disable the from-space protection under gcstress mode with debug build
- // due to some protection issue in the build server.
- if (kProtectFromSpace && !(kIsDebugBuild && heap_->gc_stress_mode_)) {
- if (from_space_->IsRosAllocSpace()) {
- VLOG(heap) << "Protecting from_space_ with PROT_NONE : " << *from_space_;
- from_space_->GetMemMap()->Protect(PROT_NONE);
- }
+ if (kProtectFromSpace && from_space_->IsRosAllocSpace()) {
+ 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.