Commit graph

1722 commits

Author SHA1 Message Date
Ryan Macnak b11340bc4a [test] Skip service tests on Linux ARM64.
TEST=ci
Change-Id: I4277a4f4f2c3bd9dedd9e325167b67130b5afc2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319260
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-08-09 15:32:13 +00:00
Alexander Markov 286e5761e3 [gardening] Skip slow vm/dart/awaiter_stacks/sync_async_start_pkg_test_test on hot reload bots
This test is flaky and timing out on hot reload bots.

Change-Id: If0c9574ac80405d14765e4ada4fdee8e6bce9d79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319001
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-08-08 15:40:49 +00:00
Ryan Macnak 6d4573aced [test] Skip high-memory tests on Linux ARM64.
Bug: https://github.com/dart-lang/sdk/issues/52589
Bug: https://github.com/dart-lang/sdk/issues/53138
Change-Id: Iaf6e499d80726b5ec8a810a5d3bd1d90a0d93af9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318800
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-08-07 17:58:07 +00:00
Ryan Macnak cac1319768 [vm, gc] Run weak processing in parallel for new-space GCs.
Allow updating weak handles etc to happen in parallel with work-stealing.

Also make LocalBlockWorklist more symmetric with BlockWorklist.

Cf. 4495c2b30a

TEST=ci
Change-Id: Id58fe16be92028b1aa4dd8f097769b4107f2a3f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316043
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-26 16:45:01 +00:00
asiva 08b76a50fc [VM/Runtime] - Turn on reachabilityBarrier in product mode.
Fixes https://github.com/dart-lang/leak_tracker/issues/25

TEST=ci (existing test has been turned on for product mode)

Change-Id: I8ead4924846947016998c9c8870b5a0c851f0185
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315981
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-07-24 22:44:39 +00:00
Ryan Macnak 41548aa698 [test] May rarely reach OOM without an aborted scavenge.
Whether the reordered objects fail to fit depends non-deterministically on the parallel worker speeds and the exact contents of new-space that vary with each VM or core library change.

Bug: https://github.com/dart-lang/sdk/issues/52936
Change-Id: I6e287d42b5ca77d2ffafd9a5a053118617d6fe51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313940
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-24 16:50:48 +00:00
Alexander Aprelev a5936e404b [vm] Include field and local names in isolate invalid object retaining path message.
Retrieval of local names only works in JIT as it relies on availability of LocalVarDescriptors.

For example, for this
```
import 'dart:isolate';

foo() {
  final x = RawReceivePort();
  RawReceivePort().sendPort.send(() => print("$x"));
}

main() {
   foo();
}
```

error message says
```
Unhandled exception:
Invalid argument(s): Illegal argument in isolate message: (object is a ReceivePort)
 <- field x in foo.<anonymous closure> (from file:///usr/local/google/home/aam/p/d/dart-sdk1/sdk/s1.dart)
```

Bug: https://github.com/dart-lang/sdk/issues/52957
TEST=ci
Change-Id: I684014fd19ea82829e7df17a8a67d386551a5a82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314501
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-07-19 19:58:18 +00:00
Alexander Aprelev 3284c68727 [gardening] Add 'previous-results' option to run_stress_test_shards.dart
Follow-up to https://dart-review.googlesource.com/c/sdk/+/314081
TEST=ci

Change-Id: Ib65a81738cb4b22531765a73becdc9cf7c836ee8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314840
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-07-19 17:34:53 +00:00
Ryan Macnak 327d425a32 [test] Skip chunked_binary_trees tests on slower configurations.
Bug: https://github.com/dart-lang/sdk/issues/52924
Change-Id: Iece24184411f1fdbc63903d893654c74aed3de55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313289
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-13 21:49:08 +00:00
Ryan Macnak d486c52ff6 [vm, gc] Add flag to disable write barrier elimination.
TEST=ci
Change-Id: Ibf1c8afc21c695c1e959ee7463110dd2c37ed846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311822
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-12 15:46:27 +00:00
Ryan Macnak 0ff8d76171 [test] Speed-up slow isolate tests.
- Don't need to repeatedly verify function fingerprints for each isolate.
 - Fix test detecting when it runs under debug mode or a simulator.

Change-Id: Iace0ebc274d4c01561a4b563a420e80535b1ff59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313243
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-07-11 22:39:28 +00:00
Ryan Macnak b050ec9449 [vm, compiler] Honor --no_inline_alloc in suspend state and record stubs.
TEST=ci
Change-Id: Iae70a0edd776d88f2e26783d7348f2e5daf25ad9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312080
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-07-10 22:03:08 +00:00
Ryan Macnak 99ef36064f [infra] Make the sanitizer a first-class status variable.
Makes the TSAN skips apply to
 `test.py -mrelease --sanitizer=tsan`
and not just
 `test.py -n vm-tsan-linux-release-x64`.

Also makes the timeouts agree.

Change-Id: I10315e754a4ebb3020f3c2f6cecfac6b77e77a9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311828
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-07-10 17:46:31 +00:00
asiva abcbcd42cb [Status Files] Update status files to account for the following
- https://github.com/dart-lang/sdk/issues/45128 - test computes the
  script url incorrectly when run in an app-jit scenario

- https://github.com/dart-lang/sdk/issues/51304 - test has some long
  iterations (1000 x 1000) and takes longer on the simulator
  architectures causing timeouts

TEST=ci

Change-Id: Iebde161177a442a2288ccc5d879139099c241a4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312888
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-07-10 17:42:04 +00:00
Martin Kustermann daa35fd4fd [gardening] Restore timout multiplier in test runner for linux-arm64
The timeout multipiler for linux-arm64 was originally 4, then lowered to
1 (see [0]), then increased again to 2 (see [1]).

Though it seems that service tests are still flakily timing out, so
let's try restoring the original multilier.

[0] https://dart-review.googlesource.com/c/sdk/+/306662
[1] https://dart-review.googlesource.com/c/sdk/+/307972

Also special case `ia32` in timeout calculations due to not using
an AppJIT trained `kernel-isolate` snapshot and therefore being
very slow, especially in ia32-debug mode.

Issue https://github.com/dart-lang/sdk/issues/52589
TEST=ci

Change-Id: Iab8c768866aec9e77bb83c7a3242cc5de8fb4e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312905
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-07-10 12:02:16 +00:00
Martin Kustermann 9b9a8cf042 [gardening] SkipSlow dart/regress_52703_test in hot-reload test mode
The test is flakily timing out in hot-reload test mode.

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

TEST=ci

Change-Id: I466e1997aa691921d38a672f293b2a7e97df36aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312904
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-07-10 10:14:07 +00:00
Sergio Martins ea8485e967 [vm] Make Finalizer.attach assert if value is passed as token
It's not supported, as it would prevent the value from being
garbage collected, defeating the purpose of Finalizer.

Not sure if an exception is worth it, so added the assert
as suggested in the bug tracker.

TEST=vm/dart{,_2}/finalizer/finalizer_attach_checks_token_test

Bug: #52731
Change-Id: Id7b457ca1a95e71c1a43d2d2c8569c35659952b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311020
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-07-04 08:28:14 +00:00
Daniel Bali a3e84160ec Expand collection of object instances.
TEST=vm/dart/analyze_snapshot_binary_test

Change-Id: I96ef5d8fc92292151444e52d189e6b2d10a99375
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308303
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-07-03 12:29:15 +00:00
Vyacheslav Egorov a52f2b9617 [vm] Rework awaiter stack unwinding.
The main contribution of this CL is unification of disparate
handling of various functions like `Future.timeout`,
`Future.wait`, `_SuspendState.createAsyncCallbacks` and
`_SuspendState._createAsyncStarCallback` into a single
`@pragma('vm:awaiter-link')` which allows Dart developers
to specify where awaiter unwinder should look for the next
awaiter.

For example this allows unwinding to succeed for the code like this:

    Future<int> outer(Future<int> inner) {
      @pragma('vm:awaiter-link')
      final completer = Completer<int>();

      inner.then((v) => completer.complete(v));

      return completer.future;
   }

This refactoring also ensures that we preserve information
(including Function & Code objects) required for awaiter
unwinding across all modes (JIT, AOT and AOT with DWARF stack
traces). This guarantees users will get the same information
no matter which mode they are running in. Previously
we have been disabling awaiter_stacks tests in some AOT
modes - which led to regressions in the quality of produced
stacks.

This CL also cleans up relationship between debugger and awaiter
stack returned by StackTrace.current - which makes stack trace
displayed by debugger (used for stepping out and determinining
whether exception is caught or not) and `StackTrace.current`
consistent.

Finally we make one user visible change to the stack trace:
awaiter stack will no always include intermediate listeners
created through `Future.then`. Previously we would sometimes
include these listeners at the tail of the stack trace,
which was inconsistent.

Ultimately this means that code like this:

    Future<int> inner() async {
      await null;  // asynchronous gap
      print(StackTrace.current); // (*)
      return 0;
    }

    Future<int> outer() async {
      int process(int v) {
        return v + 1;
      }

      return await inner().then(process);
    }

    void main() async {
      await outer();
    }

Produces stack trace like this:

    inner
    <asynchronous suspension>
    outer.process
    <asynchronous suspension>
    outer
    <asynchronous suspension>
    main
    <asynchronous suspension>

And when stepping out of `inner` execution will stop at `outer.process`
first and the next step out will bring execution to `outer` next.

Fixes https://github.com/dart-lang/sdk/issues/52797
Fixes https://github.com/dart-lang/sdk/issues/52203
Issue https://github.com/dart-lang/sdk/issues/47985

TEST=ci

Bug: b/279929839
CoreLibraryReviewExempt: CL just adds @pragma to facilitate unwinding
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-dwarf-linux-product-x64-try
Change-Id: If377d5329d6a11c86effb9369dc603a7ae616fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311680
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-06-30 14:03:03 +00:00
Ryan Macnak ac77af1c07 Group the GC tests into a common directory.
The makes it possible to run just these tests with `test.py vm/gc/`.

Change-Id: Ied4aa0b2fb045c19b1aced68f58a1ef195a5df8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311145
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-06-29 17:27:48 +00:00
Alexander Markov dc30f815f1 [vm] Inline local functions declared in outer functions
Previously, inliner was able to inline closure calls only when closure
was allocated in the current function (or in a function which was
inlined so far). This is not true for local functions declared in outer
functions (they are allocated at declaration site).

Now, when calling local functions, target of closure call is always
known regardless of where the function is declared, so calls to local
functions can be inlined.

TEST=runtime/tests/vm/dart/inline_local_functions_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52695
Fixes https://github.com/dart-lang/sdk/issues/15558

Change-Id: I0e51dbaf63a6d4427bff366b40414ca5fac3d418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311465
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-06-27 19:42:15 +00:00
Slava Egorov 758727dd12 [vm] Rename tests causal_stacks -> awaiter_stacks and improve harness.
The main difference from the previous harness is that it
allows auto updating the expectations instead of
maintaining them manually.

This relands 0c1b2722ed with
changes to harness which fix issues on Windows.

Note: some amount of AOT failures are expected and should just
be approved. They will be fixed with the last CL in the series.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-win-release-x64-try
Change-Id: I7ae84769ed54bc447ebf71acc68ba9d0b6717bac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311604
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-06-27 11:50:32 +00:00
Tess Strickland 516f238aa6 Revert "[vm] Rename tests causal_stacks -> awaiter_stacks and improve harness."
This reverts commit 0c1b2722ed.

Reason for revert: Failures on AOT (stack expectations unmet) and Windows (parse errors due to Windows paths) trybots.

Original change's description:
> [vm] Rename tests causal_stacks -> awaiter_stacks and improve harness.
>
> The main difference from the previous harness is that it
> allows auto updating the expectations instead of
> maintaining them manually.
>
> TEST=ci
>
> Change-Id: I80e303d3ecbcc834ac94fa089cabe4f8834cc661
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311400
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Slava Egorov <vegorov@google.com>

Change-Id: I7311bf08403f4167f88f6204fde1a6fdee353f7d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311600
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-06-27 09:02:28 +00:00
Tess Strickland 1df39e243a [gardening] Marking test that creates several snapshots slow on TSAN.
Change-Id: Iba88e9807a7d58d17fe6b2cf103d0f18fe7dbef5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311580
Auto-Submit: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-06-27 08:04:31 +00:00
Vyacheslav Egorov 0c1b2722ed [vm] Rename tests causal_stacks -> awaiter_stacks and improve harness.
The main difference from the previous harness is that it
allows auto updating the expectations instead of
maintaining them manually.

TEST=ci

Change-Id: I80e303d3ecbcc834ac94fa089cabe4f8834cc661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311400
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-06-27 07:47:39 +00:00
Tess Strickland 97a09b90c8 [sdk] Add NativeRuntime.buildId to dart:developer.
TEST=vm/dart/build_id

Issue: https://github.com/dart-lang/sdk/issues/51941
CoreLibraryReviewExempt: Native runtime only API
Change-Id: Ib3757480f0eab6d147385a87adf657f4f709ec4e
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-product-x64-try,vm-aot-win-debug-x64c-try,vm-aot-android-release-arm_x64-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307122
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-06-22 11:11:11 +00:00
Tess Strickland 24ad7f9000 [vm/tests] Skip vm/cc/TypeArguments_Cache_ManyInstantiations on qemu.
This is just a larger version of another test
vm/cc/TypeArguments_Cache_SomeInstantiations, which does run on
qemu and tests the same paths, so it's okay to skip.

TEST=vm-linux-release-riscv64-qemu

Change-Id: Ie39665c818cc95c934582383b5e57d77f539f46d
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-riscv64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310680
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-06-21 14:43:25 +00:00
Alexander Markov 66f1611fee [vm] Deoptimize code if can-be-Future property of a class changes due to dynamic loading
Sometimes compiler omits type checks for the 'await' and 'return from
async' by relying on the fact that certain classes cannot hold
instances of Future.

In JIT mode, the property 'class-can-be-Future' may change when a new
class is loaded dynamically (e.g. through IsolateMirror.loadUri).

In such a case, the generated code assuming that certain class
cannot be Future should be correctly deoptimized.
This CL implements this deoptimization by adding such classes into
the list of CHA guarded classes.

TEST=runtime/tests/vm/dart/await_type_check_with_dynamic_loading_test.dart

Change-Id: Ib3a3768d073e8562b794186e72cb9d61e9f496fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309822
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-06-20 17:17:34 +00:00
Martin Kustermann ef97228d03 [vm] Make vm/dart/regress_52703_test work on android
Closes https://github.com/dart-lang/sdk/issues/52739

TEST=vm/dart/regress_52703_test on Android

Change-Id: Ia568044d6663483e446c1945de70298c5bc111fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310281
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-06-20 13:31:29 +00:00
Daco Harkes 1bc47181f2 [test] Fix line number expectation
Because of the `// @dart = 2.9` comment, everything is two lines down.

TEST=runtime/tests/vm/dart_2/checked_parameter_assert_assignable_stacktrace_test.dart

Closes: https://github.com/dart-lang/sdk/issues/52737
Change-Id: If2b4d22f933ed975a0623eb6d8e2f6c674bf9177
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309901
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-06-20 13:26:55 +00:00
Jens Johansen 12d0d34b00 [VM] Add token position to type argument AssertAssignable call
This CL adds the token position of the checked parameter when doing the
AssertAssignable for better stacktraces when it fails.

E.g.

```
$ cat t.dart
class A {
  void takesA(A a) {
    print("Hello A");
  }
}
class B extends A {
  void takesA(covariant B b) {
    print("Hello B");
  }
}

void main() {
  A a = new A();
  A b = new B();
  b.takesA(b);
  b.takesA(a);
}
```

Before fix:

```
$ out/ReleaseX64/dart t.dart
Hello B
Unhandled exception:
type 'A' is not a subtype of type 'B' of 'b'
#0      B.takesA (file:///path/to/t.dart)
#1      main (file:///path/to/t.dart:16:5)
[...]
```

With fix:

```
$ out/ReleaseX64/dart t.dart
Hello B
Unhandled exception:
type 'A' is not a subtype of type 'B' of 'b'
#0      B.takesA (file:///path/to/t.dart:7:27)
#1      main (file:///path/to/t.dart:16:5)
[...]
```

TEST=runtime/tests/vm/dart/checked_parameter_assert_assignable_stacktrace_test.dart

Change-Id: I6409f6d9c41e9825391957f0df2b92b48ed0eb7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302203
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-06-19 11:32:27 +00:00
Martin Kustermann 3dd9389c1f [vm] Fix leakage of file system watcher related data structures
Closes https://github.com/dart-lang/sdk/issues/52703

TEST=runtime/tests/vm/dart/regress_52703_test.dart

Change-Id: Ia76c721a3d3a1466ed1c2e7bd847c331cee95ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309862
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-06-16 12:08:43 +00:00
Martin Kustermann ddc236ba64 [vm] Add @pragma('vm:keep-name') annotation
This allows us to keep symbol names for classes/methods/fields - even if
obfuscation is enabled, but has no other effect on tree shaker / ...

For go/dart-ama

TEST=vm/dart/keep_name_pragma_test

Change-Id: I66c0fc32217d9180f821658bae463f2c1d7fb1af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309740
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
2023-06-16 10:22:23 +00:00
Tess Strickland c93c5bdd88 [vm] Use hash-based caches for large SubtypeTestCaches.
We use specialized type testing stubs in `as` checks to quickly answer
whether the type of an object is assignable to a given type. However,
perfect specialization of the type testing stub is not possible in all
cases. Thus, we use SubtypeTestCaches (STCs) to cache the result of
checking assignability in the runtime to avoid repeated runtime calls
for the same check.

Previously, the STC was linear and capped at 100 entries. This cap was
for two reasons:

* STC are created per `as` check, not per checked type, so there could
  be many STCs created for a given type if assignability to that type
  is checked many times throughout the code.
* STC were strictly linear, and thus eventually the cost of
  traversing the cache outweighs the cost of returning a false
  negative that requires going to the runtime and doing the check there.

This CL provides a partial solution to the second reason by performing
similar work to that done for instantiation caches in TypeArguments
(4f925105), where the STC is linear up to a certain threshold, and then
converted to a hash-based STC. Like that CL, only the runtime currently
handles the lookup of cached results in hash-based STCs, with the
changes needed for the `SubtypeNTestCacheStub`s coming in a followup CL.

Since the stubs have not yet been adjusted, we keep the maximum size of
linear caches the same at 100, and allow hash-based STCs to grow to a
maximum size of 1000 since the STCs are still created per `as` check.
This means once the STC has grown over 100 entries, all STC checks
require a runtime call, but for checks cached in the STC, the answer is
found and provided without either doing the slower full runtime check
for assignability and without an attempt to respecialize the type
testing stub when applicable.

Our benchmarks generally see at most a ~2-5% performance regression for
cases where the STC remains linear (except for on the Raspberry Pi 4, where the hit ranges from ~25%-40%), but a performance improvement of
~500-1300% for cases where the STC is converted to a hash table.

TEST=vm/cc/TTS_STC_{Some,Many}Asserts

Change-Id: Ie8629708b5c12fa8464359a2f77c6da56ba46c0c
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-release-ia32-try,vm-linux-debug-x64c-try,vm-linux-debug-x64-try,vm-linux-debug-simriscv64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-tsan-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284682
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-06-13 09:53:12 +00:00
Ryan Macnak baf2163e19 [test] Don't try to query RSS under QEMU.
It appears either the effects of madvise(DONTNEED) aren't emulated or we're confounded by the memory usage of the emulator itself.

Bug: https://github.com/dart-lang/sdk/issues/52653
Change-Id: I14d5efabb7413ed14ddc60426a3e7e4a796f3a60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308740
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2023-06-12 18:16:21 +00:00
Tess Strickland dfce3aa0ff [vm] Attempt to retrieve build ID or UUID from the loaded snapshot.
For direct-to-ELF snapshots, the story remains the same as before,
as we use the information from the Image header if available.

If it isn't, then we fall back to dladdr to get the dynamic shared
object containing the app snapshot and then walk the ELF or Mach-O
headers to find the build ID or UUID information.

TEST=vm/dart/use_dwarf_stack_traces_flag

Issue: https://github.com/dart-lang/sdk/issues/51941
Change-Id: I3705ed244d1b4a1255e75fffd238a29fc2a60800
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-product-x64-try,vm-aot-win-debug-x64c-try,vm-aot-android-release-arm_x64-try,vm-aot-android-release-arm64c-try,vm-fuchsia-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306640
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-06-12 15:26:29 +00:00
Tess Strickland d735c5d3bc [vm] Fix regression where separate debugging info is obfuscated.
TEST=vm/dart/unobfuscated_static_symbols_test

Fixes: b/286598307
Change-Id: I7db0f803147bd00e414e0ef72a195189661a8c8b
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308620
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-06-12 09:42:04 +00:00
Tess Strickland 6d71b30ad0 [gardening] Mark vm/dart/regress_48523_test as Slow on TSAN.
Change-Id: Ia31ce705076eba125cbce4321430fb676cb424c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308343
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-06-09 13:32:37 +00:00
Tess Strickland aec34fa6a2 [gardening] Mark ManyInstantiations slow on qemu bots.
Change-Id: Iaebebf24006dd5b0439e35bb0a07ddc1718b6d9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308320
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Tess Strickland <sstrickl@google.com>
2023-06-09 09:31:40 +00:00
Ryan Macnak 884be01ec3 [vm, gc] Add option to madvise(DONTNEED) when sweeping.
- More expensive sweeping that will also slow down the mutator from more TLB invalidation
 - Might cause OOM sooner from PTE fragmentation
 - Won't decrease the Dart heap capacity stat
 - Unclear how often holes are at least page sized

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52571
Change-Id: I54011e451bf0ad21859c11023d1c4123cc0fa435
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306902
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-06-07 19:01:51 +00:00
Alexander Markov 63d856d487 [test] Avoid quadratic complexity in vm/dart/unobfuscated_static_symbols_test
This change makes this test much faster and should fix the timeouts on
the slow simarm_x64 configuration.

Change-Id: I6ba489d2dee3963bb070c1e86abff88420fa3ce7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-06-01 17:36:29 +00:00
Alexander Markov 3484bfe964 [vm/compiler] Avoid specialization of calls to setters of late final fields
Setters of late final fields should check that field is not initialized
yet, so they should not be replaced with a StoreField in call specializer.

TEST=runtime/tests/vm/dart/regress_52554_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52554

Change-Id: I2d7a4a8e112fe7b78e6d28efe4174159e3cabe04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306303
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-31 14:04:39 +00:00
Martin Kustermann 0d3ef451c7 [gardening] Remove assert(_remoteVm == null) as this is a non-nullable late-final field
TEST=Fixes assertion hits.

Change-Id: If601bf17df0a9c0da5bafcc686091dd3aed5f4d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306562
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-31 10:46:10 +00:00
Martin Kustermann 5136814ec2 [vm] Attempt to make vm/dart/isolates/reload_many_isolates_live_and_die_test more robust
This test is launcing N=20 parallel tracks. Each track is effectively
a child isolate that will make a tail call to another child isolate.

=> Limit number of parallel isolates to number of cores.

We are seeing sometimes failures where prints get interleaved into
stdout.

=> Do not assume the strings in stdout are from start of line.

We are sometimes seeing timeouts even though all isolates have finished
in the subprocess

=> wait for exit code & RPC connection closing in parallel
=> print their result.

Issue https://github.com/dart-lang/sdk/issues/51347
TEST=vm/dart{,_2}/isolates/reload_many_isolates_live_and_die_test

Change-Id: Ie8ecf863c2aab04264edf05a5628fa23b26a4813
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306602
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-05-31 09:16:25 +00:00
Tess Strickland ecf1968122 [vm] Do not obfuscate code or object symbols in the static symbol table.
Also changes pkg/native_stack_traces to return a parsed MachO file
if the MachO file doesn't contain DWARF information, so we can examine
its static symbol information for the new test.

Issue: https://github.com/flutter/flutter/issues/124715

TEST=vm/dart/unobfuscated_static_symbols

Change-Id: I07d3ced56eeba852ebe4178dfd2b66ebb899eb76
Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305720
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-31 08:06:08 +00:00
Alexander Markov abd95e21ca [vm] Fix handling of nullability in FutureOr type checks
TEST=runtime/tests/vm/dart/regress_52536_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52536

Change-Id: I1d2fc86071747bc401f419d9e0897420a873a647
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306310
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-30 23:41:19 +00:00
Martin Kustermann 20248e1c2e [vm] Make vm/dart/isolates/reload_many_isolates_live_and_die_test more robust
This test is launcing a subprocess with N parallel tracks.
Each track is effectively a child isolate that will make a
tail call to another child isolate. This process will continue
until a reload is requested.

=> So it tests performing hot-reload of an application that has
a lot of isolate creation, initialization, destructions in it.

Right now it uses N=20 for normal architectures (and N=2 for
simulators).

It turns out that part of the slowness of this test is due to the
subprocess's "vm-service" sending massive amounts of data via the
websocket to the parent process that performs reloading:

Each isolate will produce 4 events:
  * IsolateStart
  * IsolateRunnable
  * ServiceExtensionAdded
  * IsolateExit
and send those to the `vm-service` isolate. The service isolate will
then send those further via the WebSocket API to the parent process.

=> For 400k isolates this may send 3 GB of data via websocket.
=> The individual events most likely result in individual syscalls.
=> Networking stack on windows/mac may not be soo good, which
would explain why it's more likely to time out there vs linux

We ensure the helper reload utilites unsubscribe to the "isolate"
stream once there's no longer a need for it.
=> This will avoid the 3 GB of network traffic.
=> It will avoid a subset (but not all) of the isolate -> vm-service events

Issue https://github.com/dart-lang/sdk/issues/51347
TEST=vm/dart{,_2}/isolates/reload_many_isolates_live_and_die_test

Change-Id: I971b983a08ea8febd38e8b40a53ed6b114c4daca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306421
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-30 13:54:57 +00:00
Alexander Markov c554ae04fc [vm] Fix Type.hashCode asm intrinsic with compressed pointers
When loading cached hash code, asm intrinsic used LoadCompressed
which results in garbage in the high 32-bits of the register.
So the full register was not zero and intrinsic could return zero value
in the low 32-bits.

TEST=runtime/tests/vm/dart/regress_49672_test.dart
Fixes https://github.com/dart-lang/sdk/issues/49672

Change-Id: Ie800dcea02db5b54bd8bf7e9df0f437f09e92932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305360
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-24 20:03:38 +00:00
Martin Kustermann cfcc0ca04e [vm] Add tests verifying AMA assumptions
See go/dart-ama

TEST=vm/cc/AMA_Test

Change-Id: If593825b7505fb8ab8ef7a74567523f43489f9be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304960
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-24 08:42:14 +00:00
Alexander Markov 86c18251b4 [vm/aot] Disable graph intrinsics for implicit getters with unboxed record return values
Unboxing of records involves a more complex code, and such intrinsics
would be similar to the normal code of the implicit getters.

TEST=runtime/tests/vm/dart/regress_52449_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52449

Change-Id: I24867a7e0a3d081c53860f7f44c3be3d90b0b743
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304282
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-05-22 15:17:07 +00:00