Concurrent class linker and intern table root marking
We now mark the class linker and intern table roots concurrently
(with mutators unpaused), only re-marking these roots in the second pause if
they get dirtied.
Reduces root marking time by ~1ms for each pause.
Change-Id: I833fc557bac9a2930868db715587318293fa4655
diff --git a/src/intern_table.cc b/src/intern_table.cc
index 5ad3958..817ce1e 100644
--- a/src/intern_table.cc
+++ b/src/intern_table.cc
@@ -21,7 +21,7 @@
namespace art {
-InternTable::InternTable() : intern_table_lock_("InternTable lock") {
+InternTable::InternTable() : intern_table_lock_("InternTable lock"), is_dirty_(false) {
}
size_t InternTable::Size() const {
@@ -36,12 +36,13 @@
<< image_strong_interns_.size() << " image strong\n";
}
-void InternTable::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
+void InternTable::VisitRoots(Heap::RootVisitor* visitor, void* arg) {
MutexLock mu(Thread::Current(), intern_table_lock_);
typedef Table::const_iterator It; // TODO: C++0x auto
for (It it = strong_interns_.begin(), end = strong_interns_.end(); it != end; ++it) {
visitor(it->second, arg);
}
+ is_dirty_ = false;
// Note: we deliberately don't visit the weak_interns_ table and the immutable image roots.
}
@@ -97,6 +98,9 @@
return image;
}
+ // Mark as dirty so that we rescan the roots.
+ Dirty();
+
// There is no match in the strong table, check the weak table.
String* weak = Lookup(weak_interns_, s, hash_code);
if (weak != NULL) {