diff options
author | 2016-02-17 17:46:30 +0000 | |
---|---|---|
committer | 2016-02-17 17:46:31 +0000 | |
commit | f0b04803ec4cdd8d76aadb6f02ae2511c46b20b5 (patch) | |
tree | 90390c57c73168102a2c1aaa3c6d828115e33b17 /compiler/image_writer.cc | |
parent | 9ee1f0c6a67729cabcf3697fc68fe4e98da55f64 (diff) | |
parent | 45724f9a0cc38dbb3071beb3eeab96499868b49c (diff) |
Merge "Revert "Allow method references across oat files for multi-image.""
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r-- | compiler/image_writer.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 09046c7a3a..73574ba673 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -2274,18 +2274,25 @@ const ImageWriter::ImageInfo& ImageWriter::GetImageInfo(size_t index) const { return GetConstImageInfo(oat_filenames_[index]); } -void ImageWriter::UpdateOatFile(size_t index, size_t oat_loaded_size) { +void ImageWriter::UpdateOatFile(File* oat_file, const char* oat_filename) { + DCHECK(oat_file != nullptr); 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. - DCHECK_LT(index, oat_filenames_.size()); - if (index + 1u != oat_filenames_.size()) { + 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); // There is a following one. - ImageInfo& cur_image_info = GetImageInfo(oat_filenames_[index]); - ImageInfo& next_image_info = GetImageInfo(oat_filenames_[index + 1u]); + ImageInfo& next_image_info = GetImageInfo(*it); next_image_info.oat_offset_ = cur_image_info.oat_offset_ + oat_loaded_size; } } |