summaryrefslogtreecommitdiffstats
path: root/runtime/native
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-05-02 10:10:39 +0100
committerBrian Carlstrom <bdc@google.com>2014-05-02 18:28:47 -0700
commit52f84884433f3875f4b1bc5595b8d5a2d6fb3d99 (patch)
treee9d5008b7288d200872447cc93354b5248beceaf /runtime/native
parentdee6812d90c78daa09a3870ba5ffcead57a63d1a (diff)
downloadart-52f84884433f3875f4b1bc5595b8d5a2d6fb3d99.zip
art-52f84884433f3875f4b1bc5595b8d5a2d6fb3d99.tar.gz
art-52f84884433f3875f4b1bc5595b8d5a2d6fb3d99.tar.bz2
Prevent spurious dexopts in 32-64 builds.
When we're checking if a file needs to be dexopted, we need to compare oat file checksums with the image checksum for the oat file's target instruction set and not the current runtime's target instruction set. bug:14475807 Change-Id: Ib44d8e3c6cdf3a37fce6332c694a6602c658e925
Diffstat (limited to 'runtime/native')
-rw-r--r--runtime/native/dalvik_system_DexFile.cc32
1 files changed, 4 insertions, 28 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index d9c1309..ed1ee7a 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -377,6 +377,8 @@ static jboolean IsDexOptNeededInternal(JNIEnv* env, const char* filename,
}
}
+ const InstructionSet target_instruction_set = GetInstructionSetFromString(instruction_set);
+
// Check if we have an odex file next to the dex file.
std::string odex_filename(OatFile::DexFilenameToOdexFilename(filename));
std::string error_msg;
@@ -403,6 +405,7 @@ static jboolean IsDexOptNeededInternal(JNIEnv* env, const char* filename,
return JNI_FALSE;
}
if (ClassLinker::VerifyOatFileChecksums(oat_file.get(), filename, location_checksum,
+ target_instruction_set,
&error_msg)) {
if (kVerboseLogging) {
LOG(INFO) << "DexFile_isDexOptNeeded precompiled file " << odex_filename
@@ -433,33 +436,6 @@ static jboolean IsDexOptNeededInternal(JNIEnv* env, const char* filename,
return JNI_TRUE;
}
- for (const auto& space : runtime->GetHeap()->GetContinuousSpaces()) {
- if (space->IsImageSpace()) {
- // TODO: Ensure this works with multiple image spaces.
- const ImageHeader& image_header = space->AsImageSpace()->GetImageHeader();
- if (oat_file->GetOatHeader().GetImageFileLocationOatChecksum() !=
- image_header.GetOatChecksum()) {
- if (kReasonLogging) {
- ScopedObjectAccess soa(env);
- LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
- << " has out-of-date oat checksum compared to "
- << oat_file->GetLocation();
- }
- return JNI_TRUE;
- }
- if (oat_file->GetOatHeader().GetImageFileLocationOatDataBegin()
- != reinterpret_cast<uintptr_t>(image_header.GetOatDataBegin())) {
- if (kReasonLogging) {
- ScopedObjectAccess soa(env);
- LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
- << " has out-of-date oat begin compared to "
- << oat_file->GetLocation();
- }
- return JNI_TRUE;
- }
- }
- }
-
uint32_t location_checksum;
if (!DexFile::GetChecksum(filename, &location_checksum, &error_msg)) {
if (kReasonLogging) {
@@ -470,7 +446,7 @@ static jboolean IsDexOptNeededInternal(JNIEnv* env, const char* filename,
}
if (!ClassLinker::VerifyOatFileChecksums(oat_file.get(), filename, location_checksum,
- &error_msg)) {
+ target_instruction_set, &error_msg)) {
if (kReasonLogging) {
LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
<< " has out-of-date checksum compared to " << filename