summaryrefslogtreecommitdiffstats
path: root/compiler/image_writer.cc
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2016-01-28 20:33:36 -0800
committerMathieu Chartier <mathieuc@google.com>2016-01-29 16:09:23 -0800
commit14567fd24894a56070f891b1b8810cdcf51d0254 (patch)
treee92b819c0d07b798fb22c954f8088322473e1b4e /compiler/image_writer.cc
parent472964bcebeeb42e7428aca93c2d8d6295e865ee (diff)
downloadandroid_art-14567fd24894a56070f891b1b8810cdcf51d0254.tar.gz
android_art-14567fd24894a56070f891b1b8810cdcf51d0254.tar.bz2
android_art-14567fd24894a56070f891b1b8810cdcf51d0254.zip
Clean up UpdateOatFile for app images
Check that for the there is only one oat file name for the app image case. Avoid calling GetOatElfInformation unless necessary. Bug: 22858531 Change-Id: I88d258a1cc2823956ecc4fca9a6f7b2d3c4b986e
Diffstat (limited to 'compiler/image_writer.cc')
-rw-r--r--compiler/image_writer.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 8b7fbf6910..60dfcfb508 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -2276,10 +2276,10 @@ const ImageWriter::ImageInfo& ImageWriter::GetImageInfo(size_t index) const {
void ImageWriter::UpdateOatFile(File* oat_file, const char* oat_filename) {
DCHECK(oat_file != nullptr);
- size_t oat_loaded_size = 0;
- size_t oat_data_offset = 0;
- ElfWriter::GetOatElfInformation(oat_file, &oat_loaded_size, &oat_data_offset);
-
+ 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.
@@ -2288,6 +2288,9 @@ void ImageWriter::UpdateOatFile(File* oat_file, const char* oat_filename) {
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& next_image_info = GetImageInfo(*it);
next_image_info.oat_offset_ = cur_image_info.oat_offset_ + oat_loaded_size;