In boot image experiment mode, treat boot classpath classes as verified.
Bug: 119800099
Test: m && boot
Change-Id: Ib7fbdf46c1fd65a79f07c5331eae4a54d526ce5b
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 65fe4e4..89c6a0b 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -4635,6 +4635,20 @@
const OatDexFile* oat_dex_file = dex_file.GetOatDexFile();
// In case we run without an image there won't be a backing oat file.
if (oat_dex_file == nullptr || oat_dex_file->GetOatFile() == nullptr) {
+ if (!kIsDebugBuild && klass->GetClassLoader() == nullptr) {
+ // For boot classpath classes in the case we're not using a default boot image:
+ // we don't have the infrastructure yet to query verification data on individual
+ // boot vdex files, so it's simpler for now to consider all boot classpath classes
+ // verified. This should be taken into account when measuring boot time and app
+ // startup compare to the (current) production system where both:
+ // 1) updatable boot classpath classes, and
+ // 2) classes in /system referencing updatable classes
+ // will be verified at runtime.
+ if (!Runtime::Current()->IsUsingDefaultBootImageLocation()) {
+ oat_file_class_status = ClassStatus::kVerified;
+ return true;
+ }
+ }
return false;
}
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 7ecfdc7..152347f 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1131,6 +1131,12 @@
runtime_options.GetOrDefault(Opt::StackDumpLockProfThreshold));
image_location_ = runtime_options.GetOrDefault(Opt::Image);
+ {
+ std::string error_msg;
+ is_using_default_boot_image_location_ =
+ (image_location_.compare(GetDefaultBootImageLocation(&error_msg)) == 0);
+ }
+
SetInstructionSet(runtime_options.GetOrDefault(Opt::ImageInstructionSet));
boot_class_path_ = runtime_options.ReleaseOrDefault(Opt::BootClassPath);
boot_class_path_locations_ = runtime_options.ReleaseOrDefault(Opt::BootClassPathLocations);
diff --git a/runtime/runtime.h b/runtime/runtime.h
index f550b84..ace0eea 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -186,8 +186,7 @@
}
bool IsUsingDefaultBootImageLocation() const {
- std::string error_msg;
- return GetImageLocation().compare(GetDefaultBootImageLocation(&error_msg)) == 0;
+ return is_using_default_boot_image_location_;
}
// Starts a runtime, which may cause threads to be started and code to run.
@@ -915,6 +914,7 @@
std::vector<std::string> compiler_options_;
std::vector<std::string> image_compiler_options_;
std::string image_location_;
+ bool is_using_default_boot_image_location_;
std::vector<std::string> boot_class_path_;
std::vector<std::string> boot_class_path_locations_;