Use the right instruction set for checking dex-cache staleness.
We should use the instruction set we're asked to use, and not
the instruction set of the current runtime.
bug: 16876489
Change-Id: Ic2a30b7e7d23192b0189c1f868b73c5f4c7eb8f9
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 0af2c22..8df3614 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -510,14 +510,14 @@
bool should_relocate_if_possible = Runtime::Current()->ShouldRelocate();
- InstructionSet isa = Runtime::Current()->GetInstructionSet();
jbyte dalvik_cache_decision = -1;
// Lets try the cache first (since we want to load from there since thats where the relocated
// versions will be).
if (have_cache_filename && !force_system_only) {
// We can use the dalvik-cache if we find a good file.
dalvik_cache_decision =
- IsDexOptNeededForFile<kVerboseLogging, kReasonLogging>(cache_filename, filename, isa);
+ IsDexOptNeededForFile<kVerboseLogging, kReasonLogging>(cache_filename, filename,
+ target_instruction_set);
// We will only return DexOptNeeded if both the cache and system return it.
if (dalvik_cache_decision != kDexoptNeeded && !require_system_version) {
CHECK(!(dalvik_cache_decision == kPatchoatNeeded && !should_relocate_if_possible))
@@ -528,7 +528,8 @@
}
jbyte system_decision =
- IsDexOptNeededForFile<kVerboseLogging, kReasonLogging>(odex_filename, filename, isa);
+ IsDexOptNeededForFile<kVerboseLogging, kReasonLogging>(odex_filename, filename,
+ target_instruction_set);
CHECK(!(system_decision == kPatchoatNeeded && !should_relocate_if_possible))
<< "May not return PatchoatNeeded when patching is disabled.";