summaryrefslogtreecommitdiff
path: root/src/class_linker.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2012-10-15 17:38:16 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2012-10-16 10:05:04 -0700
commit9ebae1f30b84dfd8dab4144f80eebec4f8fc8851 (patch)
tree379f7606cf7c1b5bbeb41caccc4cb681fc1ef2b4 /src/class_linker.cc
parent30de32dec8dba21f7fec117b779c2b4e6bb4e4e6 (diff)
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
Diffstat (limited to 'src/class_linker.cc')
-rw-r--r--src/class_linker.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 83661cbafc..090378173f 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -222,6 +222,7 @@ ClassLinker::ClassLinker(InternTable* intern_table)
class_roots_(NULL),
array_iftable_(NULL),
init_done_(false),
+ is_dirty_(false),
intern_table_(intern_table) {
CHECK_EQ(arraysize(class_roots_descriptors_), size_t(kClassRootsMax));
}
@@ -1043,7 +1044,7 @@ void ClassLinker::InitFromImageCallback(Object* obj, void* arg) {
// Keep in sync with InitCallback. Anything we visit, we need to
// reinit references to when reinitializing a ClassLinker from a
// mapped image.
-void ClassLinker::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
+void ClassLinker::VisitRoots(Heap::RootVisitor* visitor, void* arg) {
visitor(class_roots_, arg);
Thread* self = Thread::Current();
{
@@ -1065,6 +1066,7 @@ void ClassLinker::VisitRoots(Heap::RootVisitor* visitor, void* arg) const {
}
visitor(array_iftable_, arg);
+ is_dirty_ = false;
}
void ClassLinker::VisitClasses(ClassVisitor* visitor, void* arg) const {
@@ -1746,6 +1748,7 @@ void ClassLinker::RegisterDexFileLocked(const DexFile& dex_file, SirtRef<DexCach
CHECK(dex_cache->GetLocation()->Equals(dex_file.GetLocation()));
dex_caches_.push_back(dex_cache.get());
dex_cache->SetDexFile(&dex_file);
+ Dirty();
}
void ClassLinker::RegisterDexFile(const DexFile& dex_file) {
@@ -1990,6 +1993,7 @@ Class* ClassLinker::InsertClass(const StringPiece& descriptor, Class* klass, boo
return existing;
}
classes.insert(std::make_pair(hash, klass));
+ Dirty();
return NULL;
}