diff options
author | 2022-05-04 10:09:18 +0000 | |
---|---|---|
committer | 2022-05-04 14:26:59 +0000 | |
commit | 570ade8a6600d368a9e24b64cfa0a1907929166a (patch) | |
tree | 2b366b7e40289230562b2ea0933d0ef1dba2dad6 | |
parent | 614638b9c178552953feda9ed366bd877002f1c9 (diff) |
Revert "Reland "Don't use AOT code for native methods for java debuggable runtime"""
This reverts commit 9d1413803e5be6746264e47b951e02f409c100a3.
Reason for revert: Failures mostly on 096-array-copy-concurrent-gc but also a couple of others. Example failure: https://logs.chromium.org/logs/art/buildbucket/cr-buildbucket/8815176149292612577/+/u/test_debuggable/stdout
Change-Id: Ia197d6094b4a4a744c7da5f120b59597db11747c
-rw-r--r-- | runtime/art_method.cc | 9 | ||||
-rw-r--r-- | runtime/instrumentation.cc | 11 | ||||
-rw-r--r-- | runtime/runtime.cc | 8 |
3 files changed, 10 insertions, 18 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index 40b7a7b48f..867f75c4b3 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -617,15 +617,6 @@ const OatQuickMethodHeader* ArtMethod::GetOatQuickMethodHeader(uintptr_t pc) { } OatQuickMethodHeader* method_header = OatQuickMethodHeader::FromEntryPoint(oat_entry_point); - // We could have existing Oat code for native methods but we may not use it if the runtime is java - // debuggable or when profiling boot class path. There is no easy way to check if the pc - // corresponds to QuickGenericJniStub. Since we have eliminated all the other cases, if the pc - // doesn't correspond to the AOT code then we must be running QuickGenericJniStub. - if (IsNative() && !method_header->Contains(pc)) { - DCHECK_NE(pc, 0u) << "PC 0 for " << PrettyMethod(); - return nullptr; - } - DCHECK(method_header->Contains(pc)) << PrettyMethod() << " " << std::hex << pc << " " << oat_entry_point diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index 80e35ac0ae..4b3b318b3f 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -303,11 +303,16 @@ bool Instrumentation::InterpretOnly(ArtMethod* method) REQUIRES_SHARED(Locks::mu Runtime::Current()->GetRuntimeCallbacks()->IsMethodBeingInspected(method); } -static bool CanUseAotCode(const void* quick_code) +static bool CanUseAotCode(ArtMethod* method, const void* quick_code) REQUIRES_SHARED(Locks::mutator_lock_) { if (quick_code == nullptr) { return false; } + if (method->IsNative()) { + // AOT code for native methods can always be used. + return true; + } + Runtime* runtime = Runtime::Current(); // For simplicity, we never use AOT code for debuggable. if (runtime->IsJavaDebuggable()) { @@ -343,7 +348,7 @@ static const void* GetOptimizedCodeFor(ArtMethod* method) REQUIRES_SHARED(Locks: // In debuggable mode, we can only use AOT code for native methods. ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); const void* aot_code = method->GetOatMethodQuickCode(class_linker->GetImagePointerSize()); - if (CanUseAotCode(aot_code)) { + if (CanUseAotCode(method, aot_code)) { return aot_code; } @@ -402,7 +407,7 @@ void Instrumentation::InitializeMethodsCode(ArtMethod* method, const void* aot_c } // Use the provided AOT code if possible. - if (CanUseAotCode(aot_code)) { + if (CanUseAotCode(method, aot_code)) { UpdateEntryPoints(method, aot_code); return; } diff --git a/runtime/runtime.cc b/runtime/runtime.cc index d2eb3bdf63..9a6c8a5c3c 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -3147,19 +3147,15 @@ class UpdateEntryPointsClassVisitor : public ClassVisitor { auto pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize(); for (auto& m : klass->GetMethods(pointer_size)) { const void* code = m.GetEntryPointFromQuickCompiledCode(); - // For java debuggable runtimes we also deoptimize native methods. For other cases (boot - // image profiling) we don't need to deoptimize native methods. If this changes also - // update Instrumentation::CanUseAotCode. - bool deoptimize_native_methods = Runtime::Current()->IsJavaDebuggable(); if (Runtime::Current()->GetHeap()->IsInBootImageOatFile(code) && - (!m.IsNative() || deoptimize_native_methods) && + !m.IsNative() && !m.IsProxyMethod()) { instrumentation_->InitializeMethodsCode(&m, /*aot_code=*/ nullptr); } if (Runtime::Current()->GetJit() != nullptr && Runtime::Current()->GetJit()->GetCodeCache()->IsInZygoteExecSpace(code) && - (!m.IsNative() || deoptimize_native_methods)) { + !m.IsNative()) { DCHECK(!m.IsProxyMethod()); instrumentation_->InitializeMethodsCode(&m, /*aot_code=*/ nullptr); } |