summaryrefslogtreecommitdiffstats
path: root/runtime/gc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/gc')
-rw-r--r--runtime/gc/collector/garbage_collector.cc12
-rw-r--r--runtime/gc/collector/garbage_collector.h2
2 files changed, 11 insertions, 3 deletions
diff --git a/runtime/gc/collector/garbage_collector.cc b/runtime/gc/collector/garbage_collector.cc
index 094e274..1e1e447 100644
--- a/runtime/gc/collector/garbage_collector.cc
+++ b/runtime/gc/collector/garbage_collector.cc
@@ -64,6 +64,12 @@ void GarbageCollector::ResetCumulativeStatistics() {
total_freed_bytes_ = 0;
}
+void GarbageCollector::RevokeAllThreadLocalBuffers() {
+ timings_.StartSplit("(Paused)RevokeAllThreadLocalBuffers");
+ GetHeap()->RevokeAllThreadLocalBuffers();
+ timings_.EndSplit();
+}
+
void GarbageCollector::Run(GcCause gc_cause, bool clear_soft_references) {
ThreadList* thread_list = Runtime::Current()->GetThreadList();
Thread* self = Thread::Current();
@@ -89,14 +95,14 @@ void GarbageCollector::Run(GcCause gc_cause, bool clear_soft_references) {
// current collector / allocator during process state updates.
if (Locks::mutator_lock_->IsExclusiveHeld(self)) {
// PreGcRosAllocVerification() is called in Heap::TransitionCollector().
- GetHeap()->RevokeAllThreadLocalBuffers();
+ RevokeAllThreadLocalBuffers();
MarkingPhase();
ReclaimPhase();
// PostGcRosAllocVerification() is called in Heap::TransitionCollector().
} else {
thread_list->SuspendAll();
GetHeap()->PreGcRosAllocVerification(&timings_);
- GetHeap()->RevokeAllThreadLocalBuffers();
+ RevokeAllThreadLocalBuffers();
MarkingPhase();
ReclaimPhase();
GetHeap()->PostGcRosAllocVerification(&timings_);
@@ -121,7 +127,7 @@ void GarbageCollector::Run(GcCause gc_cause, bool clear_soft_references) {
GetHeap()->PreGcRosAllocVerification(&timings_);
done = HandleDirtyObjectsPhase();
if (done) {
- GetHeap()->RevokeAllThreadLocalBuffers();
+ RevokeAllThreadLocalBuffers();
}
GetHeap()->PostGcRosAllocVerification(&timings_);
ATRACE_END();
diff --git a/runtime/gc/collector/garbage_collector.h b/runtime/gc/collector/garbage_collector.h
index 8d401b8..8259cf0 100644
--- a/runtime/gc/collector/garbage_collector.h
+++ b/runtime/gc/collector/garbage_collector.h
@@ -127,6 +127,8 @@ class GarbageCollector {
// Called after the GC is finished. Done without mutators paused.
virtual void FinishPhase() = 0;
+ void RevokeAllThreadLocalBuffers();
+
static constexpr size_t kPauseBucketSize = 500;
static constexpr size_t kPauseBucketCount = 32;