summaryrefslogtreecommitdiff
path: root/runtime/class_table.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2016-06-03 17:47:32 -0700
committer Mathieu Chartier <mathieuc@google.com> 2016-06-06 11:26:32 -0700
commitc9dbb1df3b5c06ba122cacaf35b17cb53c6be3c6 (patch)
treed9b8f3c81c0abc7ce6839d0723271ee9740a267c /runtime/class_table.cc
parentf102faf1bcbdb2149e3e7bf27b1819f621b7894b (diff)
Revert "Revert "Hold dex caches live in class table""
Bug: 29083330 This reverts commit f102faf1bcbdb2149e3e7bf27b1819f621b7894b. Change-Id: Ibc6d260247b3113beec7d33552061512a36c9ce8
Diffstat (limited to 'runtime/class_table.cc')
-rw-r--r--runtime/class_table.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/runtime/class_table.cc b/runtime/class_table.cc
index 8267c68b29..e9154cb400 100644
--- a/runtime/class_table.cc
+++ b/runtime/class_table.cc
@@ -146,15 +146,15 @@ uint32_t ClassTable::ClassDescriptorHashEquals::operator()(const char* descripto
return ComputeModifiedUtf8Hash(descriptor);
}
-bool ClassTable::InsertDexFile(mirror::Object* dex_file) {
+bool ClassTable::InsertStrongRoot(mirror::Object* obj) {
WriterMutexLock mu(Thread::Current(), lock_);
- DCHECK(dex_file != nullptr);
- for (GcRoot<mirror::Object>& root : dex_files_) {
- if (root.Read() == dex_file) {
+ DCHECK(obj != nullptr);
+ for (GcRoot<mirror::Object>& root : strong_roots_) {
+ if (root.Read() == obj) {
return false;
}
}
- dex_files_.push_back(GcRoot<mirror::Object>(dex_file));
+ strong_roots_.push_back(GcRoot<mirror::Object>(obj));
return true;
}
@@ -189,4 +189,8 @@ void ClassTable::AddClassSet(ClassSet&& set) {
classes_.insert(classes_.begin(), std::move(set));
}
+void ClassTable::ClearStrongRoots() {
+ WriterMutexLock mu(Thread::Current(), lock_);
+ strong_roots_.clear();
+}
} // namespace art