Update the entrypoint with the code entrypoint, not the code pointer.
The entrypoint takes into account the "| 1" mask for thumb code.
Test: boot and arm32 apps don't crash.
Change-Id: I192e65d545e9934d73e4042d72da53e781ddf4a7
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index fc2143f..76065a3 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -195,6 +195,15 @@
static void UpdateEntrypoints(ArtMethod* method, const void* quick_code)
REQUIRES_SHARED(Locks::mutator_lock_) {
+ if (kIsDebugBuild) {
+ jit::Jit* jit = Runtime::Current()->GetJit();
+ if (jit != nullptr && jit->GetCodeCache()->ContainsPc(quick_code)) {
+ // Ensure we always have the thumb entrypoint for JIT on arm32.
+ if (kRuntimeISA == InstructionSet::kArm) {
+ CHECK_EQ(reinterpret_cast<uintptr_t>(quick_code) & 1, 1u);
+ }
+ }
+ }
method->SetEntryPointFromQuickCompiledCode(quick_code);
}
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 97565ad..52c0e9d 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -947,9 +947,9 @@
return false;
}
if (UNLIKELY(method->IsPreCompiled()) && !with_backedges /* don't check for OSR */) {
- const void* code_ptr = code_cache_->GetZygoteMap()->GetCodeFor(method);
- if (code_ptr != nullptr) {
- Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(method, code_ptr);
+ const void* entry_point = code_cache_->GetSavedEntryPointOfPreCompiledMethod(method);
+ if (entry_point != nullptr) {
+ Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(method, entry_point);
return true;
}
}