diff options
Diffstat (limited to 'compiler/image_writer.h')
| -rw-r--r-- | compiler/image_writer.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/compiler/image_writer.h b/compiler/image_writer.h index bdc7146632..39113c8143 100644 --- a/compiler/image_writer.h +++ b/compiler/image_writer.h @@ -38,8 +38,9 @@ #include "image.h" #include "lock_word.h" #include "mem_map.h" -#include "oat_file.h" #include "mirror/dex_cache.h" +#include "obj_ptr.h" +#include "oat_file.h" #include "os.h" #include "safe_map.h" #include "utils.h" @@ -317,6 +318,12 @@ class ImageWriter FINAL { // Number of image class table bytes. size_t class_table_bytes_ = 0; + // Number of object fixup bytes. + size_t object_fixup_bytes_ = 0; + + // Number of pointer fixup bytes. + size_t pointer_fixup_bytes_ = 0; + // Intern table associated with this image for serialization. std::unique_ptr<InternTable> intern_table_; @@ -376,7 +383,7 @@ class ImageWriter FINAL { } // Returns true if the class was in the original requested image classes list. - bool KeepClass(mirror::Class* klass) REQUIRES_SHARED(Locks::mutator_lock_); + bool KeepClass(ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); // Debug aid that list of requested image classes. void DumpImageClasses(); @@ -391,6 +398,12 @@ class ImageWriter FINAL { // Remove unwanted classes from various roots. void PruneNonImageClasses() REQUIRES_SHARED(Locks::mutator_lock_); + // Remove unwanted classes from the DexCache roots and preload deterministic DexCache contents. + void PruneAndPreloadDexCache(ObjPtr<mirror::DexCache> dex_cache, + ObjPtr<mirror::ClassLoader> class_loader) + REQUIRES_SHARED(Locks::mutator_lock_) + REQUIRES(!Locks::classlinker_classes_lock_); + // Verify unwanted classes removed. void CheckNonImageClassesRemoved() REQUIRES_SHARED(Locks::mutator_lock_); static void CheckNonImageClassesRemovedCallback(mirror::Object* obj, void* arg) @@ -458,7 +471,8 @@ class ImageWriter FINAL { size_t oat_index) REQUIRES_SHARED(Locks::mutator_lock_); - void TryAssignImTableOffset(ImTable* imt, size_t oat_index) REQUIRES_SHARED(Locks::mutator_lock_); + // Return true if imt was newly inserted. + bool TryAssignImTableOffset(ImTable* imt, size_t oat_index) REQUIRES_SHARED(Locks::mutator_lock_); // Assign the offset for an IMT conflict table. Does nothing if the table already has a native // relocation. @@ -473,11 +487,11 @@ class ImageWriter FINAL { // we also cannot have any classes which refer to these boot class loader non image classes. // PruneAppImageClass also prunes if klass depends on a non-image class according to the compiler // driver. - bool PruneAppImageClass(mirror::Class* klass) + bool PruneAppImageClass(ObjPtr<mirror::Class> klass) REQUIRES_SHARED(Locks::mutator_lock_); // early_exit is true if we had a cyclic dependency anywhere down the chain. - bool PruneAppImageClassInternal(mirror::Class* klass, + bool PruneAppImageClassInternal(ObjPtr<mirror::Class> klass, bool* early_exit, std::unordered_set<mirror::Class*>* visited) REQUIRES_SHARED(Locks::mutator_lock_); @@ -528,6 +542,14 @@ class ImageWriter FINAL { // Return true if there already exists a native allocation for an object. bool NativeRelocationAssigned(void* ptr) const; + void CopyReference(mirror::HeapReference<mirror::Object>* dest, ObjPtr<mirror::Object> src) + REQUIRES_SHARED(Locks::mutator_lock_); + + void CopyReference(mirror::CompressedReference<mirror::Object>* dest, ObjPtr<mirror::Object> src) + REQUIRES_SHARED(Locks::mutator_lock_); + + void CopyAndFixupPointer(void** target, void* value); + const CompilerDriver& compiler_driver_; // Beginning target image address for the first image. @@ -602,9 +624,11 @@ class ImageWriter FINAL { class FixupRootVisitor; class FixupVisitor; class GetRootsVisitor; + class ImageAddressVisitorForDexCacheArray; class NativeLocationVisitor; class PruneClassesVisitor; class PruneClassLoaderClassesVisitor; + class RegisterBootClassPathClassesVisitor; class VisitReferencesVisitor; DISALLOW_COPY_AND_ASSIGN(ImageWriter); |