summaryrefslogtreecommitdiffstats
path: root/runtime/intern_table.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-09-16 19:43:47 -0700
committerMathieu Chartier <mathieuc@google.com>2013-09-17 10:03:00 -0700
commitc4621985bdfc2b27494087e5dee65a6d0cc5a632 (patch)
treed8165f5b8d337e73942ee29d66fb40585dc7caf1 /runtime/intern_table.h
parent5666afd6854b5634ae741dc8a3a633fc47d52168 (diff)
downloadart-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/intern_table.h')
-rw-r--r--runtime/intern_table.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/runtime/intern_table.h b/runtime/intern_table.h
index a804d1f..07615dc 100644
--- a/runtime/intern_table.h
+++ b/runtime/intern_table.h
@@ -62,15 +62,10 @@ class InternTable {
size_t Size() const;
- void VisitRoots(RootVisitor* visitor, void* arg, bool clean_dirty);
+ void VisitRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool clean_dirty);
void DumpForSigQuit(std::ostream& os) const;
- bool IsDirty() const { return is_dirty_; }
- void Dirty() {
- is_dirty_ = true;
- }
-
private:
typedef std::multimap<int32_t, mirror::String*> Table;
@@ -83,7 +78,7 @@ class InternTable {
void Remove(Table& table, const mirror::String* s, uint32_t hash_code);
mutable Mutex intern_table_lock_;
- bool is_dirty_;
+ bool is_dirty_ GUARDED_BY(intern_table_lock_);
Table strong_interns_ GUARDED_BY(intern_table_lock_);
Table weak_interns_ GUARDED_BY(intern_table_lock_);
};