diff options
author | 2016-02-16 12:50:23 +0000 | |
---|---|---|
committer | 2016-02-17 16:38:46 +0000 | |
commit | 6065402316da2b51eed5fc34cffbd991766bd408 (patch) | |
tree | cb93e32b978ea03a70baf980c470a03263c084c0 /compiler/image_writer.cc | |
parent | 442643920a6c539e98aad76594e99b932b5631ba (diff) |
Allow method references across oat files for multi-image.
These were disabled because we didn't have sufficient
information about the multi-image layout when processing
link-time patches in OatWriter. This CL refactors the
ELF file creation so that the information is available.
Change-Id: I6f2e8dc8572d143c72cc2693bb0ba4fd76f889ab
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r-- | compiler/image_writer.cc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 73574ba673..09046c7a3a 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -2274,25 +2274,18 @@ const ImageWriter::ImageInfo& ImageWriter::GetImageInfo(size_t index) const { return GetConstImageInfo(oat_filenames_[index]); } -void ImageWriter::UpdateOatFile(File* oat_file, const char* oat_filename) { - DCHECK(oat_file != nullptr); +void ImageWriter::UpdateOatFile(size_t index, size_t oat_loaded_size) { if (compile_app_image_) { CHECK_EQ(oat_filenames_.size(), 1u) << "App image should have no next image."; return; } - ImageInfo& cur_image_info = GetImageInfo(oat_filename); // Update the oat_offset of the next image info. - auto it = std::find(oat_filenames_.begin(), oat_filenames_.end(), oat_filename); - DCHECK(it != oat_filenames_.end()); - - it++; - if (it != oat_filenames_.end()) { - size_t oat_loaded_size = 0; - size_t oat_data_offset = 0; - ElfWriter::GetOatElfInformation(oat_file, &oat_loaded_size, &oat_data_offset); + DCHECK_LT(index, oat_filenames_.size()); + if (index + 1u != oat_filenames_.size()) { // There is a following one. - ImageInfo& next_image_info = GetImageInfo(*it); + ImageInfo& cur_image_info = GetImageInfo(oat_filenames_[index]); + ImageInfo& next_image_info = GetImageInfo(oat_filenames_[index + 1u]); next_image_info.oat_offset_ = cur_image_info.oat_offset_ + oat_loaded_size; } } |