diff options
author | 2022-01-17 16:43:04 +0000 | |
---|---|---|
committer | 2022-02-02 15:19:18 +0000 | |
commit | ab474880a4a6d9b57d142927cc8738c25b86cb86 (patch) | |
tree | 381d477de1f2e28d67ace4a0ece7856866a63dae /runtime/interpreter/interpreter_common.cc | |
parent | cc6026830c2715a8a424424a9ac1e97b7df92cd6 (diff) |
Cleanup Instrumentation::IsActive
Instrumentation::IsActive is used to check if nterp should be disabled
because we have certain listeners that are processed only when running
in interpreter. Earlier this check included all listeners. However
- method entry / exit / unwind are handled by installing instrumentation
stubs, so nterp need not be disabled.
- exception events are handled in nterp too (see
art_quick_deliver_exception)
- dex_pc_listeners these are handled only in interpreter but the methods
that need these events are deoptimized.
This CL removes these listeners from IsActive and renames the IsActive.
Change-Id: Ie2e936207405d5c9057129b64ac382fcf9f0cbfb
Diffstat (limited to 'runtime/interpreter/interpreter_common.cc')
-rw-r--r-- | runtime/interpreter/interpreter_common.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index cafe74714e..c8a87c1d75 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -150,11 +150,14 @@ bool SendMethodExitEvents(Thread* self, // behavior. bool MoveToExceptionHandler(Thread* self, ShadowFrame& shadow_frame, - const instrumentation::Instrumentation* instrumentation) { + bool skip_listeners, + bool skip_throw_listener) { self->VerifyStack(); StackHandleScope<2> hs(self); Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException())); - if (instrumentation != nullptr && + const instrumentation::Instrumentation* instrumentation = + Runtime::Current()->GetInstrumentation(); + if (!skip_throw_listener && instrumentation->HasExceptionThrownListeners() && self->IsExceptionThrownByCurrentMethod(exception.Get())) { // See b/65049545 for why we don't need to check to see if the exception has changed. @@ -169,7 +172,7 @@ bool MoveToExceptionHandler(Thread* self, uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock( hs.NewHandle(exception->GetClass()), shadow_frame.GetDexPC(), &clear_exception); if (found_dex_pc == dex::kDexNoIndex) { - if (instrumentation != nullptr) { + if (!skip_listeners) { if (shadow_frame.NeedsNotifyPop()) { instrumentation->WatchedFramePopped(self, shadow_frame); if (shadow_frame.GetForcePopFrame()) { @@ -189,12 +192,12 @@ bool MoveToExceptionHandler(Thread* self, return shadow_frame.GetForcePopFrame(); } else { shadow_frame.SetDexPC(found_dex_pc); - if (instrumentation != nullptr && instrumentation->HasExceptionHandledListeners()) { + if (!skip_listeners && instrumentation->HasExceptionHandledListeners()) { self->ClearException(); instrumentation->ExceptionHandledEvent(self, exception.Get()); if (UNLIKELY(self->IsExceptionPending())) { // Exception handled event threw an exception. Try to find the handler for this one. - return MoveToExceptionHandler(self, shadow_frame, instrumentation); + return MoveToExceptionHandler(self, shadow_frame, skip_listeners, skip_throw_listener); } else if (!clear_exception) { self->SetException(exception.Get()); } |