diff options
Diffstat (limited to 'runtime/debugger.cc')
| -rw-r--r-- | runtime/debugger.cc | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 22a31635a6..1a0cec075c 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -588,29 +588,6 @@ bool Dbg::RequiresDeoptimization() { return !Runtime::Current()->GetInstrumentation()->IsForcedInterpretOnly(); } -// Used to patch boot image method entry point to interpreter bridge. -class UpdateEntryPointsClassVisitor : public ClassVisitor { - public: - explicit UpdateEntryPointsClassVisitor(instrumentation::Instrumentation* instrumentation) - : instrumentation_(instrumentation) {} - - bool operator()(ObjPtr<mirror::Class> klass) OVERRIDE REQUIRES(Locks::mutator_lock_) { - auto pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize(); - for (auto& m : klass->GetMethods(pointer_size)) { - const void* code = m.GetEntryPointFromQuickCompiledCode(); - if (Runtime::Current()->GetHeap()->IsInBootImageOatFile(code) && - !m.IsNative() && - !m.IsProxyMethod()) { - instrumentation_->UpdateMethodsCodeFromDebugger(&m, GetQuickToInterpreterBridge()); - } - } - return true; - } - - private: - instrumentation::Instrumentation* const instrumentation_; -}; - void Dbg::GoActive() { // Enable all debugging features, including scans for breakpoints. // This is a no-op if we're already active. @@ -639,14 +616,16 @@ void Dbg::GoActive() { } Runtime* runtime = Runtime::Current(); - // Since boot image code may be AOT compiled as not debuggable, we need to patch - // entry points of methods in boot image to interpreter bridge. - // However, the performance cost of this is non-negligible during native-debugging due to the + // Best effort deoptimization if the runtime is non-Java debuggable. This happens when + // ro.debuggable is set, but the application is not debuggable, or when a standalone + // dalvikvm invocation is not passed the debuggable option (-Xcompiler-option --debuggable). + // + // The performance cost of this is non-negligible during native-debugging due to the // forced JIT, so we keep the AOT code in that case in exchange for limited native debugging. - if (!runtime->GetInstrumentation()->IsForcedInterpretOnly() && !runtime->IsNativeDebuggable()) { - ScopedObjectAccess soa(self); - UpdateEntryPointsClassVisitor visitor(runtime->GetInstrumentation()); - runtime->GetClassLinker()->VisitClasses(&visitor); + if (!runtime->IsJavaDebuggable() && + !runtime->GetInstrumentation()->IsForcedInterpretOnly() && + !runtime->IsNativeDebuggable()) { + runtime->DeoptimizeBootImage(); } ScopedSuspendAll ssa(__FUNCTION__); |