Invert IsUsingDefaultBootImageLocation to IsUsingApexBootImageLocation.
Some tests are picking up the jit-zygote path, which is not intended.
Invert the flag so that if in doubt, we don't execute the experiment path.
(cherry picked from commit 3db3d37dcd3ca8e232a260ce71ac540f33fcf584)
Bug: 119800099
Test: boot device
Change-Id: I95fb99fc85e97cc5d403ac5c387e6369d896497f
Merged-In: Ief3ff353cc25fa81157a75d917814982f3836ed0
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index c07849a..8d522f4 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -4730,7 +4730,7 @@
// 1) updatable boot classpath classes, and
// 2) classes in /system referencing updatable classes
// will be verified at runtime.
- if (!Runtime::Current()->IsUsingDefaultBootImageLocation()) {
+ if (Runtime::Current()->IsUsingApexBootImageLocation()) {
oat_file_class_status = ClassStatus::kVerified;
return true;
}
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 3d96b5a..25c747e 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -641,7 +641,7 @@
// If we're not using the default boot image location, request a JIT task to
// compile all methods in the boot image profile.
Runtime* runtime = Runtime::Current();
- if (runtime->IsZygote() && !runtime->IsUsingDefaultBootImageLocation() && UseJitCompilation()) {
+ if (runtime->IsZygote() && runtime->IsUsingApexBootImageLocation() && UseJitCompilation()) {
thread_pool_->AddTask(Thread::Current(), new ZygoteTask());
}
}
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 3770921..7dd4572 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -546,7 +546,7 @@
}
const void* JitCodeCache::GetZygoteSavedEntryPoint(ArtMethod* method) {
- if (!Runtime::Current()->IsUsingDefaultBootImageLocation() &&
+ if (Runtime::Current()->IsUsingApexBootImageLocation() &&
// Currently only applies to boot classpath
method->GetDeclaringClass()->GetClassLoader() == nullptr) {
const void* entry_point = nullptr;
@@ -1125,7 +1125,7 @@
method->GetEntryPointFromQuickCompiledCode())) {
// This situation currently only occurs in the jit-zygote mode.
DCHECK(Runtime::Current()->IsZygote());
- DCHECK(!Runtime::Current()->IsUsingDefaultBootImageLocation());
+ DCHECK(Runtime::Current()->IsUsingApexBootImageLocation());
DCHECK(method->GetProfilingInfo(kRuntimePointerSize) != nullptr);
DCHECK(method->GetDeclaringClass()->GetClassLoader() == nullptr);
// Save the entrypoint, so it can be fethed later once the class is
@@ -2015,7 +2015,7 @@
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
if (class_linker->IsQuickResolutionStub(method->GetEntryPointFromQuickCompiledCode())) {
- if (Runtime::Current()->IsUsingDefaultBootImageLocation() || !Runtime::Current()->IsZygote()) {
+ if (!Runtime::Current()->IsUsingApexBootImageLocation() || !Runtime::Current()->IsZygote()) {
// Unless we're running as zygote in the jitzygote experiment, we currently don't save
// the JIT compiled code if we cannot update the entrypoint due to having the resolution stub.
VLOG(jit) << "Not compiling "
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 012b7d7..4d0e2ad 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -189,6 +189,8 @@
// barrier config.
static constexpr double kExtraDefaultHeapGrowthMultiplier = kUseReadBarrier ? 1.0 : 0.0;
+static constexpr const char* kApexBootImageLocation = "/system/framework/apex.art";
+
Runtime* Runtime::instance_ = nullptr;
struct TraceConfig {
@@ -1039,12 +1041,14 @@
LOG(WARNING) << "Skipping non-existent dex file '" << dex_filename << "'";
continue;
}
- // In the case we're not using the default boot image, we don't have support yet
+ bool verify = Runtime::Current()->IsVerificationEnabled();
+ // In the case we're using the apex boot image, we don't have support yet
// on reading vdex files of boot classpath. So just assume all boot classpath
// dex files have been verified (this should always be the case as the default boot
// image has been generated at build time).
- bool verify = Runtime::Current()->IsVerificationEnabled() &&
- (kIsDebugBuild || Runtime::Current()->IsUsingDefaultBootImageLocation());
+ if (Runtime::Current()->IsUsingApexBootImageLocation() && !kIsDebugBuild) {
+ verify = false;
+ }
if (!dex_file_loader.Open(dex_filename,
dex_location,
verify,
@@ -1150,8 +1154,7 @@
image_location_ = runtime_options.GetOrDefault(Opt::Image);
{
std::string error_msg;
- is_using_default_boot_image_location_ =
- (image_location_.compare(GetDefaultBootImageLocation(&error_msg)) == 0);
+ is_using_apex_boot_image_location_ = (image_location_ == kApexBootImageLocation);
}
SetInstructionSet(runtime_options.GetOrDefault(Opt::ImageInstructionSet));
diff --git a/runtime/runtime.h b/runtime/runtime.h
index ff4755e..a20aef4 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -186,8 +186,8 @@
return image_location_;
}
- bool IsUsingDefaultBootImageLocation() const {
- return is_using_default_boot_image_location_;
+ bool IsUsingApexBootImageLocation() const {
+ return is_using_apex_boot_image_location_;
}
// Starts a runtime, which may cause threads to be started and code to run.
@@ -946,7 +946,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_;
+ bool is_using_apex_boot_image_location_;
std::vector<std::string> boot_class_path_;
std::vector<std::string> boot_class_path_locations_;