From 0b71357fb52be9bb06d35396a3042b4381b01041 Mon Sep 17 00:00:00 2001 From: Hiroshi Yamauchi Date: Tue, 16 Jun 2015 18:29:23 -0700 Subject: Thread-local mark stacks for the CC collector. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thread-local mark stacks are assigned to mutators where they push references in read barriers to reduce the (CAS) synchronization cost in a global mark stack/queue. We step through three mark stack modes (thread-local, shared, GC-exclusive) and use per-thread flags to disable/enable system weak accesses (only for the CC collector) instead of the existing global one to safely perform the marking phase. The reasons are 1) thread-local mark stacks for mutators need to be revoked using a checkpoint to avoid races (incorrectly leaving a reference on mark stacks) when terminating marking, and 2) we can’t use a checkpoint while system weak accesses are disabled (or a deadlock would happen). More details are described in the code comments. Performance improvements in Ritzperf EAAC: a ~2.8% improvement (13290->12918) in run time and a ~23% improvement (51.6s->39.8s) in the total GC time on N5. Bug: 12687968 Change-Id: I5d234d7e48bf115cd773d38bdb62ad24ce9116c7 --- runtime/gc/reference_processor.h | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/gc/reference_processor.h') diff --git a/runtime/gc/reference_processor.h b/runtime/gc/reference_processor.h index a44319ba5a..284d13cd4b 100644 --- a/runtime/gc/reference_processor.h +++ b/runtime/gc/reference_processor.h @@ -54,6 +54,7 @@ class ReferenceProcessor { // Only allow setting this with mutators suspended so that we can avoid using a lock in the // GetReferent fast path as an optimization. void EnableSlowPath() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void BroadcastForSlowPath(Thread* self); // Decode the referent, may block if references are being processed. mirror::Object* GetReferent(Thread* self, mirror::Reference* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) LOCKS_EXCLUDED(Locks::reference_processor_lock_); -- cgit v1.2.3-59-g8ed1b