Commit graph

1392 commits

Author SHA1 Message Date
Alexander Markov ff34fd8110 [vm/aot/tfa] Tree shake write-only fields
So far tree shaking was removing fields which are not used at all.
This change improves tree shaking of fields so fields
which are only written or used as interface targets can be removed.

The following limitations apply:

* Field is not removed if there is a constant object with that field, as
  it may impact identity of constant objects which is an observable
  behavior.
* Field is not removed if it has a non-trivial initializer as it may
  have side-effects.
* Late final fields are not removed, as writing such fields may have
  side-effect.
* When field is removed, we may need to introduce an abstract getter
  or abstract setter if field is used as a target of an interface call.
  If a field was written, then setter would be non-abstract (but empty).

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

Change-Id: I79c00158b8eb658081a647c5dbdecde481fddb41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134204
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-06 19:31:32 +00:00
Martin Kustermann 5f42db7441 [vm/concurrency] Make some service tests more robust
This is extracted to make the shared heap cl a bit smaller.

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

Change-Id: I2f5b959aefcb2de96f51c39667a18612debd17e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134522
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-02-05 22:02:19 +00:00
Ben Konyi 763bcae067 Reland "[ VM / Service ] Added getClientName, setClientName and requireResumeApproval RPCs"
This reverts commit 37f4a44a27.

Reason for revert: Relanding after infra issues cleared

Original change's description:
> Revert "[ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs"
> 
> This reverts commit 48808f7dce.
> 
> Reason for revert: Unable to approve failures.
> 
> Original change's description:
> > [ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs
> > 
> > Add support for naming VM service clients which allows for resume
> > permissions to be set for all clients of the same name. If a client
> > name requires resume approval, an isolate won't be resumed until all
> > clients which require resume approval have called the `resume` RPC.
> > 
> > Resume approvals can be set for the following pause events:
> > - PauseOnStart
> > - PausePostRequest (issued after `reloadSources(pause: true)`)
> > - PauseOnExit
> > 
> > Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
> > Commit-Queue: Ben Konyi <bkonyi@google.com>
> > Reviewed-by: Siva Annamalai <asiva@google.com>
> > Reviewed-by: Gary Roumanis <grouma@google.com>
> 
> TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com
> 
> Change-Id: I8e60416ad8cbec9ad93f4e34e9bf9af5a516c6dc
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134465
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com

Change-Id: Ibd9d831774e5c4dd500da026f41b173589a9aefd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134415
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-05 18:14:39 +00:00
Ben Konyi 37f4a44a27 Revert "[ VM / Service ] Added getClientName, setClientName and requireResumeApproval RPCs"
This reverts commit 48808f7dce.

Reason for revert: Unable to approve failures.

Original change's description:
> [ VM / Service ] Added `getClientName`, `setClientName` and `requireResumeApproval` RPCs
> 
> Add support for naming VM service clients which allows for resume
> permissions to be set for all clients of the same name. If a client
> name requires resume approval, an isolate won't be resumed until all
> clients which require resume approval have called the `resume` RPC.
> 
> Resume approvals can be set for the following pause events:
> - PauseOnStart
> - PausePostRequest (issued after `reloadSources(pause: true)`)
> - PauseOnExit
> 
> Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Gary Roumanis <grouma@google.com>

TBR=jacobr@google.com,bkonyi@google.com,rmacnak@google.com,asiva@google.com,grouma@google.com

Change-Id: I8e60416ad8cbec9ad93f4e34e9bf9af5a516c6dc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134465
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-02-05 01:13:17 +00:00
Ben Konyi 48808f7dce [ VM / Service ] Added getClientName, setClientName and requireResumeApproval RPCs
Add support for naming VM service clients which allows for resume
permissions to be set for all clients of the same name. If a client
name requires resume approval, an isolate won't be resumed until all
clients which require resume approval have called the `resume` RPC.

Resume approvals can be set for the following pause events:
- PauseOnStart
- PausePostRequest (issued after `reloadSources(pause: true)`)
- PauseOnExit

Change-Id: I7dde3d8aaeccfcf47fa84f1f92159846f1560e16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133621
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2020-02-05 00:02:17 +00:00
Jens Johansen 18c281c624 [observatory] Allow to say 'break package:foo/file.dart:42'
This CL updates the parsing of "break" statements in the debug console
in observatory, as well as handling that the same script can be a part
of several libraries.

Before one could get stuff like this:
$ break package:front_end/src/fasta/scope.dart:389
Function 'package:front_end/src/fasta/scope.dart:389' not found
$ break scope.dart:389
Script 'scope.dart' is ambiguous

The first one is fixes by this CL: We now allow package uris and thus
no longer think it's a function. In this case it wouldn't have mattered
though, it would just say it was ambiguous, as the last case.
This is caused by the same script being found twice. By using a set
instead of a list, that's fixed too.

Change-Id: I3931c8f2abc0a3a5a77cff516da8767037196bf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133593
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-04 08:57:01 +00:00
Jens Johansen c6aa3a22a7 [vm] [debugger] Fix for not breaking in library with mixin
In the VM, a single script can belong to several libraries because of
mixins.

Previously, when setting a breakpoint, it found the function to set the
breakpoint in by taking the "scripts library" (script.FindLibrary) and
then tried to find a function in that library that matched.
Sometimes it found the "wrong" library and the breakpoint thus wasn't
set.

This CL changes that so it goes though all libraries, finds all maching
libraries and tries all of them.

This solves the issue at hand, but might not solve all corner-cases.

This added test demonstrates the resolved case where before it would
just say that it couldn't add the breakpoint on line 13.

Change-Id: Ie44b0dfb4ea3e8de767d1867ec432b2aef429b76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133592
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-04 08:43:21 +00:00
Martin Kustermann 7a6233ad51 [vm] Set Class::is_const() based on final fields instead of generative constructors (which can be shaken by TFA)
This fixes debug assertions in AOT.

Change-Id: Ib688164498ad98d2b7bb4ce574cf6859922df3a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133999
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-01-31 21:38:37 +00:00
Victor Lima b68d95ec9e [vm] Reland support for real unboxed floating point fields in AOT
Issue https://github.com/dart-lang/sdk/issues/40404

Change-Id: Icfa801ff0640a6b27bb3c13d0b737c40452cbf7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133983
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-31 12:56:31 +00:00
Ryan Macnak 38eed7f6d5 [vm, service] Create a treemap from very large heap snapshots outside of the browser.
Usage:
$ dart runtime/observatory/bin/heap_snapshot.dart http://127.0.0.1:8181/q8Zq2o7rEJc=/
...
Wrote file:///tmp/heap-snapshotZWSNFF/merged-dominator.html

Change-Id: I187296b643cdad884209e459f639cfe8bcae6fe4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133861
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-31 02:09:17 +00:00
Zichang Guo 162d6c5634 Revert "[vm] Add support for real unboxed floating point fields in AOT"
This reverts commit 9eb531bde4.

Reason for revert: Bots are red. Some tests are failing.

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-obfuscate-linux-release-x64/6039

https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-android-release-arm_x64/957

Original change's description:
> [vm] Add support for real unboxed floating point fields in AOT
> 
> Non-nullable floating point fields (double, Float32x4, Float64x2)
> are fully unboxed in their classes.
> 
> A bitmap for each class was added to the shared class table in order to keep
> track of the pointers of the classes. Since all classes in Flutter Gallery
> have less than 64 fields, the bitmap is represented by a 64 bit integer and
> fields whose offset is more than 64 words are not unboxed.
> 
> The instance sizes and field offsets might change between target and host
> in cross-compilation, since the number of words used to store unboxed fields
> may differ.
> 
> dart-aot Xeon
> 
>   SplayLatency               -4.62%
>   SplayHarderLatency         -4.17%
>   NavierStokes               -2.20%
>   Tracer                      8.72%
>   ParticleSystemPaint         2.90%
>   NBodySIMD                   8.35%
>   NBody                      25.59%
> 
> With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:
> 
> flutter arm-v8:
> 
>   gallery total size: -1%
> 
>   matrix_utils_transform_rect_perspective   -16.70% (less is better)
>   matrix_utils_transform_rect_affine        -31.82% (less is better)
>   matrix_utils_transform_point_perspective  -24.90% (less is better)
>   matrix_utils_transform_point_affine)      -27.26% (less is better)
>   rrect_contains_bench                      -4.719% (less is better)
> 
> Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
> Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Samir Jindel <sjindel@google.com>

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

Change-Id: Ic73858f6adb7f55c4129d4f46ff4731b378cb634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134020
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-01-30 18:13:28 +00:00
Victor Lima 9eb531bde4 [vm] Add support for real unboxed floating point fields in AOT
Non-nullable floating point fields (double, Float32x4, Float64x2)
are fully unboxed in their classes.

A bitmap for each class was added to the shared class table in order to keep
track of the pointers of the classes. Since all classes in Flutter Gallery
have less than 64 fields, the bitmap is represented by a 64 bit integer and
fields whose offset is more than 64 words are not unboxed.

The instance sizes and field offsets might change between target and host
in cross-compilation, since the number of words used to store unboxed fields
may differ.

dart-aot Xeon

  SplayLatency               -4.62%
  SplayHarderLatency         -4.17%
  NavierStokes               -2.20%
  Tracer                      8.72%
  ParticleSystemPaint         2.90%
  NBodySIMD                   8.35%
  NBody                      25.59%

With hack TFA to make doubles in Rect/Offset/Size classes in flutter non-nullable:

flutter arm-v8:

  gallery total size: -1%

  matrix_utils_transform_rect_perspective   -16.70% (less is better)
  matrix_utils_transform_rect_affine        -31.82% (less is better)
  matrix_utils_transform_point_perspective  -24.90% (less is better)
  matrix_utils_transform_point_affine)      -27.26% (less is better)
  rrect_contains_bench                      -4.719% (less is better)

Change-Id: I9ae09c9c3167d99f9efd071a92937aa51093fd1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131824
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2020-01-30 13:45:08 +00:00
jonahwilliams 96ff3276f4 [vmservice] allow fallback on port bind failure
Work towards https://github.com/flutter/flutter/issues/46724

Background:

on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.

An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.

Overview:

This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind 3 times to a non-zero port, update the port selection to 0.

Results:

Tested locally two dart VMs with the same specified port:

```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection

vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```
Change-Id: I582ab402a457330928e5b490f9718fcd52b56720
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133434
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-01-28 23:36:14 +00:00
Ryan Macnak 155c0d1b92 Reapply "[vm, gc] Sweep non-executable large pages concurrently."
Wait for the concurrent sweeper to visit processing large pages before visiting the card tables during a scavenge.

Bug: https://github.com/flutter/flutter/issues/48360
Bug: b/147582727
Change-Id: Iaec22f05e22d9ded75017aa1d8463c1be64858aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131703
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-27 19:43:09 +00:00
Jonah Williams cdeb9a7a8c Revert "[vmservice] allow fallback on port bind failure"
This reverts commit 6ff7e9ebad.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [vmservice] allow fallback on port bind failure
> 
> Work towards https://github.com/flutter/flutter/issues/46724
> 
> Background:
> 
> on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.
> 
> An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.
> 
> Overview:
> 
> This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind once to a non-zero port, update the port selection to 0.
> 
> Results:
> 
> Tested locally two dart VMs with the same specified port:
> 
> ```
> jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
> Observatory server failed to start after 1 tries
> Falling back to automatic port selection
> vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
> Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
> ```
> 
> Change-Id: I371583edcb603325428f1cb760992e39b9f3b6dc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130441
> Commit-Queue: Jonah Williams <jonahwilliams@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,jonahwilliams@google.com

Change-Id: I337b2d549e33ef9c616c276a48ce894a14b1c317
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133327
Reviewed-by: Jonah Williams <jonahwilliams@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2020-01-24 21:47:34 +00:00
Alexander Markov 37b74bd1a3 Cleanup status file entries for service/dartkp crashes
Issue: https://github.com/dart-lang/sdk/issues/40275
Change-Id: I78e5a8843e36599cbac8b2f838d3e11d9f63ba93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133301
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-01-24 20:29:23 +00:00
jonahwilliams 6ff7e9ebad [vmservice] allow fallback on port bind failure
Work towards https://github.com/flutter/flutter/issues/46724

Background:

on the latest versions of iOS today, we have to use mdns to discover the observatory port and authentication code. For a variety of reasons this can fail, leaving us with no way to connect.

An alternative approach is to specify the observatory port and disable the authentication code. If binding to this port fails, however, we would still like to attempt connecting with mdns.

Overview:

This adds a new flag to the dart SDK, --enable-service-port-fallback. This amends the behavior of the vmservice with a specified port. After failing to bind once to a non-zero port, update the port selection to 0.

Results:

Tested locally two dart VMs with the same specified port:

```
jonahwilliams@jonahwilliams0:~/Documents/engine/src/out/host_debug_unopt$ ./dart --enable-service-port-fallback --observe=8080 example.dart
Observatory server failed to start after 1 tries
Falling back to automatic port selection
vm-service: isolate(2785434094928835)  'main' has no debugger attached and is paused at exit.  Connect to Observatory to debug.
Observatory listening on http://127.0.0.1:45663/62A5IHjmv9E=/
```

Change-Id: I371583edcb603325428f1cb760992e39b9f3b6dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130441
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-24 20:28:15 +00:00
Clement Skau da1e42a11c [SDK] Fixes async* stack unwinding.
For `foo() async* {}` frames we find the "caller" by finding out
what closure is registered as listener on the _AsyncStreamController.

There can be two cases:

a) The caller does a regular `foo().listen((_) {})`:
  The stack trace will have the closure as the caller and unwinding stops.

b) The caller uses 'await for (... foo())':
  In this case the listener will be a StreamIterator.

This CL changes our unwinding code to get the awaiter of `await it.moveNext()`.


Bug: https://github.com/dart-lang/sdk/issues/39525
Change-Id: I13f76025a15682aaf55fd968088fc2059982d842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132841
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-01-24 09:04:56 +00:00
Ryan Macnak c359b5943a [vm, service] Fix and enable more services tests.
Change-Id: I3e96b3fdcb30def43c7b87183a925bd1668fb6a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133087
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-24 01:59:01 +00:00
Ryan Macnak 171c5b3977 [vm, service] Fix race in Service.controlWebServer / getInfo.
Bug: https://github.com/dart-lang/sdk/issues/40274
Change-Id: I9eed6a2f019d6452d28a4d1f88760f9aeb5a0d7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132972
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-23 22:23:19 +00:00
Ryan Macnak 3aabdc8d23 [test] Run some service tests in AOT.
Tests involving breakpoints, stepping, evaluation or coverage are expected to fail.
Tests involving introspection, heap analysis, extensions, timeline events or profiling are expected to pass.

 - Fix crash when `debugger` is called.
 - Fix crash when metrics are queried.
 - Replace unnecessary use of `eval` with `invoke`, allowing more tests to run on AOT, AppJIT and simulators.

Bug: https://github.com/dart-lang/sdk/issues/40274
Bug: https://github.com/dart-lang/sdk/issues/40275
Change-Id: I3023af7cbfda745238c487d9a3a3a99e56a30244
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132942
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-23 17:52:40 +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
Ryan Macnak edf0de533c [observatory] Progress on making heap snapshot analysis a public library.
- Clean up loading flow.
 - Replace manual iterators with generator functions.
 - Produce clearer messages when running out of memory.
 - Make various implementation functions and constants private.

Change-Id: I9e016b37552e3110baf00f3052b131dc0d79b748
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132027
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-17 18:40:14 +00:00
Alexander Aprelev e2aadc7a07 Reland "[vm/fieldtable] Move current field values out of Field object into separate table."
This reverts commit c8f8c11b70 with the fix for https://github.com/flutter/flutter/issues/49008 in Patchset 2.

Change-Id: I85406b92a69ed950d0ba945f96997658be3cae64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132302
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-01-17 18:12:24 +00:00
yuanhuihui 72b0501791 Support timeline conversion to iOS platform trace
using Instruments to track these events.

Signed-off-by: yuanhuihui <gityuan@gmail.com>
Bug: https://github.com/dart-lang/sdk/issues/40076
Change-Id: I590081c516923f82a2a3dbf4b109afe75b8f5fc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131360
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-17 18:10:04 +00:00
Alexander Aprelev c8f8c11b70 Revert "[vm/fieldtable] Move current field values out of Field object into separate table."
This reverts commit 85e396a1de as it broke internal app running on android arm in release mode.

Change-Id: Iaff0cf3c1ef859e35b4eaeb3ac8243ce3c6737b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132168
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-01-17 00:24:20 +00:00
Ryan Macnak 16c3cebab6 [observatory] Handle some larger heap snapshots.
Don't flatten snapshot chunks into a linear byte array to avoid a 2GB limit in JS. The lifts the largest snapshot we can handle to either 2^32 objects or the memory limit in JS.

Change-Id: I1a3ec03cf83cb03b4cf67245b12560a083a6e5b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131943
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-16 18:41:07 +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
Ryan Macnak 67f3cf325d Revert "[vm, gc] Sweep non-executable large pages concurrently."
Race between sweeper and scavenger accessing card tables.

This reverts commit 4f1270655c.

Bug: b/147582727
Change-Id: I824f8ddbbd48bd69bda565b4ead0238b57482ef9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131422
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-01-13 20:26:06 +00:00
Teagan Strickland 4cb8816892 [gardening] Also ignore OSError in verify_http_timeline_test.
Namely, we can get "Connection reset by peer" OSErrors when calling
executeWithRandomDelay, and these are not covered by the current list
of ignored exception classes in this function.

This closes https://github.com/dart-lang/sdk/issues/39568.

Change-Id: I033352177bfd38de5f8ace452ef97d2311076d73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126731
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Teagan Strickland <sstrickl@google.com>
2020-01-13 09:39:54 +00:00
Ryan Macnak 4f1270655c [vm, gc] Sweep non-executable large pages concurrently.
In some workloads, the heap is mostly large pages.

Move large executable pages from the large list to the executable list. They do not require special treatment because they are large during sweeping because we never truncate an Instructions object. They still require being swept immediately because they are executable so that code protections can be flipped before resuming Dart execution.

Fix off-by-one errors in SnapshotGraph.objects and SnapshotClass.instances discovered as a result of the large page list changing from prepending to appending.

Bug: https://github.com/flutter/flutter/issues/48360
Change-Id: If6d9137fd36c9b18205493166d586b9a7cee4b1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130823
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-10 21:12:51 +00:00
Alexander Aprelev cc97ddeb0f [vm/gardening] Fix service/isolate_lifecycle_test.
The test has invalid expectation that if the isolate has property 'paused' set to 'true', it means the isolate is paused at exit. In reality the 'paused' property can be set to 'true' if the isolate is not runnable yet.

Fixes dartbug.com/24174

Change-Id: I3a2c5519f0ae448fbcacff46c8aa8f64406ef796
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130980
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-01-10 00:42:57 +00:00
Ryan Macnak a67fd37193 [observatory] Visualize differences between two heap snapshots.
Display progress when loading a snapshot from a file.

Change-Id: I6802998308c0b6c552ffea76439fe18edd34c99c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130460
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-08 18:55:51 +00:00
Ryan Macnak 5b8c4e8024 [vm, service] Speed up generation and transmission of heap snapshots.
- Remove server-side transmission bottleneck in WebSocket compression.
 - Remove client-side transmission bottleneck in response inflation.
 - Remove generation bottleneck and memory overhead of WeakTables by using a finger table.

On dart2js self compile, 1.5GB heap, 400MB heap snapshot
Time to generate and transmit:    46 -> 5s
Auxiliary memory for WeakTables: 537 -> 1.5MB

Change-Id: Ia58e2ffb942e5d29536e175d9caedd2bf835981a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130621
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-01-08 03:22:59 +00:00
Alexander Aprelev 85e396a1de [vm/fieldtable] Move current field values out of Field object into separate table.
This is to support sharing of Field objects between isolate group's isolates.

Each isolate will have it's own field table with static instances/values.
field_table is stored on isolate, copied over to thread for easier access.

This also removes the write barrier from static field assignments; the field table is a GC root.

Bug: https://github.com/dart-lang/sdk/issues/37835
Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: I232a86f059ac4cacc3e9f54bcc31d1d0524f9496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127582
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-01-06 18:58:11 +00:00
Ben Konyi 93c9ebabd6 [ VM / dart:io / Service ] Add service extension RPCs to dart:io to allow for HttpClient.enableTimelineLogging to be set remotely.
It isn't possible to do this with evaluate since we are unable to access
classes from private libraries exposed through dart:io like dart:_http.

Change-Id: I3d4168d919dbcf5008da60b14165fd9b89f22cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129322
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-26 23:23:34 +00:00
Ben Konyi 017ea8b54a [ VM / dart:io ] Added lastReadTime, lastWriteTime to socket profiling
Change-Id: I8dc7c271b44bdecf5fcc081c1324ce809ca9c140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129562
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-12-26 16:22:34 +00:00
yuanhuihui 006f611a2b support more sync event when use systrace to record timeline event
sync event is not included in the systrace, such as Timeline.startSync.
more detail, see https://github.com/dart-lang/sdk/issues/39727

Signed-off-by: yuanhuihui <gityuan@gmail.com>
Bug: issues/39727
Change-Id: I21de32d517c9cbc7c00a12d69bdcb77df572f8db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127921
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-12-20 23:37:07 +00:00
Jens Johansen 8d11c1dce6 [kernel][vm] Add uris only from mixins to libraries sourceReferences
index to fix VMs coverage issue

This CL fixes the VM not always reporting coverage for mixin usages
properly.

* When asking the VM for coverage you can do it in one of two ways
  * Ask the VM for coverage for everything; or
  * Ask the VM for coverage for a specific script
* Asking the VM for coverage for everything works perfectly fine.
  The VM goes through everything and reports coverage correctly.
* Asking the VM for coverage for a specific script (which is, at least
  now, what the flutter tools does) doesn't work in the simple mixin
  case described at http://dartbug.com/39779: The VM goes through the
  libraries, asking for the list of scripts they "know about",
  and checks for matches against what you asked for.
  In this case, when asking for 'master.dart', the library for
  'lib.dart' says no when it shouldn't --- because of the way the mixin
  transformation works the content is actually in lib.dart.

This CL updates the content of the field 'sourceReferences' on Library
to fix the issue.


Fixes #39779

Change-Id: I0c38a323c81d1784ade704837b67ece549fc95d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128585
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-12-19 06:59:28 +00:00
Jason Simmons 09ecfca470 [observatory] Use month numbers ranging from 1-12 in the timeline default filename
Change-Id: I6184efa1e4d7d64e3f0fc4def14587898d29601a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128983
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2019-12-18 23:17:11 +00:00
Ryan Macnak 98da22a11f [observatory] Display process-wide memory usage with heap snapshots.
Include major memory users known to the VM: isolate heaps, profiling buffers, timeline buffers.

Change-Id: I2580ad74b5d4d07c5c75fde28bb7a5d71fddb09b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127382
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-12-07 00:28:15 +00:00
Ryan Macnak 80aa5fda4b [observatory] Account for external size in the "Classes (table)" and "Classes (treemap)" views.
Mechanically, this renames shallowSize to internalSize and redefines shallowSize as internalSize + externalSize.

Change-Id: I734f5714ad6dff341627e3d6e51e3bdcf26c63ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125993
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-12-06 23:20:04 +00:00
Ryan Macnak f4e44dd705 [vm] Make kernel buffers live exactly as long as their derived views.
When creating a KernelProgramInfo, we create several logical views into the kernel buffer. These are fresh ExternalTypedDatas, rather than proper TypedDataViews, so they do not automically keep the original ExternalTypedData alive. Create an explicit reference to the orginal ExternalTypedData in the KernelProgramInfo. When creating snapshots, this reference is ignored/null'd and the views are turned into copies, effectively dropping the parts of the original buffer that do not have views.

Fixes a leak with reload and a use-after-free with eval.

Bug: https://github.com/dart-lang/sdk/issues/33973
Bug: https://github.com/dart-lang/sdk/issues/39610
Change-Id: I09d3830133314ccbaa0341d904127c2b6925c4ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126825
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-12-03 22:00:48 +00:00
Zichang Guo bf69257c5f [dart:io] socket profiler in dart:io
Add socket profiler functionality through service extension.

Change-Id: I717b72fbb1c53503dfb8fa08789417c18300565d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124582
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-12-02 19:11:18 +00:00
Ben Konyi c2c716d0c5 [ Observatory ] Fix issue where timeline would hang if CPU profiling was disabled.
When CPU profiling is disabled, the getCpuSamples RPC would return with
a ServerRpcException stating that the profiler was disabled. This wasn't
being caught when the RPC was invoked, but was being caught in
`ObservatoryApplication` and swallowed. This resulted in the timeline
page being stuck at the timeline loading dialog.

Also includes fixes from "[observatory] Properly wait for Catapult's iframe to load. Give
message while fetching timeline.", commit 3b99524167, which was reverted.

Change-Id: I2fe23d4dba5e20f717e111c519563866bb1a221c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-11-26 22:00:20 +00:00
Ben Konyi 3b99524167 Revert "[observatory] Properly wait for Catapult's iframe to load. Give message while fetching timeline."
This reverts commit b3cf5ef327.

Reason for revert: Breaking timeline view for users in Google3

b/141889413
b/145128403

Original change's description:
> [observatory] Properly wait for Catapult's iframe to load. Give message while fetching timeline.
> 
> Change-Id: I342c9315fc31021fb1387bc0e409645cd7a99d6a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125468
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

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

Change-Id: I38b92a5a50955983369f4de7afb577d1a959e724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126360
Reviewed-by: Ben Konyi <bkonyi@google.com>
2019-11-26 15:49:53 +00:00
Ryan Macnak b3cf5ef327 [observatory] Properly wait for Catapult's iframe to load. Give message while fetching timeline.
Change-Id: I342c9315fc31021fb1387bc0e409645cd7a99d6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125468
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-11-20 19:55:31 +00:00
Ben Konyi cfd226a27f [ dart:http ] Fix issue where setting HttpClient.enableTimelineLogging wasn't actually enabling timeline logging
Change-Id: I12134eaf1cd79516376d266b9919535987f7703b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125565
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2019-11-18 22:17:55 +00:00
Ben Konyi 1c12878d05 [ dart:io ] Added timeline events for HttpClient connections and requests
Setting the `enableTimelineLogging` property of `HttpClient` to true results in
timeline events being created for HTTP connections and HTTP requests.
Timeline events contain general connection information, including:
  - Request type
  - Status code
  - Request / response headers
  - Cookies
  - Non-sensitive proxy information
  - Relevent error messages for failed connections

Change-Id: Ibe16a312ab5398c9ae886ea07bea5ca70b63e440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123540
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-11-16 00:46:46 +00:00
Ryan Macnak 545b10389d [vm, service] Compute allocation stats on demand, instead of during allocation and GC.
Removes support for accumulators, which now repeat the current live values.
Decreases performance difference between release and product modes.
Fixes inaccuracy when counters are queried before the first full GC.

Golem geomean   x64 4.687%
Golem geomean arm64 5.770%

Bug: https://github.com/dart-lang/sdk/issues/37678
Change-Id: I12b26a9834b0f0f911ddcc6e8e5ff4573272607d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116885
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-11-16 00:22:56 +00:00