Avoid a use before initialization in mark sweep.
MarkSweep::GetName reads is_concurrent_, we pass GetName to the timing loggers
but before is_concurrent_ is initialized. Reorder is_concurrent_ to fix.
Change-Id: I98a65534a86ad18789aa0624808235f6b68c58d6
diff --git a/src/gc/mark_sweep.cc b/src/gc/mark_sweep.cc
index 35e75cb..25b4b78 100644
--- a/src/gc/mark_sweep.cc
+++ b/src/gc/mark_sweep.cc
@@ -137,9 +137,9 @@
gc_barrier_(new Barrier(0)),
large_object_lock_("mark sweep large object lock", kMarkSweepLargeObjectLock),
mark_stack_expand_lock_("mark sweep mark stack expand lock"),
+ is_concurrent_(is_concurrent),
timings_(GetName(), true),
- cumulative_timings_(GetName()),
- is_concurrent_(is_concurrent) {
+ cumulative_timings_(GetName()) {
cumulative_timings_.SetName(GetName());
ResetCumulativeStatistics();
}
diff --git a/src/gc/mark_sweep.h b/src/gc/mark_sweep.h
index dc722a0..11ce32f 100644
--- a/src/gc/mark_sweep.h
+++ b/src/gc/mark_sweep.h
@@ -423,10 +423,12 @@
UniquePtr<Barrier> gc_barrier_;
Mutex large_object_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
Mutex mark_stack_expand_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
+
+ const bool is_concurrent_;
+
TimingLogger timings_;
CumulativeLogger cumulative_timings_;
- bool is_concurrent_;
bool clear_soft_references_;
friend class AddIfReachesAllocSpaceVisitor; // Used by mod-union table.