Fix updating string dex cache array for no class table case
The issue was that array classes do not have a dex cache. Also removed
some unnecessary mutables.
Bug: 22858531
Change-Id: I2bc45f019e064b6e562c8f158cc2ac8c0e513afd
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index d63fed5..73574ba 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -859,7 +859,7 @@
return true;
}
- mutable std::unordered_set<mirror::Class*> classes_to_prune_;
+ std::unordered_set<mirror::Class*> classes_to_prune_;
ImageWriter* const image_writer_;
};
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 777786c..c80f91a 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1290,8 +1290,11 @@
// the app image.
klass->SetClassLoader(class_loader.Get());
// The resolved type could be from another dex cache, go through the dex cache just in
- // case.
- klass->SetDexCacheStrings(klass->GetDexCache()->GetStrings());
+ // case. May be null for array classes.
+ if (klass->GetDexCacheStrings() != nullptr) {
+ DCHECK(!klass->IsArrayClass());
+ klass->SetDexCacheStrings(klass->GetDexCache()->GetStrings());
+ }
// If there are multiple dex caches, there may be the same class multiple times
// in different dex caches. Check for this since inserting will add duplicates
// otherwise.
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index b711181..fa5c41d 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -243,7 +243,7 @@
classes_.push_back(klass);
return true;
}
- mutable std::vector<mirror::Class*> classes_;
+ std::vector<mirror::Class*> classes_;
};
if (generate_debug_info_) {