diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-08-27 13:02:30 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-08-27 17:08:59 -0700 |
commit | ba311b4385fa3f382f01312a8cc97b52011232e3 (patch) | |
tree | 2243c216174e2decae3ce920be6b6c2a0478128d /runtime/gc/collector/mark_sweep.h | |
parent | 11b63d13f0a3be0f74390b66b58614a37f9aa6c1 (diff) | |
download | art-ba311b4385fa3f382f01312a8cc97b52011232e3.zip art-ba311b4385fa3f382f01312a8cc97b52011232e3.tar.gz art-ba311b4385fa3f382f01312a8cc97b52011232e3.tar.bz2 |
Fix mark stack expand race.
We now guard parallel mark stack pushing with a lock. This is
only used by checkpoint root marking. I did not observe a
significant slowdown by looking at ritzperf and maps, but it may
be worth reinvestigating in the future.
Also a bit of refactoring.
Bug: 10113123
Change-Id: Ifcb12d14df437e2aea9a1165a9568054f80d91b3
Diffstat (limited to 'runtime/gc/collector/mark_sweep.h')
-rw-r--r-- | runtime/gc/collector/mark_sweep.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/gc/collector/mark_sweep.h b/runtime/gc/collector/mark_sweep.h index dbec3e9..d5f4042 100644 --- a/runtime/gc/collector/mark_sweep.h +++ b/runtime/gc/collector/mark_sweep.h @@ -305,8 +305,9 @@ class MarkSweep : public GarbageCollector { void VerifyRoots() NO_THREAD_SAFETY_ANALYSIS; - // Expand mark stack to 2x its current size. Thread safe. - void ExpandMarkStack(); + // Expand mark stack to 2x its current size. + void ExpandMarkStack() EXCLUSIVE_LOCKS_REQUIRED(mark_stack_lock_); + void ResizeMarkStack(size_t new_size) EXCLUSIVE_LOCKS_REQUIRED(mark_stack_lock_); // Returns how many threads we should use for the current GC phase based on if we are paused, // whether or not we care about pauses. @@ -445,7 +446,7 @@ class MarkSweep : public GarbageCollector { UniquePtr<Barrier> gc_barrier_; Mutex large_object_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; - Mutex mark_stack_expand_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; + Mutex mark_stack_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; const bool is_concurrent_; |