diff options
author | Mathieu Chartier <mathieuc@google.com> | 2013-09-16 19:43:47 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2013-09-17 10:03:00 -0700 |
commit | c4621985bdfc2b27494087e5dee65a6d0cc5a632 (patch) | |
tree | d8165f5b8d337e73942ee29d66fb40585dc7caf1 /runtime/runtime.cc | |
parent | 5666afd6854b5634ae741dc8a3a633fc47d52168 (diff) | |
download | art-c4621985bdfc2b27494087e5dee65a6d0cc5a632.zip art-c4621985bdfc2b27494087e5dee65a6d0cc5a632.tar.gz art-c4621985bdfc2b27494087e5dee65a6d0cc5a632.tar.bz2 |
Fix race in root marking.
There was a race which caused the class linker / intern table to not
become dirty after adding a root. We now guard the is dirty flag by
the corresponding locks to prevent this from occuring. This was
causing roots to be occasionally missed.
Also fixes the bug where we occasionally scan more cards than
needed.
Bug: 10626133
Change-Id: I0f6e72d92035ff463954d66988ef610ea0df61be
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r-- | runtime/runtime.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 09cbd0b..70a4df5 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1132,12 +1132,8 @@ void Runtime::DetachCurrentThread() { void Runtime::VisitConcurrentRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool clean_dirty) { - if (!only_dirty || intern_table_->IsDirty()) { - intern_table_->VisitRoots(visitor, arg, clean_dirty); - } - if (!only_dirty || class_linker_->IsDirty()) { - class_linker_->VisitRoots(visitor, arg, clean_dirty); - } + intern_table_->VisitRoots(visitor, arg, only_dirty, clean_dirty); + class_linker_->VisitRoots(visitor, arg, only_dirty, clean_dirty); } void Runtime::VisitNonThreadRoots(RootVisitor* visitor, void* arg) { |