Fix a braino in GetSavedEntryPointOfPreCompiledCode.
We should return the entrypoint, and not the code_ptr. On thumb,
the entrypoint is code_ptr + 1.
Test: jitzygote boots, zygote32 doesn't crash.
Bug: 119800099
Change-Id: I41c97291c54efb4d6e342d260d693ab1abf8dffe
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 3669973..256543b 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -305,15 +305,19 @@
const void* JitCodeCache::GetSavedEntryPointOfPreCompiledMethod(ArtMethod* method) {
if (Runtime::Current()->IsUsingApexBootImageLocation() && method->IsPreCompiled()) {
+ const void* code_ptr = nullptr;
if (method->GetDeclaringClass()->GetClassLoader() == nullptr) {
- return zygote_map_.GetCodeFor(method);
+ code_ptr = zygote_map_.GetCodeFor(method);
} else {
MutexLock mu(Thread::Current(), *Locks::jit_lock_);
auto it = saved_compiled_methods_map_.find(method);
if (it != saved_compiled_methods_map_.end()) {
- return it->second;
+ code_ptr = it->second;
}
- return nullptr;
+ }
+ if (code_ptr != nullptr) {
+ OatQuickMethodHeader* method_header = OatQuickMethodHeader::FromCodePointer(code_ptr);
+ return method_header->GetEntryPoint();
}
}
return nullptr;