Revert "Revert "Change dex caches to be weak roots""
This reverts commit 81a9087f0df0518c39405b7d18ba5858a6d8b77b.
Boot.oat creation time goes from 4.7s to 4.9s on host due to extra
locking. Will try to improve this in another CL.
Bug: 23602225
Bug: 22720414
Change-Id: I7e25b75cfb63faa196c7b0f60e46cce50bf12021
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 4393430..4ab5c0e 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -638,9 +638,11 @@
const std::map<const DexFile*, DexIndexBitSet*>& seen_methods,
std::set<ArtMethod*>* visited_methods) SHARED_REQUIRES(Locks::mutator_lock_) {
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
+ Thread* const self = Thread::Current();
for (auto& e : seen_methods) {
DexIndexBitSet* bit_set = e.second;
- mirror::DexCache* dex_cache = class_linker->FindDexCache(*e.first);
+ // TODO: Visit trace methods as roots.
+ mirror::DexCache* dex_cache = class_linker->FindDexCache(self, *e.first, false);
for (uint32_t i = 0; i < bit_set->size(); ++i) {
if ((*bit_set)[i]) {
visited_methods->insert(dex_cache->GetResolvedMethod(i, sizeof(void*)));