diff options
Diffstat (limited to 'patchoat/patchoat.h')
-rw-r--r-- | patchoat/patchoat.h | 52 |
1 files changed, 5 insertions, 47 deletions
diff --git a/patchoat/patchoat.h b/patchoat/patchoat.h index a51963127a..e15a6bc695 100644 --- a/patchoat/patchoat.h +++ b/patchoat/patchoat.h @@ -44,17 +44,7 @@ class Class; class PatchOat { public: - // Patch only the oat file - static bool Patch(File* oat_in, off_t delta, File* oat_out, TimingLogger* timings, - bool output_oat_opened_from_fd, // Was this using --oatput-oat-fd ? - bool new_oat_out); // Output oat was a new file created by us? - - // Patch only the image (art file) - static bool Patch(const std::string& art_location, off_t delta, File* art_out, InstructionSet isa, - TimingLogger* timings); - - // Patch both the image and the oat file - static bool Patch(const std::string& art_location, + static bool Patch(const std::string& image_location, off_t delta, const std::string& output_directory, InstructionSet isa, @@ -64,18 +54,11 @@ class PatchOat { PatchOat(PatchOat&&) = default; private: - // Takes ownership only of the ElfFile. All other pointers are only borrowed. - PatchOat(ElfFile* oat_file, off_t delta, TimingLogger* timings) - : oat_file_(oat_file), image_(nullptr), bitmap_(nullptr), heap_(nullptr), delta_(delta), - isa_(kNone), space_map_(nullptr), timings_(timings) {} - PatchOat(InstructionSet isa, MemMap* image, gc::accounting::ContinuousSpaceBitmap* bitmap, - MemMap* heap, off_t delta, TimingLogger* timings) - : image_(image), bitmap_(bitmap), heap_(heap), - delta_(delta), isa_(isa), space_map_(nullptr), timings_(timings) {} - PatchOat(InstructionSet isa, ElfFile* oat_file, MemMap* image, + // All pointers are only borrowed. + PatchOat(InstructionSet isa, MemMap* image, gc::accounting::ContinuousSpaceBitmap* bitmap, MemMap* heap, off_t delta, std::map<gc::space::ImageSpace*, std::unique_ptr<MemMap>>* map, TimingLogger* timings) - : oat_file_(oat_file), image_(image), bitmap_(bitmap), heap_(heap), + : image_(image), bitmap_(bitmap), heap_(heap), delta_(delta), isa_(isa), space_map_(map), timings_(timings) {} // Was the .art image at image_path made with --compile-pic ? @@ -94,9 +77,7 @@ class PatchOat { // Attempt to replace the file with a symlink // Returns false if it fails static bool ReplaceOatFileWithSymlink(const std::string& input_oat_filename, - const std::string& output_oat_filename, - bool output_oat_opened_from_fd, - bool new_oat_out); // Output oat was newly created? + const std::string& output_oat_filename); static void BitmapCallback(mirror::Object* obj, void* arg) REQUIRES_SHARED(Locks::mutator_lock_) { @@ -108,13 +89,6 @@ class PatchOat { void FixupMethod(ArtMethod* object, ArtMethod* copy) REQUIRES_SHARED(Locks::mutator_lock_); - // Patches oat in place, modifying the oat_file given to the constructor. - bool PatchElf(); - template <typename ElfFileImpl> - bool PatchElf(ElfFileImpl* oat_file); - template <typename ElfFileImpl> - bool PatchOatHeader(ElfFileImpl* oat_file); - bool PatchImage(bool primary_image) REQUIRES_SHARED(Locks::mutator_lock_); void PatchArtFields(const ImageHeader* image_header) REQUIRES_SHARED(Locks::mutator_lock_); void PatchArtMethods(const ImageHeader* image_header) REQUIRES_SHARED(Locks::mutator_lock_); @@ -128,7 +102,6 @@ class PatchOat { void PatchDexFileArrays(mirror::ObjectArray<mirror::Object>* img_roots) REQUIRES_SHARED(Locks::mutator_lock_); - bool WriteElf(File* out); bool WriteImage(File* out); template <typename T> @@ -175,19 +148,6 @@ class PatchOat { return reinterpret_cast<T*>(ret); } - template <typename T> - T RelocatedAddressOfIntPointer(T obj) const { - if (obj == 0) { - return obj; - } - T ret = obj + delta_; - // Trim off high bits in case negative relocation with 64 bit patchoat. - if (Is32BitISA()) { - ret = static_cast<T>(static_cast<uint32_t>(ret)); - } - return ret; - } - bool Is32BitISA() const { return InstructionSetPointerSize(isa_) == PointerSize::k32; } @@ -213,8 +173,6 @@ class PatchOat { mirror::Object* const copy_; }; - // The elf file we are patching. - std::unique_ptr<ElfFile> oat_file_; // A mmap of the image we are patching. This is modified. const MemMap* const image_; // The bitmap over the image within the heap we are patching. This is not modified. |