From 9ff77fd4142e52ac2986de5e080e83cbf8cedf2b Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov Date: Tue, 20 May 2025 11:12:02 -0700 Subject: [PATCH] [vm] Mark _FutureListener.handleValue invisible Instead of hiding it by skipping it in AsyncAwareStackUnwinder. Skipping it manually meant that we don't expand and see functions which are inlined into handleValue in the stacktrace which might be undesirable and makes stacktraces unnecessarily sensitive to inlining. Filtering based on visibility happens after inlined frame expansion which makes stack trace more stable. Fixes https://github.com/dart-lang/sdk/issues/60684 TEST=vm/dart/awaiter_stacks/* CoreLibraryReviewExempt: pragma only change Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try Change-Id: Ie6e0ad65285dd1d6f77e27e7488e8d46d30c176c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429660 Reviewed-by: Alexander Markov Commit-Queue: Slava Egorov --- runtime/vm/compiler/recognized_methods_list.h | 2 +- runtime/vm/stack_trace.cc | 2 +- sdk/lib/async/future_impl.dart | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h index e0a966c23bf..1da8f4b4108 100644 --- a/runtime/vm/compiler/recognized_methods_list.h +++ b/runtime/vm/compiler/recognized_methods_list.h @@ -13,7 +13,7 @@ namespace dart { // debug mode to get the correct fingerprint from the mismatch error. #define OTHER_RECOGNIZED_LIST(V) \ V(AsyncLibrary, _FutureListener, handleValue, FutureListenerHandleValue, \ - 0xaa83f1d2) \ + 0xaa83f593) \ V(AsyncLibrary, _SuspendState, get:_functionData, \ SuspendState_getFunctionData, 0x79c36e2e) \ V(AsyncLibrary, _SuspendState, set:_functionData, \ diff --git a/runtime/vm/stack_trace.cc b/runtime/vm/stack_trace.cc index 5cf9bdf975e..6c699b7d84c 100644 --- a/runtime/vm/stack_trace.cc +++ b/runtime/vm/stack_trace.cc @@ -420,7 +420,7 @@ bool AsyncAwareStackUnwinder::HandleSynchronousFrame() { object_ = GetReceiver(); InitializeAwaiterFrameFromFutureListener(object_); UnwindToAwaiter(); - return true; // Hide this frame from the stack trace. + return false; // Do not hide this from the stack trace. } return false; diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart index e5e8b2dba04..d2e089721f8 100644 --- a/sdk/lib/async/future_impl.dart +++ b/sdk/lib/async/future_impl.dart @@ -217,6 +217,7 @@ class _FutureListener { @pragma("vm:recognized", "other") @pragma("vm:never-inline") + @pragma("vm:invisible") FutureOr handleValue(S sourceResult) { return _zone.runUnary, S>(_onValue, sourceResult); }