Do not verify dex files for --compiler-filter=assume-verified.
Reduces the compilation time for the boot image extension
with said filter by over 0.5s (comparing the best observed
timing "before" to the worst observed timing "after").
Test: aosp_taimen-userdebug boots;
adb root && \
adb shell stop && \
adb shell setprop dalvik.vm.boot-image \
'boot.art:/nonx/boot-framework.art!/system/etc/boot-image.prof' && \
adb shell 'setprop dalvik.vm.extra-opts \
"-Ximage-compiler-option --compiler-filter=assume-verified"' && \
adb shell start # Starts correctly
# Check dex2oat timing in logcat
Bug: 119800099
Change-Id: I3fc82c9485385ff5e0ccc5031e1141a685ee6c19
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index c05ff89..747205e 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -103,6 +103,10 @@
return CompilerFilter::IsVerificationEnabled(compiler_filter_);
}
+ bool AssumeDexFilesAreVerified() const {
+ return compiler_filter_ == CompilerFilter::kAssumeVerified;
+ }
+
bool AssumeClassesAreVerified() const {
return compiler_filter_ == CompilerFilter::kAssumeVerified;
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 1338bcf..0fcc6cc 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -1608,7 +1608,8 @@
std::vector<std::unique_ptr<const DexFile>> opened_dex_files;
// No need to verify the dex file when we have a vdex file, which means it was already
// verified.
- const bool verify = (input_vdex_file_ == nullptr);
+ const bool verify =
+ (input_vdex_file_ == nullptr) && !compiler_options_->AssumeDexFilesAreVerified();
if (!oat_writers_[i]->WriteAndOpenDexFiles(
vdex_files_[i].get(),
verify,