OSDN Git Service

Revert "Reduce dirty image pages by improving binning"
authorMathieu Chartier <mathieuc@google.com>
Sat, 9 Apr 2016 01:54:36 +0000 (18:54 -0700)
committerMathieu Chartier <mathieuc@google.com>
Sat, 9 Apr 2016 01:54:36 +0000 (18:54 -0700)
This reverts commit 794bff5f622c79fd7bd9899e700cf052a375c675.

compiler/image_writer.cc
compiler/image_writer.h
imgdiag/imgdiag.cc

index 8bb462c..c747ffa 100644 (file)
@@ -576,16 +576,7 @@ void ImageWriter::AssignImageBinSlot(mirror::Object* object) {
       }
     } else if (object->GetClass<kVerifyNone>()->IsStringClass()) {
       bin = kBinString;  // Strings are almost always immutable (except for object header).
-    } else if (object->GetClass<kVerifyNone>() ==
-        Runtime::Current()->GetClassLinker()->GetClassRoot(ClassLinker::kJavaLangObject)) {
-      // Instance of java lang object, probably a lock object. This means it will be dirty when we
-      // synchronize on it.
-      bin = kBinMiscDirty;
-    } else if (object->IsDexCache()) {
-      // Dex file field becomes dirty when the image is loaded.
-      bin = kBinMiscDirty;
-    }
-    // else bin = kBinRegular
+    }  // else bin = kBinRegular
   }
 
   size_t oat_index = GetOatIndex(object);
index 0cb6aea..f204b28 100644 (file)
@@ -149,17 +149,16 @@ class ImageWriter FINAL {
   void RecordImageAllocations() SHARED_REQUIRES(Locks::mutator_lock_);
 
   // Classify different kinds of bins that objects end up getting packed into during image writing.
-  // Ordered from dirtiest to cleanest (until ArtMethods).
   enum Bin {
-    kBinMiscDirty,                // Dex caches, object locks, etc...
-    kBinClassVerified,            // Class verified, but initializers haven't been run
+    // Likely-clean:
+    kBinString,                        // [String] Almost always immutable (except for obj header).
     // Unknown mix of clean/dirty:
     kBinRegular,
-    kBinClassInitialized,         // Class initializers have been run
+    // Likely-dirty:
     // All classes get their own bins since their fields often dirty
     kBinClassInitializedFinalStatics,  // Class initializers have been run, no non-final statics
-    // Likely-clean:
-    kBinString,                        // [String] Almost always immutable (except for obj header).
+    kBinClassInitialized,         // Class initializers have been run
+    kBinClassVerified,            // Class verified, but initializers haven't been run
     // Add more bins here if we add more segregation code.
     // Non mirror fields must be below.
     // ArtFields should be always clean.
index 92232ba..5c0eb3f 100644 (file)
@@ -405,8 +405,7 @@ class ImgDiagDumper {
     // Look up local classes by their descriptor
     std::map<std::string, mirror::Class*> local_class_map;
 
-    // Use set to have sorted output.
-    std::set<mirror::Object*> dirty_objects;
+    std::unordered_set<mirror::Object*> dirty_objects;
 
     size_t dirty_object_bytes = 0;
     const uint8_t* begin_image_ptr = image_begin_unaligned;