summaryrefslogtreecommitdiff
path: root/compiler/image_writer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r--compiler/image_writer.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index be720ad2f3..da10568475 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -437,6 +437,9 @@ void ImageWriter::PrepareDexCacheArraySlots() {
continue;
}
const DexFile* dex_file = dex_cache->GetDexFile();
+ CHECK(dex_file_oat_index_map_.find(dex_file) != dex_file_oat_index_map_.end())
+ << "Dex cache should have been pruned " << dex_file->GetLocation()
+ << "; possibly in class path";
DexCacheArraysLayout layout(target_ptr_size_, dex_file);
DCHECK(layout.Valid());
size_t oat_index = GetOatIndexForDexCache(dex_cache);
@@ -839,6 +842,10 @@ void ImageWriter::PruneNonImageClasses() {
ClassLinker* class_linker = runtime->GetClassLinker();
Thread* self = Thread::Current();
+ // Clear class table strong roots so that dex caches can get pruned. We require pruning the class
+ // path dex caches.
+ class_linker->ClearClassTableStrongRoots();
+
// Make a list of classes we would like to prune.
NonImageClassesVisitor visitor(this);
class_linker->VisitClasses(&visitor);