diff options
-rw-r--r-- | compiler/driver/compiler_options.h | 19 | ||||
-rw-r--r-- | dex2oat/dex2oat.cc | 15 | ||||
-rw-r--r-- | dex2oat/driver/compiler_driver.cc | 2 |
3 files changed, 19 insertions, 17 deletions
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index e24da593a7..a43390af72 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -70,11 +70,11 @@ class CompilerOptions final { static constexpr size_t kUnsetInlineMaxCodeUnits = -1; enum class ImageType : uint8_t { - kNone, // JIT or AOT app compilation producing only an oat file but no image. - kBootImage, // Creating boot image. - kBootImageExtension, // Creating boot image extension. - kAppImage, // Creating app image. - kApexBootImage, // Creating the apex image for jit/zygote experiment b/119800099. + kNone, // JIT or AOT app compilation producing only an oat file but no image. + kBootImage, // Creating boot image. + kBootImageExtension, // Creating boot image extension. + kAppImage, // Creating app image. + kApexBootImageExtension, // Creating JIT-zygote boot image extension (b/119800099). }; CompilerOptions(); @@ -194,16 +194,17 @@ class CompilerOptions final { // Are we compiling a boot image? bool IsBootImage() const { - return image_type_ == ImageType::kBootImage || image_type_ == ImageType::kApexBootImage; + return image_type_ == ImageType::kBootImage; } - bool IsApexBootImage() const { - return image_type_ == ImageType::kApexBootImage; + bool IsApexBootImageExtension() const { + return image_type_ == ImageType::kApexBootImageExtension; } // Are we compiling a boot image extension? bool IsBootImageExtension() const { - return image_type_ == ImageType::kBootImageExtension; + return image_type_ == ImageType::kBootImageExtension + || image_type_ == ImageType::kApexBootImageExtension; } bool IsBaseline() const { diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index d582cec6a4..d983d94f31 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -828,13 +828,14 @@ class Dex2Oat final { DCHECK(compiler_options_->image_type_ == CompilerOptions::ImageType::kNone); if (!image_filenames_.empty() || image_fd_ != -1) { - if (!boot_image_filename_.empty()) { - compiler_options_->image_type_ = CompilerOptions::ImageType::kBootImageExtension; - } else if (android::base::EndsWith(image_filenames_[0], "apex.art")) { - compiler_options_->image_type_ = CompilerOptions::ImageType::kApexBootImage; - } else { - compiler_options_->image_type_ = CompilerOptions::ImageType::kBootImage; - } + // If no boot image is provided, then dex2oat is compiling the primary boot image, + // otherwise it is compiling the boot image extension. In the case of JIT-zygote + // extension the primary boot image has a special name "apex.art". + compiler_options_->image_type_ = boot_image_filename_.empty() + ? CompilerOptions::ImageType::kBootImage + : android::base::EndsWith(boot_image_filename_, "apex.art") + ? CompilerOptions::ImageType::kApexBootImageExtension + : CompilerOptions::ImageType::kBootImageExtension; } if (app_image_fd_ != -1 || !app_image_file_name_.empty()) { if (compiler_options_->IsBootImage() || compiler_options_->IsBootImageExtension()) { diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc index ae73f49508..94391eb957 100644 --- a/dex2oat/driver/compiler_driver.cc +++ b/dex2oat/driver/compiler_driver.cc @@ -936,7 +936,7 @@ bool CompilerDriver::ShouldCompileBasedOnProfile(const MethodReference& method_r // If compiling the apex image, filter out methods not in an apex file (the profile used // for boot classpath is the same between the apex image and the boot image, so it includes /// framewkro methods). - if (compiler_options_->IsApexBootImage() && + if (compiler_options_->IsApexBootImageExtension() && !android::base::StartsWith(method_ref.dex_file->GetLocation(), "/apex")) { return false; } |