summaryrefslogtreecommitdiff
path: root/runtime/gc/reference_processor.cc
diff options
context:
space:
mode:
author Hiroshi Yamauchi <yamauchi@google.com> 2016-11-11 18:44:44 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-11-11 18:44:44 +0000
commit39ce7d2907edb978f1ab6cd75884be48ab11cd77 (patch)
tree7d2f0c56bd8a7dd483b5c1ede7047b623d0e35d7 /runtime/gc/reference_processor.cc
parent5302bd999afee6db5b0cfd63e6a49b0fcbf92dd4 (diff)
parent3049324f4ef71b5d7a3de49bd77c75f07dbf8f3a (diff)
Merge "Make empty checkpoint work while weak ref access is disabled."
Diffstat (limited to 'runtime/gc/reference_processor.cc')
-rw-r--r--runtime/gc/reference_processor.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc
index 798ecd3d87..2cde7d5731 100644
--- a/runtime/gc/reference_processor.cc
+++ b/runtime/gc/reference_processor.cc
@@ -55,7 +55,6 @@ void ReferenceProcessor::DisableSlowPath(Thread* self) {
}
void ReferenceProcessor::BroadcastForSlowPath(Thread* self) {
- CHECK(kUseReadBarrier);
MutexLock mu(self, *Locks::reference_processor_lock_);
condition_.Broadcast(self);
}
@@ -99,6 +98,9 @@ ObjPtr<mirror::Object> ReferenceProcessor::GetReferent(Thread* self,
}
}
}
+ // Check and run the empty checkpoint before blocking so the empty checkpoint will work in the
+ // presence of threads blocking for weak ref access.
+ self->CheckEmptyCheckpoint();
condition_.WaitHoldingLocks(self);
}
return reference->GetReferent();
@@ -270,6 +272,9 @@ bool ReferenceProcessor::MakeCircularListIfUnenqueued(
// Wait untul we are done processing reference.
while ((!kUseReadBarrier && SlowPathEnabled()) ||
(kUseReadBarrier && !self->GetWeakRefAccessEnabled())) {
+ // Check and run the empty checkpoint before blocking so the empty checkpoint will work in the
+ // presence of threads blocking for weak ref access.
+ self->CheckEmptyCheckpoint();
condition_.WaitHoldingLocks(self);
}
// At this point, since the sentinel of the reference is live, it is guaranteed to not be