summaryrefslogtreecommitdiff
path: root/runtime/class_table.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2016-06-02 11:48:30 -0700
committer Mathieu Chartier <mathieuc@google.com> 2016-06-02 18:03:41 -0700
commitf284d448e3edd428b6ade473d0993028638b2064 (patch)
treee24f57f952f4e6c850ec910de3361aef6340727a /runtime/class_table.cc
parent3f432d5a7c184b7580bd5aba27158c1455c328ff (diff)
Hold dex caches live in class table
Prevents temporary dex caches being unloaded for the same dex file. Usually this is OK, but if someone resolved a string in that dex cache, it could leave stale pointers in BSS. Also it can use extra memory in linear alloc if we allocate dex cache arrays multiple times. Bug: 29083330 Change-Id: Ia44668f013ceef1f5eb80f653a48d0f8004548c9
Diffstat (limited to 'runtime/class_table.cc')
-rw-r--r--runtime/class_table.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/runtime/class_table.cc b/runtime/class_table.cc
index 8267c68b29..f5ebcc5191 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;
}