summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2023-04-25 08:58:15 +0000
committer Mythri Alle <mythria@google.com> 2023-05-11 08:54:16 +0000
commit77a2822cb11886736018c5b3ab115dd992f9fd52 (patch)
treeebabc1edf769f03583486f4c76191e6787799257
parentc690603c5c8cc29b322c9e2fe85a0dfcc66d025e (diff)
Don't use oat / runtime app images in debuggable runtimes
Oat code even when compiled in debuggable mode lacks method entry / exit hooks. While runtime app images could be potentially used in debuggable runtimes, they don't impact the performance much. So to keep things simple, just don't load images in debuggable runtimes. Also, fix the entrypoints when initializing the classes. This is strictly not necessary but a safe thing to do. Test: art/testrunner.py --speed --debuggable Change-Id: I1c2b5c54a634ff3cde7f46f1077b5e16db2ecb0e
-rw-r--r--runtime/class_linker.cc4
-rw-r--r--runtime/oat_file_manager.cc6
-rw-r--r--runtime/oat_file_manager.h2
-rw-r--r--test/685-deoptimizeable/src/Main.java2
-rw-r--r--test/knownfailures.json7
5 files changed, 13 insertions, 8 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 19f79481f5..fca86a5a48 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2190,7 +2190,9 @@ bool ClassLinker::AddImageSpace(gc::space::ImageSpace* space,
}
// Set entry point to interpreter if in InterpretOnly mode.
- if (!runtime->IsAotCompiler() && runtime->GetInstrumentation()->InterpretOnly()) {
+ if (!runtime->IsAotCompiler() &&
+ (runtime->GetInstrumentation()->InterpretOnly() ||
+ runtime->IsJavaDebuggable())) {
// Set image methods' entry point to interpreter.
header.VisitPackedArtMethods([&](ArtMethod& method) REQUIRES_SHARED(Locks::mutator_lock_) {
if (!method.IsRuntimeMethod()) {
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index 63e005dfe1..1413896a1c 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -169,9 +169,9 @@ std::vector<const OatFile*> OatFileManager::RegisterImageOatFiles(
return oat_files;
}
-bool OatFileManager::ShouldLoadAppImage(const OatFile* source_oat_file) const {
+bool OatFileManager::ShouldLoadAppImage() const {
Runtime* const runtime = Runtime::Current();
- return kEnableAppImage && (!runtime->IsJavaDebuggableAtInit() || source_oat_file->IsDebuggable());
+ return kEnableAppImage && !runtime->IsJavaDebuggableAtInit();
}
std::vector<std::unique_ptr<const DexFile>> OatFileManager::OpenDexFilesFromOat(
@@ -265,7 +265,7 @@ std::vector<std::unique_ptr<const DexFile>> OatFileManager::OpenDexFilesFromOat(
// We need to throw away the image space if we are debuggable but the oat-file source of the
// image is not otherwise we might get classes with inlined methods or other such things.
std::unique_ptr<gc::space::ImageSpace> image_space;
- if (ShouldLoadAppImage(oat_file.get())) {
+ if (ShouldLoadAppImage()) {
if (oat_file->IsExecutable()) {
// App images generated by the compiler can only be used if the oat file
// is executable.
diff --git a/runtime/oat_file_manager.h b/runtime/oat_file_manager.h
index e09390bb0f..d812829a83 100644
--- a/runtime/oat_file_manager.h
+++ b/runtime/oat_file_manager.h
@@ -158,7 +158,7 @@ class OatFileManager {
REQUIRES(Locks::oat_file_manager_lock_);
// Return true if we should attempt to load the app image.
- bool ShouldLoadAppImage(const OatFile* source_oat_file) const;
+ bool ShouldLoadAppImage() const;
std::set<std::unique_ptr<const OatFile>> oat_files_ GUARDED_BY(Locks::oat_file_manager_lock_);
diff --git a/test/685-deoptimizeable/src/Main.java b/test/685-deoptimizeable/src/Main.java
index 41dcfd1051..674b2fc32a 100644
--- a/test/685-deoptimizeable/src/Main.java
+++ b/test/685-deoptimizeable/src/Main.java
@@ -74,6 +74,8 @@ public class Main {
disableStackFrameAsserts();
}
+ // Just declare a new int array so that the int arrays are resolved properly when JITing.
+ int[] tmp = new int[3];
ensureAllJitCompiled();
final HashMap<SampleObject, Long> map = new HashMap<SampleObject, Long>();
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 0455db4cf3..f5b695d2a6 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -311,8 +311,8 @@
"variant": "field-stress | jvmti-stress | redefine-stress | step-stress | trace-stress"
},
{
- "tests": "596-app-images",
- "description": "app images do not initialize classes when debuggable",
+ "tests": ["596-app-images", "597-app-images-same-classloader", "661-oat-writer-layout"],
+ "description": "app images are not loaded when debuggable",
"variant": "debuggable"
},
{
@@ -1167,6 +1167,7 @@
"844-exception2",
"845-fast-verify",
"845-data-image",
+ "2264-debuggable-data-image",
"846-multidex-data-image",
"847-filled-new-aray",
"999-redefine-hiddenapi",
@@ -1564,7 +1565,7 @@
"description": ["Test timing out on debug gc."]
},
{
- "tests": ["845-data-image", "846-multidex-data-image"],
+ "tests": ["845-data-image", "846-multidex-data-image", "2264-debuggable-data-image"],
"variant": "debuggable | trace | stream",
"description": ["Runtime app images are not supported with debuggable."]
},