summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2016-01-07 16:29:01 -0800
committer Mathieu Chartier <mathieuc@google.com> 2016-01-07 18:33:06 -0800
commit1f47b678db70d57aa5194266651a8f4336fc851e (patch)
treea87144657ae8d824f80465019a094fef8ac35c4c /runtime/class_linker.cc
parentb7332f1c774c675b5264a45890e72bf140664018 (diff)
Re-enable class table for image writer
Changes, create one temporary class table per ImageInfo. Don't keep track of class loaders. Bug: 26317072 Change-Id: I4f9121194f39031fb8629d60b6feeb2747a77870
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index d995f28c90..67458cc964 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1113,6 +1113,7 @@ bool ClassLinker::InitFromImage(std::string* error_msg) {
mirror::Throwable::SetClass(GetClassRoot(kJavaLangThrowable));
mirror::StackTraceElement::SetClass(GetClassRoot(kJavaLangStackTraceElement));
+ size_t class_tables_added = 0;
for (gc::space::ImageSpace* space : spaces) {
const ImageHeader& header = space->GetImageHeader();
const ImageSection& section = header.GetImageSection(ImageHeader::kSectionClassTable);
@@ -1120,9 +1121,17 @@ bool ClassLinker::InitFromImage(std::string* error_msg) {
WriterMutexLock mu(self, *Locks::classlinker_classes_lock_);
ClassTable* const class_table = InsertClassTableForClassLoader(nullptr);
class_table->ReadFromMemory(space->Begin() + section.Offset());
- dex_cache_boot_image_class_lookup_required_ = false;
+ ++class_tables_added;
}
}
+ if (class_tables_added != 0) {
+ // Either all of the image spaces have an empty class section or none do. In the case where
+ // an image space has no classes, it will still have a non-empty class section that contains
+ // metadata.
+ CHECK_EQ(spaces.size(), class_tables_added)
+ << "Expected non-empty class section for each image space.";
+ dex_cache_boot_image_class_lookup_required_ = false;
+ }
FinishInit(self);