summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2023-03-10 17:59:19 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-03-11 13:54:00 +0000
commit0e60ddb0c0e978063d43672ca2e6ffd83761c9eb (patch)
treef10c0d95af764b04f7295261fa7563568fc18111
parentcce3151716083d5b7858915c7d1d6f8514c865cc (diff)
Re-enable app image loader for userfaultfd.
Just disable dex cache generation for now, and make sure the image works with the right GC. Test: test.py Bug: 260557058 Bug: 270936884 Change-Id: Iceae4f8a615d2f1e740936c05b121d91915b2519
-rw-r--r--runtime/class_linker.cc4
-rw-r--r--runtime/oat_file_manager.cc2
-rw-r--r--runtime/runtime_image.cc12
-rw-r--r--test/knownfailures.json6
4 files changed, 13 insertions, 11 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 880addb354..224b928d01 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2098,6 +2098,10 @@ bool ClassLinker::AddImageSpace(gc::space::ImageSpace* space,
*error_msg = "Checksums count does not match";
return false;
}
+ if (oat_header->IsConcurrentCopying() != gUseReadBarrier) {
+ *error_msg = "GCs do not match";
+ return false;
+ }
// Check if the dex checksums match the dex files that we just loaded.
uint32_t* checksums = reinterpret_cast<uint32_t*>(
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index dee5e23c06..32de17486e 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -67,7 +67,7 @@ using android::base::StringPrintf;
static constexpr bool kEnableAppImage = true;
// If true, we attempt to load an app image generated by the runtime.
-static const bool kEnableRuntimeAppImage = !gUseUserfaultfd;
+static const bool kEnableRuntimeAppImage = true;
const OatFile* OatFileManager::RegisterOatFile(std::unique_ptr<const OatFile> oat_file,
bool in_memory) {
diff --git a/runtime/runtime_image.cc b/runtime/runtime_image.cc
index 5bd238cc2a..80c9d3a9c6 100644
--- a/runtime/runtime_image.cc
+++ b/runtime/runtime_image.cc
@@ -55,8 +55,6 @@ namespace art {
using android::base::StringPrintf;
-static constexpr bool kEmitDexCacheArrays = true;
-
/**
* The native data structures that we store in the image.
*/
@@ -102,7 +100,6 @@ class RuntimeImageHelper {
intern_table_(InternStringHash(this), InternStringEquals(this)),
class_table_(ClassDescriptorHash(this), ClassDescriptorEquals()) {}
-
bool Generate(std::string* error_msg) {
if (!WriteObjects(error_msg)) {
return false;
@@ -1088,6 +1085,8 @@ class RuntimeImageHelper {
runtime->GetBootClassPathChecksums());
key_value_store.Put(OatHeader::kClassPathKey,
oat_dex_file->GetOatFile()->GetClassLoaderContext());
+ key_value_store.Put(OatHeader::kConcurrentCopying,
+ gUseReadBarrier ? OatHeader::kTrueValue : OatHeader::kFalseValue);
std::unique_ptr<const InstructionSetFeatures> isa_features =
InstructionSetFeatures::FromCppDefines();
@@ -1241,6 +1240,11 @@ class RuntimeImageHelper {
return reinterpret_cast<mirror::GcRootArray<T>*>(data.data() + offset);
}
+ static bool EmitDexCacheArrays() {
+ // We need to treat dex cache arrays specially in an image for userfaultfd.
+ // Disable for now. See b/270936884.
+ return !gUseUserfaultfd;
+ }
uint32_t CopyDexCache(ObjPtr<mirror::DexCache> cache) REQUIRES_SHARED(Locks::mutator_lock_) {
auto it = dex_caches_.find(cache->GetDexFile());
@@ -1254,7 +1258,7 @@ class RuntimeImageHelper {
reinterpret_cast<mirror::DexCache*>(copy)->ResetNativeArrays();
reinterpret_cast<mirror::DexCache*>(copy)->SetDexFile(nullptr);
- if (!kEmitDexCacheArrays) {
+ if (!EmitDexCacheArrays()) {
return offset;
}
diff --git a/test/knownfailures.json b/test/knownfailures.json
index d9960052cc..cb9c89079a 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -1557,11 +1557,5 @@
"env_vars": {"ART_TEST_DEBUG_GC": "true"},
"bug": "b/264844668",
"description": ["Test timing out on debug gc."]
- },
- {
- "tests": ["845-data-image", "846-multidex-data-image"],
- "env_vars": {"ART_USE_READ_BARRIER": "false"},
- "bug": "b/270936884",
- "description": ["Fails with CMC."]
}
]