Commit Graph

30 Commits

Author SHA1 Message Date
Martin Kustermann ec9314f009 [gardening] Remove usage of AsyncThenWrapperHelper() - its unused and treeshaken in AOT
This is a folow-up to [0]

[0] https://dart-review.googlesource.com/c/sdk/+/233362

TEST=Fixes ASSERT hit in AOT.

Change-Id: Ia99a168a216ac7c5858f9773bd8df32be3016525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233563
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-18 17:32:18 +00:00
Martin Kustermann f50b3a52e4 [vm] Make async lowering no longer use optional parameters
This CL

  * Makes :async_op only have two parameters: We take advantage
    of the fact that errors not only have exception != null but
    also stacktrace != null.
  * Makes :async_op have no optional parameters. This reduces
    code size significantly.
  * Removes unused parameter in _awaitHelper calls
  * Wrap the then callback instead of the error callback. (needed
    to make optional parameters required)

This results in 2% code savings on a big g3 app.
The size of :async_op shrinks on average by 11%

TEST=ci

Change-Id: I38d5fba4ebebc780b48dac5aa6a250d2c7952bfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233362
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-02-18 12:09:42 +00:00
Alexander Markov ddfc98337b Reland "[vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces"
This is a reland of b6dc4dad4d

TEST=ci

Original change's description:
> [vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces
>
> The following changes are done in preparation for the removal of Code
> objects in AOT with --dwarf-stack-traces:
>
> * Stack trace objects are extended to hold uword PCs (which may not
>   fit into Smi range).
>
> * Scanning stack frames in GC (StackFrame::VisitObjectPointers)
>   now avoids using Code objects.
>   In order to find CompressedStackMaps it now calls
>   ReversePc::FindCompressedStackMaps.
>
> * Singleton Code object (StubCode::UnknownDartCode()) is prepared as
>   a replacement for Code objects in stack traces. It has
>   PayloadStart() == 0 and Size() == kUwordMax so it includes
>   arbitrary PCs.
>
> * In --dwarf-stack-traces mode, most Code objects obtained from stack
>   frames are replaced with StubCode::UnknownDartCode().
>   This simulates future behavior of ReversePc::Lookup when Code objects
>   will be removed.
>
> Issue: https://github.com/dart-lang/sdk/issues/44852
> Change-Id: I7cec7b8b9396c9cfeca3c256a412ba4e82a7e0c4
> TEST=ci
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182720
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: Ia2fc4672a085cd963b7fc103369851df3603590c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186202
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-22 10:46:28 +00:00
Alexander Markov fde0ed2e93 Revert "[vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces"
This reverts commit b6dc4dad4d.

Reason for revert: broke package:vm_snapshot_analysis in Flutter
(https://github.com/flutter/flutter/issues/76313).

Original change's description:
> [vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces
>
> The following changes are done in preparation for the removal of Code
> objects in AOT with --dwarf-stack-traces:
>
> * Stack trace objects are extended to hold uword PCs (which may not
>   fit into Smi range).
>
> * Scanning stack frames in GC (StackFrame::VisitObjectPointers)
>   now avoids using Code objects.
>   In order to find CompressedStackMaps it now calls
>   ReversePc::FindCompressedStackMaps.
>
> * Singleton Code object (StubCode::UnknownDartCode()) is prepared as
>   a replacement for Code objects in stack traces. It has
>   PayloadStart() == 0 and Size() == kUwordMax so it includes
>   arbitrary PCs.
>
> * In --dwarf-stack-traces mode, most Code objects obtained from stack
>   frames are replaced with StubCode::UnknownDartCode().
>   This simulates future behavior of ReversePc::Lookup when Code objects
>   will be removed.
>
> Issue: https://github.com/dart-lang/sdk/issues/44852
> Change-Id: I7cec7b8b9396c9cfeca3c256a412ba4e82a7e0c4
> TEST=ci
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182720
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Issue: https://github.com/dart-lang/sdk/issues/44852
Change-Id: I6f66171eecf1133363a7ce56193e782e43a20baf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185488
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-02-18 18:04:29 +00:00
Alexander Markov b6dc4dad4d [vm/aot] Avoid using most Code objects in stack traces with --dwarf-stack-traces
The following changes are done in preparation for the removal of Code
objects in AOT with --dwarf-stack-traces:

* Stack trace objects are extended to hold uword PCs (which may not
  fit into Smi range).

* Scanning stack frames in GC (StackFrame::VisitObjectPointers)
  now avoids using Code objects.
  In order to find CompressedStackMaps it now calls
  ReversePc::FindCompressedStackMaps.

* Singleton Code object (StubCode::UnknownDartCode()) is prepared as
  a replacement for Code objects in stack traces. It has
  PayloadStart() == 0 and Size() == kUwordMax so it includes
  arbitrary PCs.

* In --dwarf-stack-traces mode, most Code objects obtained from stack
  frames are replaced with StubCode::UnknownDartCode().
  This simulates future behavior of ReversePc::Lookup when Code objects
  will be removed.

Issue: https://github.com/dart-lang/sdk/issues/44852
Change-Id: I7cec7b8b9396c9cfeca3c256a412ba4e82a7e0c4
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182720
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-02-17 20:12:32 +00:00
Clement Skau dfd5413952 [VM] Adds Debugger break for Future.catchError
TEST=Added new Future.catchError pause-on-unhandled-exceptions test.

Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: Ieb3cf834eacad4f9b98ab2db0e5813e9bfa09747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180840
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-02-02 06:59:54 +00:00
Clement Skau c3ec3e53a1 [VM] Adds Future.then stack unwind. (3)
TEST=ASAN; Various 'causal' tests updated below.

Issues addressed in this revision:
- https://github.com/dart-lang/sdk/issues/44708 ASAN
- https://github.com/dart-lang/sdk/issues/44700 SegFault

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-asan-linux-release-x64-try,analyzer-linux-release-try,analyzer-analysis-server-linux-try,analyzer-nnbd-linux-release-try
Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
Change-Id: I8b8f6ee2e5d4ca2e6bea988ec1cd9f912ddf8240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180186
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-26 14:02:39 +00:00
David Morgan 88c1be7e3b Revert "Reland "[VM] Adds Future.then and Future.catchError stack unwinding.""
This reverts commit 9978a246c1.

Reason for revert: VM crashes in google3, b/177506826

Original change's description:
> Reland "[VM] Adds Future.then and Future.catchError stack unwinding."
>
> This reverts commit 978b838461.
>
> Reason for revert: Fix: https://dart-review.googlesource.com/c/sdk/+/179762
>
> TEST=Various 'causal' tests updated below.
>
> Original change's description:
> > Revert "[VM] Adds Future.then and Future.catchError stack unwinding."
> >
> > This reverts commit 8f2c47f24b.
> >
> > Reason for revert: We suspect this is causing VM crashes: http://b/177506826
> >
> > Original change's description:
> > > [VM] Adds Future.then and Future.catchError stack unwinding.
> > >
> > > TEST=Various 'causal' tests updated below.
> > >
> > > Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
> > > Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
> > > Commit-Queue: Clement Skau <cskau@google.com>
> > > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> >
> > TBR=vegorov@google.com,cskau@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: https://github.com/dart-lang/sdk/issues/40815
> > Bug: https://github.com/dart-lang/sdk/issues/37953
> > Change-Id: I870f0202f43588f71a5d2b0f82338978b5a5dda9
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178998
> > Reviewed-by: Michal Terepeta <michalt@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > Commit-Queue: Michal Terepeta <michalt@google.com>
>
> TBR=vegorov@google.com,cskau@google.com,michalt@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: https://github.com/dart-lang/sdk/issues/40815
> Bug: https://github.com/dart-lang/sdk/issues/37953
> Change-Id: I8a1eb6679b01571b850499cac2dadc5bf9ef2dcd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179763
> Reviewed-by: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com,michalt@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/40815
Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: I1274bcb375bf6f9cb0609d372b0b451d51eb99c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180147
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2021-01-20 12:44:55 +00:00
Clement Skau 9978a246c1 Reland "[VM] Adds Future.then and Future.catchError stack unwinding."
This reverts commit 978b838461.

Reason for revert: Fix: https://dart-review.googlesource.com/c/sdk/+/179762

TEST=Various 'causal' tests updated below.

Original change's description:
> Revert "[VM] Adds Future.then and Future.catchError stack unwinding."
>
> This reverts commit 8f2c47f24b.
>
> Reason for revert: We suspect this is causing VM crashes: http://b/177506826
>
> Original change's description:
> > [VM] Adds Future.then and Future.catchError stack unwinding.
> >
> > TEST=Various 'causal' tests updated below.
> >
> > Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
> > Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
> > Commit-Queue: Clement Skau <cskau@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
>
> TBR=vegorov@google.com,cskau@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: https://github.com/dart-lang/sdk/issues/40815
> Bug: https://github.com/dart-lang/sdk/issues/37953
> Change-Id: I870f0202f43588f71a5d2b0f82338978b5a5dda9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178998
> Reviewed-by: Michal Terepeta <michalt@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Michal Terepeta <michalt@google.com>

TBR=vegorov@google.com,cskau@google.com,michalt@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/40815
Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: I8a1eb6679b01571b850499cac2dadc5bf9ef2dcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179763
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-01-18 12:15:49 +00:00
Michal Terepeta 978b838461 Revert "[VM] Adds Future.then and Future.catchError stack unwinding."
This reverts commit 8f2c47f24b.

Reason for revert: We suspect this is causing VM crashes: http://b/177506826

Original change's description:
> [VM] Adds Future.then and Future.catchError stack unwinding.
>
> TEST=Various 'causal' tests updated below.
>
> Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
> Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/40815
Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: I870f0202f43588f71a5d2b0f82338978b5a5dda9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178998
Reviewed-by: Michal Terepeta <michalt@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2021-01-14 13:56:53 +00:00
Clement Skau 8f2c47f24b [VM] Adds Future.then and Future.catchError stack unwinding.
TEST=Various 'causal' tests updated below.

Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-13 08:00:14 +00:00
Clement Skau 2d36c85ff8 [vm] Removes support for --causal-async-stacks
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.

After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.

TEST=Exhaustive CQ.

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-01 07:27:14 +00:00
Clement Skau 013c19ecb6 [VM] Adds Future.whenComplete stack unwind.
TEST=tools/test.py -n dartk-linux-release-x64 vm/dart_2/causal_stacks

Bug: https://github.com/dart-lang/sdk/issues/44169
Change-Id: Ia5810ca3585f8e90b6fb91827a892a038e82f13b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173264
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-23 07:51:05 +00:00
Clement Skau 75a5ba9a21 [VM] Adds un-inlining for Service getStackTrace.
This adds back special handling of sync frames which was previously
dropped in 171584.
This is however needed to un-inline optimised frames.

https://dart-review.googlesource.com/c/sdk/+/171584

TEST=python tools/test.py -n dartk-linux-debug-x64 pkg/vm_service/test/get_stack_test

Bug: https://github.com/dart-lang/sdk/issues/44206
Change-Id: Ia24b24c05a1e5f4257b3723bc6e6d3d1dbac9c93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172220
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Clement Skau <cskau@google.com>
2020-11-16 17:05:08 +00:00
Clement Skau c209f1c1b8 [VM] Fix invisible frames in CollectAsyncLazyStackTrace().
TEST=python tools/test.py -n dartk-linux-debug-x64 pkg/vm_service/test/get_stack_test

Bug: https://github.com/dart-lang/sdk/issues/44138
Change-Id: Ief59d581166411ea939df8b648473f31060282e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171584
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-12 16:21:26 +00:00
Clement Skau 27ca552ddb [SDK] Replaces async's _AsyncAwaitCompleter with _Future.
Run time (less is better) impact:
dart:
- Calls.AwaitAsyncCall  -43.95% ~ -55.50%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -40.33% ~ -53.58%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -42.69% ~ -55.65%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -42.05% ~ -56.14%
- Calls.Await...  0% ~ -13%
dart-aot:
- Calls.AwaitAsyncCall  -9.748% ~ -11.13%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -8.673% ~ -13.19%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -9.799% ~ -11.74%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -5.412% ~ -13.43%

Code size impact:
- flutter_gallery_app_so_brotli_size  -0.1237% ~ -0.2410%
- flutter_gallery_readonlydata_size  0.1693% ~ 0.2041%
- flutter_gallery_instructions_size  0.1157% ~ 0.1779%
- flutter_gallery_total_size  0.1021% ~ 0.1413%

Bug: https://github.com/dart-lang/sdk/issues/39119
Change-Id: I64d28a8bea078277946d7be43737e265920c8f16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126322
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-05 09:51:13 +00:00
Alexander Markov 7588ed86de Remove bytecode mode from the VM
Change-Id: Ief167b7ffc128105a03cc225ab750234c9a6a7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169147
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-28 17:42:35 +00:00
Clement Skau 7f0bd5e811 [VM] Removes _Future's and _StreamImpl's _awaiter.
Changes debugger.cc to use the 'lazy async stack' mechanism for
unwinding async stacks, which means we no longer have to manually
keep track of the caller.

This also allows us to get rid of _asyncStarListenHelper.

Bug: https://github.com/dart-lang/sdk/issues/42457
Change-Id: I536e9da4af275998140ae5f05e3a43e07c77cfc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167561
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-21 12:38:23 +00:00
Teagan Strickland b55342cb3e [vm/aot] Drop some Function objects not needed at runtime.
In particular, don't serialize a function if its code is used by the
dispatch table, but there's no need for the function object itself
at runtime like dynamic lookup or dynamic invocation forwarders.

However, just because the owning function is not needed at runtime,
it may be used during serialization for things like assembly label
creation. Thus, instead of just clearing out the Code's owner field,
we add a new WeakSerializationReference (WSR) object whose target is
the original contents of the owner field. The WSR allows the
serializer to access the original owner, but also signals to the
serializer that the target should not be serialized in AOT snapshots
unless there are additional strong (non-WSR) references.

If no strong references are found, then the references to the WSR
in the snapshot are replaced with a reference to a WSR that only
contains the class ID of the original target. The serializer creates
only one WSR per class ID.

If strong references are found, then the target is still serialized.
In this case, the WSR is dropped entirely and any reference to it is
replaced with a direct reference to the serialized target. Thus, WSRs
only exist in the precompiled runtime for targets with no strong
references.

Changes on the Flutter gallery in release mode:
arm7: total size -1.10%, isolate size -6.08%
arm8: total size -1.16%, isolate size -6.09%

Bug: https://github.com/dart-lang/sdk/issues/41052

Change-Id: I5b435ca71ef85f50fe3484789087471a91aa4fe2
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137104
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-03-30 18:33:48 +00:00
Clement Skau e047ece7e7 [SDK] Fixes stack trace service API tests.
Fixes an issue where stack['asyncCausalFrames'] would be populated in
if --lazy-async-stacks was set.
The field should be filled iff the stack contains an async function -
regardless of whether it's sync-async.

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Ia68f113402962c07a1e9a38ea9320b44140241e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132820
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-22 15:14:58 +00:00
Martin Kustermann 9520235bfe [vm/async] Ensure all service tests run with both, --causal-async-stacks/--lazy-async-stacks
Running all existing tests with/without lazy async stacks ensures that
the existing functionality for --lazy-async-stacks does not regress.

There are still a few smaller things to be done in the debugger for lazy
async stacks.

This CL also ensures:

   * The inner closure, i.e. AsyncClosure/AsyncGenClosure, is not
     inlined if FLAG_lazy_async_stacks is on.

   * Fixes a crash in dartkb mode, when the function of the Bytecode
     object is null.

   * Does a simple integration of the lazy async stacks in debugger.cc -
     to ensure a stack is returned via vm-service.

Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: Ibc1e887a457e2c456ae65d9ed5fa92434f122a32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131825
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-16 12:47:03 +00:00
Martin Kustermann 72f4a831aa Revert "[SDK] Switch to is_sync to identify sync/async running."
This reverts commit 886615d0f9.

Reason for revert:

There was an unexpected slowdown in some async benchmarks, e.g. Calls.AwaitAsyncCall.

Will revert for now and investigate next year.


Original change's description:
> [SDK] Switch to is_sync to identify sync/async running.
> 
> This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988
> 
> Bug: https://github.com/dart-lang/sdk/issues/39525
> Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
> Reviewed-by: Clement Skau <cskau@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=kustermann@google.com,cskau@google.com

Change-Id: I5cda795cbccc01f22e0f8192473c171a4e9fca4b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/39525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129285
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2019-12-20 19:06:54 +00:00
Clement Skau 886615d0f9 [SDK] Switch to is_sync to identify sync/async running.
This should address the regression introduced by https://dart-review.googlesource.com/c/sdk/+/124988

Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: Id163b649bdd0363297c186559fa84ff87f908e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129062
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2019-12-20 11:07:10 +00:00
Clement Skau d5dbf10672 [SDK] Adds non-eager async stack frame collector.
This is done by collecting all frames on the current stack until an async/async* frame is hit
which has yielded before (i.e. is not in sync-async case).
From there on it finds the closure of the async/async* frame and starts traversing the listeners:
  while (closure != null) {
    yield_index = closure.context[Context::kAsyncJumpVarIndex]
    pc = closure.function.code.pc_descriptors.LookupPcFromYieldIndex(yield_index);
    <emit pc in frame>
    closure = closure.context[Context::kAsyncCompleterVarIndex]._future._resultOrListeners.callback;
  }

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: I97030d22e529bf8a74ecd30a8a2589cfe57ad330
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122644
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-26 11:51:27 +00:00
Samir Jindel 6c5033acac Re-land "[vm/async] Don't add an <asynchronous gap> marker along sync-async calls."
Original change is in patchset 1.

The issue was that the expected "_Closure.call" frame is not always present.

Change-Id: I91116861e785a72536dde300f4771de4f6fa9d3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124988
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-14 15:29:16 +00:00
Régis Crelier b5110a59a9 Revert "[vm/async] Don't add an <asynchronous suspension> marker along sync-async calls."
This reverts commit f4d930997b.

Reason for revert: Different tests are failing on different bots.

Original change's description:
> [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
> 
> This fixes `package:stack_trace` in the sync-start case of async/async* calls.
> 
> Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TBR=kustermann@google.com,sjindel@google.com

Change-Id: Ib3e1b303613f0393dac6b1b81e8d1ffb322052b8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124800
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2019-11-11 19:03:54 +00:00
Samir Jindel f4d930997b [vm/async] Don't add an <asynchronous suspension> marker along sync-async calls.
This fixes `package:stack_trace` in the sync-start case of async/async* calls.

Change-Id: I5c41a35283439f533ab19c9fd1cc542931de4b43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124560
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-11-11 16:36:43 +00:00
Ryan Macnak e6574a7964 [vm] Add --show-invisible-isolates.
Useful for profiling the vm-service and kernel-service isolates.

Bug: https://github.com/dart-lang/sdk/issues/38553
Change-Id: I9cc562b5089ad01a5f797799d1105a4a8cf910e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118650
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-09-25 21:41:55 +00:00
Ryan Macnak cfe5e5f075 Include metadata in AOT to expand inline frames in stack traces and provide line numbers.
Also fix stack trace collection to always include invisible frames. It can happen that a visible function is inlined into an invisible function, and we don't expand inlined frames until we print a stack trace.

dart2js product x64:
compile time: 12.459s
VMIsolate(CodeSize): 152292
Isolate(CodeSize): 3343117
ReadOnlyData(CodeSize): 3728928
Instructions(CodeSize): 8677600
Total(CodeSize): 15901937
->
compile time: 14.195s (+13%)
VMIsolate(CodeSize): 174034
Isolate(CodeSize): 3892418 (+16%)
ReadOnlyData(CodeSize): 5036320 (+35%)
Instructions(CodeSize): 8682624
Total(CodeSize): 17785396 (+12%)

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2687143005 .
2017-02-13 10:27:36 -08:00
John McCutchan a0ee5b24db Track async causal stack traces
This CL improves the stack traces that accompany exceptions. Whenever an
async function is entered, we remember how we got there. This is similar
in spirit to package:stack_trace but the implementation is more efficient
and memory usage can be more easily reasoned about.

Tracking causal stack traces:

- [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Before returning from an async function, clear the Thread's asynchronous stack trace.
- [x] After resuming an async function, load the sychronous stack trace prefix into the Thread.
- [x] Filter stack traces to remove async machinery.

Service protocol changes:

- [x] Send causal async stack trace.

Observatory changes:

- [x] Display causal async stack trace below async functions.

Fixes https://github.com/dart-lang/sdk/issues/27661

R=asiva@google.com, rmacnak@google.com

Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing
Review-Url: https://codereview.chromium.org/2646443005 .
2017-02-09 15:39:44 -08:00