summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2015-10-19 19:54:44 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2015-10-19 19:54:44 +0000
commit28a15a922e172f96018ab2a1e94ea1cfeb9b7b95 (patch)
tree9f15ab6328ea212e74afe9c4285bcf2b140eca0e /runtime/class_linker.cc
parentf69f56e7d4a1e31dfce2a77558c9b7047f82092b (diff)
parent00310e0bb4ee541b99f0b687dbf5f706db2aabca (diff)
Merge "Keep dex files live in class table"
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 73fd0910e8..81622e14ed 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -6369,6 +6369,21 @@ void ClassLinker::VisitClassLoaders(ClassLoaderVisitor* visitor) const {
}
}
+void ClassLinker::InsertDexFileInToClassLoader(mirror::Object* dex_file,
+ mirror::ClassLoader* class_loader) {
+ DCHECK(dex_file != nullptr);
+ DCHECK(class_loader != nullptr);
+ Thread* const self = Thread::Current();
+ WriterMutexLock mu(self, *Locks::classlinker_classes_lock_);
+ ClassTable* const table = class_loader->GetClassTable();
+ DCHECK(table != nullptr);
+ if (table->InsertDexFile(dex_file)) {
+ // It was not already inserted, perform the write barrier to let the GC know the class loader's
+ // class table was modified.
+ Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(class_loader);
+ }
+}
+
void ClassLinker::CleanupClassLoaders() {
Thread* const self = Thread::Current();
WriterMutexLock mu(self, *Locks::classlinker_classes_lock_);