OSDN Git Service

Fix updating string dex cache array for no class table case
authorMathieu Chartier <mathieuc@google.com>
Tue, 2 Feb 2016 18:09:58 +0000 (10:09 -0800)
committerMathieu Chartier <mathieuc@google.com>
Wed, 3 Feb 2016 00:17:29 +0000 (16:17 -0800)
The issue was that array classes do not have a dex cache. Also removed
some unnecessary mutables.

Bug: 22858531
Change-Id: I2bc45f019e064b6e562c8f158cc2ac8c0e513afd

compiler/image_writer.cc
runtime/class_linker.cc
runtime/jit/jit.cc

index d63fed5..73574ba 100644 (file)
@@ -859,7 +859,7 @@ class NonImageClassesVisitor : public ClassVisitor {
     return true;
   }
 
-  mutable std::unordered_set<mirror::Class*> classes_to_prune_;
+  std::unordered_set<mirror::Class*> classes_to_prune_;
   ImageWriter* const image_writer_;
 };
 
index 777786c..c80f91a 100644 (file)
@@ -1290,8 +1290,11 @@ bool ClassLinker::UpdateAppImageClassLoadersAndDexCaches(
           // 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.
index b711181..fa5c41d 100644 (file)
@@ -243,7 +243,7 @@ void Jit::DumpTypeInfoForLoadedTypes(ClassLinker* linker) {
       classes_.push_back(klass);
       return true;
     }
-    mutable std::vector<mirror::Class*> classes_;
+    std::vector<mirror::Class*> classes_;
   };
 
   if (generate_debug_info_) {