summaryrefslogtreecommitdiff
path: root/runtime/quick_exception_handler.cc
diff options
context:
space:
mode:
author Chaitanya Cheemala <ccheemala@google.com> 2024-05-22 14:03:12 +0000
committer Chaitanya Cheemala <ccheemala@google.com> 2024-05-22 14:37:00 +0000
commitdb0551d164783866acf0cdcf9a7741ee6f21f0f2 (patch)
treee49897e10abe955d3315e48c1095caf71645c85c /runtime/quick_exception_handler.cc
parenta11d8246f846148c83bbcbbe39511c460cc0319a (diff)
Revert "Report method unwind events for native methods"
This reverts commit b42b645e26e206a2b1457cf9ea453b5021a873f5. Reason for revert: Likely culprit for b/342131895 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: Ic2724b90528b5a9e299e0df7d909be60d5c1e0eb
Diffstat (limited to 'runtime/quick_exception_handler.cc')
-rw-r--r--runtime/quick_exception_handler.cc33
1 files changed, 8 insertions, 25 deletions
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 37734f7d74..2ebcbb0fd0 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -439,41 +439,19 @@ class DeoptimizeStackVisitor final : public StackVisitor {
ArtMethod* method = GetMethod();
VLOG(deopt) << "Deoptimizing stack: depth: " << GetFrameDepth()
<< " at method " << ArtMethod::PrettyMethod(method);
-
if (method == nullptr || single_frame_done_) {
FinishStackWalk();
return false; // End stack walk.
- }
-
- // Update if method exit event needs to be reported. We should report exit event only if we
- // have reported an entry event. So tell interpreter if/ an entry event was reported.
- bool supports_exit_events = Runtime::Current()->GetInstrumentation()->MethodSupportsExitEvents(
- method, GetCurrentOatQuickMethodHeader());
-
- if (method->IsRuntimeMethod()) {
+ } else if (method->IsRuntimeMethod()) {
// Ignore callee save method.
DCHECK(method->IsCalleeSaveMethod());
return true;
} else if (method->IsNative()) {
// If we return from JNI with a pending exception and want to deoptimize, we need to skip
// the native method. The top method is a runtime method, the native method comes next.
- // We also deoptimize due to method instrumentation reasons from method exit callbacks.
- // In these cases native method is at the top of stack.
+ // We also deoptimize due to method instrumentation reasons from method entry / exit
+ // callbacks. In these cases native method is at the top of stack.
CHECK((GetFrameDepth() == 1U) || (GetFrameDepth() == 0U));
- // We see a native frame when:
- // 1. returning from JNI with a pending exception
- // 2. deopting from method exit callbacks (with or without a pending exception).
- // skip_method_exit_callbacks_ is set in this case
- // 3. handling async exception on suspend points for fast native methods.
- // We only need to call method unwind event in the first case.
- if (supports_exit_events &&
- !skip_method_exit_callbacks_ &&
- GetThread()->IsExceptionPending()) {
- // An exception has occurred in a native method and we are deoptimizing past the native
- // method. So report method unwind event here.
- Runtime::Current()->GetInstrumentation()->MethodUnwindEvent(
- GetThread(), method, dex::kDexNoIndex);
- }
callee_method_ = method;
return true;
} else if (!single_frame_deopt_ &&
@@ -504,6 +482,11 @@ class DeoptimizeStackVisitor final : public StackVisitor {
} else {
HandleOptimizingDeoptimization(method, new_frame, updated_vregs);
}
+ // Update if method exit event needs to be reported. We should report exit event only if we
+ // have reported an entry event. So tell interpreter if/ an entry event was reported.
+ bool supports_exit_events =
+ Runtime::Current()->GetInstrumentation()->MethodSupportsExitEvents(
+ method, GetCurrentOatQuickMethodHeader());
new_frame->SetSkipMethodExitEvents(!supports_exit_events);
// If we are deoptimizing after method exit callback we shouldn't call the method exit
// callbacks again for the top frame. We may have to deopt after the callback if the callback