}
} 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);
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.
// 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;