summaryrefslogtreecommitdiffstats
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-06-02 21:01:45 -0700
committerAndreas Gampe <agampe@google.com>2015-06-03 09:57:43 -0700
commit44905ce1c97613a5cb44046049843fe1029a64cf (patch)
tree4027fdfd08078ec399ae8fc91a87e6bc2ca056d8 /runtime/class_linker.cc
parentb1170ba5de3bf56021f33133bed537894e8fa8b9 (diff)
downloadandroid_art-44905ce1c97613a5cb44046049843fe1029a64cf.tar.gz
android_art-44905ce1c97613a5cb44046049843fe1029a64cf.tar.bz2
android_art-44905ce1c97613a5cb44046049843fe1029a64cf.zip
ART: Prune FindArrayClass cache in image writer
The ClassLinker cache speeds up FindArrayClass requests, but all entries are roots. It is possible that an entry is a non-image class when creating the boot image, artificially keeping the class around. Bug: 21596650 Change-Id: Ief9b439945d0e293a3cb5dcddfeb189b5e174f06
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 84d10008ea..79c5a0803c 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -277,9 +277,9 @@ ClassLinker::ClassLinker(InternTable* intern_table)
quick_to_interpreter_bridge_trampoline_(nullptr),
image_pointer_size_(sizeof(void*)) {
CHECK(intern_table_ != nullptr);
- for (auto& root : find_array_class_cache_) {
- root = GcRoot<mirror::Class>(nullptr);
- }
+ static_assert(kFindArrayCacheSize == arraysize(find_array_class_cache_),
+ "Array cache size wrong.");
+ std::fill_n(find_array_class_cache_, kFindArrayCacheSize, GcRoot<mirror::Class>(nullptr));
}
void ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> boot_class_path) {
@@ -5877,4 +5877,9 @@ ArtMethod* ClassLinker::CreateRuntimeMethod() {
return method;
}
+void ClassLinker::DropFindArrayClassCache() {
+ std::fill_n(find_array_class_cache_, kFindArrayCacheSize, GcRoot<mirror::Class>(nullptr));
+ find_array_class_cache_next_victim_ = 0;
+}
+
} // namespace art