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;
}