Commit graph

1639 commits

Author SHA1 Message Date
Ben Konyi
f51fedce26 [ dart:developer ] Remove Metrics related classes
Fixes https://github.com/dart-lang/sdk/issues/51668

TEST=CI

CoreLibraryReviewExempt:VM only functionality
Change-Id: I5d41863fca05e50d9c20266402c516b92f8de153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287820
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-10 16:50:10 +00:00
Alexander Markov
8c7d47cd19 [vm/compiler] Keep and propagate static types during local type propagation
Types of record field accesses are based on static record types,
so it is useful to keep and propagate static types even when
concrete class id is known.

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

Issue: https://github.com/dart-lang/sdk/issues/49719
Issue: https://github.com/dart-lang/sdk/issues/51637
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I268e3d519b07e12d1e2f8929cbd704a6995e2053
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287222
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-09 21:18:49 +00:00
Robert Nystrom
bb3fc88eb0 [flip-patterns] Pin to tests/vm/dart/regress_flutter51298_test.dart to 2.19.
In Dart 3.0, bool is treated as an "always-exhaustive" type which means
it's a compile error to not exhaustively switch on it.

Since this is a regression test, I don't want to tweak the test and
risk not covering the regressed behavior, so pinning to 2.19 where this
wasn't a compile error.

Change-Id: I51c63730f6db55ecc52daf20888db8778051d98f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287668
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-03-09 19:22:47 +00:00
Oleh Prypin
732d1cc0a4 Revert "Add more interface and final modifiers to dart:core."
This reverts commit 4f8333e80e.

Reason for revert: causes breakages in google3

Original change's description:
> Add more `interface` and `final` modifiers to `dart:core`.
>
> Make intent explicit for classes which are intended as interfaces,
> or which are not intended to be subclassed.
>
> Mainly classes which are pure interfaces are marked as such,
> and platform-specific classes not intended for subclassing
> are made `final`.
>
> The `final` classes includes `BigInt`, which is written to assume
> that arguments inherit its private members
> (it runs `_ensureSystemBigInt` on arguments).
>
> It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
> which are just intended as stand-alone implementation classes for accessing
> platform-specific functionality.
>
> Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I94ff95f72410a4e1ae80744971c4c920fecc1493
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-09 13:09:57 +00:00
Lasse R.H. Nielsen
4f8333e80e Add more interface and final modifiers to dart:core.
Make intent explicit for classes which are intended as interfaces,
or which are not intended to be subclassed.

Mainly classes which are pure interfaces are marked as such,
and platform-specific classes not intended for subclassing
are made `final`.

The `final` classes includes `BigInt`, which is written to assume
that arguments inherit its private members
(it runs `_ensureSystemBigInt` on arguments).

It also includes the `Expando`, `WeakReference` and `Finalizer` classes,
which are just intended as stand-alone implementation classes for accessing
platform-specific functionality.

Change-Id: Ib770c265edff127a289a67fe72d15b9ff0499407
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287180
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-09 12:31:08 +00:00
Ryan Macnak
90ff190627 [vm] Remove malloc profiler.
Splitting c67fac9cb4.

TEST=ci
Change-Id: Ib42d861e458648ce810be44cea0734c244703c1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287000
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-06 21:00:30 +00:00
Jake Macdonald
af6e1bf5a4 [flip-modifiers]: prep more tests for the class modifiers flag flip
TEST=only test changes

Change-Id: I725bd897e9e749ab6010c99ee74c20ee64e61500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286981
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-06 20:52:03 +00:00
Johnni Winther
bd02ce7a7f [cfe] Report error on : for default values
Closes #51576

TEST=pkg/front_end/testcases/general/colon_default_value

Change-Id: Ia8ccdf697d876dbefcbf2c5ed98d01634c075e74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286183
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-06 19:04:55 +00:00
Daco Harkes
b1e59721d4 Revert "[vm] Remove tcmalloc and malloc profiler."
This reverts commit c67fac9cb4.

Reason for revert: Regresses `dart:io` performance and causes
failures.
https://github.com/dart-lang/sdk/issues/51639

Original change's description:
> [vm] Remove tcmalloc and malloc profiler.
>
> The standalone VM originally began statically linking tcmalloc to work around bugs in the system malloc for Fiber. Later it used tcmalloc's hooks to implement a profiler, but this is rarely used since it is only available in debug mode, misses early allocations, and often misses late allocations from an exhausted sample buffer. Removing it altogether avoids build complexity around which combinations of compiler/architecture/sysroot support tcmalloc, and reduces binary size.
>
> TEST=ci
> Change-Id: I4b259e18b82b2d12a2a60962aabf83bd8d997d19
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286120
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Change-Id: I4395edd6f5bd7e26b4e38f4d931ad2ea67afba18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286925
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-06 10:28:33 +00:00
Ryan Macnak
c67fac9cb4 [vm] Remove tcmalloc and malloc profiler.
The standalone VM originally began statically linking tcmalloc to work around bugs in the system malloc for Fiber. Later it used tcmalloc's hooks to implement a profiler, but this is rarely used since it is only available in debug mode, misses early allocations, and often misses late allocations from an exhausted sample buffer. Removing it altogether avoids build complexity around which combinations of compiler/architecture/sysroot support tcmalloc, and reduces binary size.

TEST=ci
Change-Id: I4b259e18b82b2d12a2a60962aabf83bd8d997d19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-03 23:32:12 +00:00
Alexander Markov
f578ca179a [gardening] Exclude lib/async/multiple_timer_test from isolate stress testing
This test runs multiple timers with fixed timeouts and expects certain
order for timer handlers. Timers may not fire in order if the system is
under heavy load, which happens during isolate stress testing.

Change-Id: I5fc7f23f44496b2df57797463493a89b6c64f763
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286840
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2023-03-03 16:52:28 +00:00
Jake Macdonald
a22e003ee1 [flip-modifiers] fix some vm tests to make mixed in classes mixins
These tests don't have a language version and so will get opted in when the flag is flipped, and need to be compatible.

TEST=only test changes

Change-Id: Idf49123e25c876102e6719ed3de8b475e80c8975
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286542
Reviewed-by: Alexander Aprelev <aam@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-02 21:29:56 +00:00
Alexander Aprelev
1dfe2d889b [gardening] Remove failing tests from iso-stress-linux suite.
Until https://github.com/dart-lang/sdk/issues/51553 is fixed, the tests can't be run by iso-stress-linux buildbot.

Change-Id: I7f387974c5231d5f4d0da87035fc6d582e319801
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286224
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-03-01 23:32:30 +00:00
Alexander Markov
8627463c23 [tests, benchmarks] Reformat using new Dart formatter
Certain tests and benchmarks are reformatted using the new version of
"dart format" which supports records.

TEST=ci

Change-Id: I6132e8000317bfcc56c8d96682dc9771c728076d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286201
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-01 18:15:09 +00:00
Alexander Aprelev
b4fd9ac97f [vm/regex] Ensure CharacterRanges are canonicalized before QuickCheck decision is made.
First, canonicalized CharacterRanges allow for QuickCheck code to be generated, rather than skipped. Second, CharacterRanges could become canonicalized later leading to incompatible instructions generated on a second compilation run, leading to a crash.

Fixes https://github.com/flutter/flutter/issues/121270
TEST=flutter_regress_121270_test

Change-Id: I075986b86b810ede96471bbe5fbe0b337714d215
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286021
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-28 20:26:58 +00:00
asiva
ba1d8bdbc0 [Runtime/VM] - Fix reachability test issues
- Skip test in product mode as the feature is not
		 supported
	       - Account for GCType::kEvacuate by moving state to
		 Heap::kSecondScavenge

TEST=ci

Change-Id: Iee3a07121d8c3121cdac4521958048c662ab5b5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-02-25 01:08:48 +00:00
Ryan Macnak
8949974caf [vm] Remove unnecessary check for compaction from the profiler.
The PC marker slots are transiently invalid during a compaction, but the profiler's stack walker no longer uses them, as they are completely absent in bare instructions mode.

TEST=ci
Change-Id: I3dba373ccccaba48e6dcc2b01d48e5e75620a4db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284744
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-24 03:39:05 +00:00
Alexander Aprelev
4f30b5c9b5 [vm/isolates] Include retaining path into an illegal send argument exception.
The exception contains retaining path that looks like this:
```
Invalid argument(s): Illegal argument in isolate message: (object extends NativeWrapper - Library:'dart:io' Class: _RandomAccessFileOpsImpl@14069316)
 <- Library:'dart:io' Class: _RandomAccessFile@14069316
 <- Library:'file:///vm/dart/isolates/send_unsupported_objects_test.dart' Class: SomeLog
 <- Library:'file:///vm/dart/isolates/send_unsupported_objects_test.dart' Class: SomeState
 <-  Class: Context
 <- Library:'dart:core' Class: _Closure@0150898

```

BUG=https://github.com/dart-lang/sdk/issues/51115
BUG=https://github.com/dart-lang/sdk/issues/48592
TEST=send_unsupported_objects_test

Change-Id: I022e693adccf43a7d2c95e1c7283fd7f210cf1d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280523
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-23 03:11:08 +00:00
Alexander Markov
967f583e41 [vm/test] Make sure argument is unboxed both with and without sound null safety
Without sound null safety result of int.parse is inferred as nullable,
making the IL test vm/dart/records_allocation_sinking_il_test dependent on
the sound null safety mode.

The test is changed so the argument 'x' of 'test' is always non-nullable
and always unboxed.

Follow-up to the unboxing fix
85d1a7752e

TEST=vm/dart/records_allocation_sinking_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I9c532a644d03e0fdb7b70875c323fcbbb5238948
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284382
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-02-21 20:36:22 +00:00
Vyacheslav Egorov
93e73bf93a [vm/compiler] Rename PushArgument to MoveArgument
This is follow up to 65f4a733bb,
which switched optimized code to use fixed frame for outgoing
arguments.

Change Kernel to IL translation to handle null-checks in
invocations differently: this code used to duplicate receiver on
the stack to accomodate for PushArgument in unoptimized code, but
PushArgument has not been inserted since f4e61eacfd,
which means duplication of the receiver is no longer necessary.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Change-Id: I6c1f1e8c354f9ea92424b6602b83b9e9ebce8b69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284184
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-20 14:57:57 +00:00
Martin Kustermann
15ecb9b39f [gardening] Fix vm/cc/IsolateReload_{TypedefToNotTypeDef,NotTypedefToTypeDef} tests
With introduction to Dart 2.0 and Kernel as intermediate format, the VM
consumes kernel. The kernel is produced by CFE which lowers named
function type definitions to function types.

We therefore no longer have name classes between typedefs and classes
and the corresponding vm/cc/IsolateReload_* can be updated to no longer
expect an error.

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

TEST=Fixes vm/cc/IsolateReload_*Typedef* tests

Change-Id: Ic0697c5de03ef28e6cca104f5fbcb214e99d3fd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284182
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-02-20 13:54:29 +00:00
asiva
daab5d49cf [VM/Test] Reduce the iteration count to ensure test does not time out on
debug builds.

Change-Id: I39bf7974ceec4f29bbffa1d32ae12bb7f2485d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283220
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-02-16 00:59:11 +00:00
Vyacheslav Egorov
01adcacbf2 [vm] Adjust unboxing il tests for non-sound null-safe mode.
int.parse() and double.parse() are not known to produce non-nullable
int outside of sound null-safety mode, so instead use simpler way
to define non-constant values for testing.

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

TEST=vm/dart/numeric_unboxing_il_test,vm/dart/records_return_value_unboxing_il_test

Fixed: 51418
Change-Id: Ie0b55c2f3d632f51656b5f273aee5cb9623c43e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283180
Reviewed-by: Liam Appelbe <liama@google.com>
Auto-Submit: Slava Egorov <vegorov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-02-15 00:00:11 +00:00
Vyacheslav Egorov
59a1e9afeb [vm] Fix failures in il tests for unboxing
* More parameters are now unboxed in records_return_value_unboxing_il_test
* Make numeric_unboxing_il_test more portable by preventing compiler from
  inferring that some int variables always contain smi values.

TEST=vm/dart/numeric_unboxing_il_test,vm/dart/records_return_value_unboxing_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try
Change-Id: I8d55cc31c0d4305f3884d6ac5dc77a5dd0205b78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/283040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-14 12:18:47 +00:00
Vyacheslav Egorov
85d1a7752e [vm] Fix UnboxedParameterBitmap::SetAt
It was accidentally masking out all low bits under
the given position.

Add a simple smoke test for field/parameter unboxing.

TEST=vm/dart/numeric_unboxing_il_test
R=alexmarkov@google.com

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try
Change-Id: Ic38ae3e14ddf2b8cab8f01cd923a103d900e0dc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282880
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-02-14 09:01:13 +00:00
Martin Kustermann
fae934c4b1 Revert part of "[vm] Allow sharing of deeply immutable lists across isolates"
It did have noticable xx% performance regression on

  ListCopy.List.int.unmodifiable.100

TEST=ci

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

Change-Id: I160d7cc98aee2e064b1767519f4b5033656ee115
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282400
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-10 20:25:59 +00:00
Martin Kustermann
a03cb5841e [vm] Manually unpoison memory that Dart allocates and passes to C
Closes https://github.com/dart-lang/sdk/issues/51345

TEST=vm/dart/isolates/fast_object_copy2_test

Change-Id: I09cf0b896b9e0bc268168c27c7f6cf1220ccd1c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282028
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-09 21:22:12 +00:00
Alexander Aprelev
91ea69d96d [gardening] Skip fast_object_copy2_test on sim archs where ffi is not available.
Fixes https://github.com/dart-lang/sdk/issues/51329
TEST=ci

Change-Id: Ide0a2a00dd978afbb1fad1d52280ff904d197818
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281900
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-08 23:15:34 +00:00
Martin Kustermann
896e535fe9 [vm] Allow sharing of deeply immutable lists across isolates
We support allocating deeply immutable typed data in the Dart C API
already.
=> This CL adds a test for that.

Furthermore we hook into the already O(n) construction of
`List.unmodifiable(<list>)` and set the objects immutable bit
if all elements of `<list>` are also immutable.
=> This allows then sharing of such lists when sent across isolates.

We do this eagerly to

  - avoid introducing complexity to the deep immutability check in
    transitive copy algorithm

  - avoids re-checking for the subgraph on every send (similar to
    canonicalized bit for constants, we can simply rely on the
    immutable bit)

If we ever optimized `List.unmodifiable()` (which always performs
runtime call atm) we could fold this checking into the place that copies
list elements from `<list>` to the newly allocated list.

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

TEST=vm/dart{,_2}/isolates/fast_object_copy2_test

Change-Id: Ie275e65036a4c53d992804972aae741a9f5ed6dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281424
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-08 19:14:13 +00:00
Martin Kustermann
404b71b2c5 [gardening] Fix null-save vm/dart/spawn_shutdown_test to not have compile-time error
TEST=Make vm/dart/spawn_shutdown_test run

Change-Id: Iaf5785f43918b2428a9810320677a9d1309fca6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281622
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-08 12:07:57 +00:00
Martin Kustermann
63b5f5d4b1 [vm] Ensure we copy shallow (but not deeply) immutable lists
The object graph copy code assumed kImmutableCid is used only for
list constants but it turns out our List.immutable([]) implementation
isn't using a wrapper-view, but instead a fixed-length immutable list as
with constants:

  factory List.unmodifiable(Iterable elements) {
    final result = new List<E>.from(elements, growable: false);
    return makeFixedListUnmodifiable(result);
  }

The list constants should already be handled via canonical bit.

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

TEST=vm/dart{,_2}/isolates/regress_51302_test

Change-Id: I5924084ff004dc52bf675897455453d728484d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281421
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-08 08:58:40 +00:00
Martin Kustermann
c9f3aca45b [vm] Ensure we only enqueue maps/sets to be rehashed if we know it got copied successfully
Closes https://github.com/dart-lang/sdk/issues/51226

TEST=vm/dart{,_2}/regress_51226_test

Change-Id: I1da2dfe45863d5f1004efde3a4ecaae89ffd62fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280469
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-02-06 11:00:29 +00:00
Ryan Macnak
da70eb45f2 [test] Skip slow tests on reload bots.
Change-Id: I1e5e068bd765b1850b70f0253466d6e2e8c12a1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280781
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-03 20:52:03 +00:00
Ryan Macnak
9cd26c14f0 [test] Mark weak_canonical_string_table_test as slow on TSAN.
Change-Id: I2cf0004e2b861cd9521f89aa003ce83ccba8d5c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280405
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-02 20:55:38 +00:00
Alexander Markov
a9d9b7395b [kernel] Enable sound null safety in TargetFlags by default
TargetFlags.enableNullSafety is set to true by default and
also renamed to TargetFlags.soundNullSafety to better reflect its
meaning.

TEST=ci

Change-Id: I2c2f30c2af6502fd9a96141dc60e4afbf8c524fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280216
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-02-02 14:54:18 +00:00
Alexander Markov
9be13288b0 [vm] Support multiple local variables with the same name in the same scope
When lowering patterns, front-end can add multiple distinct local
variables with the same name into the same local scope.
Previously, VM identified local variables in a local scope by name.
However, this no longer works with patterns.

With this change, local variables are now identified by pair (name,
kernel offset). Name is still taken into account as compiler can add
extra variables which do not correspond to kernel variables,
such as 'this'.

TEST=runtime/tests/vm/dart/regress_51091_test.dart
Fixes https://github.com/dart-lang/sdk/issues/51091
Issue https://github.com/dart-lang/sdk/issues/49755

Change-Id: I0263769cb31f3f8d9652f5d6534800510ac882fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279650
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-01-31 18:47:46 +00:00
Alexander Markov
f2304f9ec0 [vm/compiler] Fix numbering of SSA values during inlining
When building SSA form for callee graph during inlining, numbering of
SSA values starts with the number of SSA values in the caller graph.
However, parameter stubs may contain constants which are already added
to the callee graph and occupy certain range of SSA numbers. If that
number is larger than number of SSA values in the caller graph, then
numbers, already assigned to constants, can be incorrectly reused
during SSA construction.

The fix is to adjust number of SSA values in the callee graph
before parameter stubs are created, and then use current number of
SSA values as a starting point when building SSA.

TEST=runtime/tests/vm/dart/regress_flutter119220_test.dart
Fixes https://github.com/flutter/flutter/issues/119220

Change-Id: I7efd52e626b63bf64fb47861ec210b291911ef28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280041
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-01-31 16:47:44 +00:00
Josh Soref
77978889eb Spelling
Closes https://github.com/dart-lang/sdk/pull/51143

GitOrigin-RevId: 9e21c99a222d588e4fc95980725a2f8c9784965c
Change-Id: If0870e8936c7649935dce7e23cd783d62aa5610c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279916
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-30 18:29:59 +00:00
Lasse R.H. Nielsen
bee7ab2b32 Make record positional field getters start at $1.
An update for co19 is available at https://github.com/dart-lang/co19/pull/1759

TEST=Existing tests run after change, two new tests for edge cases.

Change-Id: I408e398d532ba2c2e8e60777bb4f7bd0057e27fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278912
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-01-30 08:14:28 +00:00
Ryan Macnak
92972ff5cf [vm, gc] Disable time-based components of the growth policy when running under --deterministic.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51125
Change-Id: Ic716a0cc917b9237a4d1b452714bfc4c54f6aae6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279470
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-28 00:24:09 +00:00
Alexander Aprelev
7c409eaa42 [vm/gardening] Skip two failing tests on iso-stress-linux.
The tests were not included into non-nnbd testing.
BUG=https://github.com/dart-lang/sdk/issues/51148
TEST=ci

Change-Id: Ib838cd0d70ebffe83ba2c5f2482e403c18f55317
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280060
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-01-27 20:48:17 +00:00
Martin Kustermann
b15da0b0e9 [gardening] Build analyze_snapshot/gen_snapshot in both host & target toolchain
This should make vm/dart_2/analyze_snapshot_binary_test pass on
dartkp-linux-release-arm64 & dartk-linux-release-arm64

by ensuring arm64 `gen_snapshot` & `analyze_snapshot` binaries
are available on the device when running tests on arm64 HW.

Change-Id: Icd814ff6df22a33b651733e4c3dc99873cf56a58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279970
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-01-27 12:44:30 +00:00
Martin Kustermann
0a78aac714 [vm] Make iso-stress builder compile & run null safety tests
Change-Id: I2a85491ac63635b4bd1d1f531466a0760f54e9e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279969
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-01-27 10:31:14 +00:00
Martin Kustermann
f12592b984 [vm] Make vm/dart/isolates/concurrency_stress_sanity_test compile iso-stress tests in sound-null safety mode
Change-Id: Id63e234353981100155530e592a95c993ffd8d77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279968
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-01-27 10:29:25 +00:00
Alexander Aprelev
bb63927fed [vm/regexp] Follow-up to RegExp sharing change 438b81c4f2.
Avoid ZoneHandles unless needed, use field initializer, few more nits.

This is based on feedback on https://dart-review.googlesource.com/c/sdk/+/279747.
TEST=ci

Change-Id: I59b462ca70a912b270b089fb114d6029b7fa5856
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279903
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-01-27 00:43:59 +00:00
Alexander Aprelev
f9fb896455 [vm/isolates] Fix isolate_send_function_types_test
The test has been quietly broken for a while now as it expected that function types can't be send(which is not the case).

TEST=isolate_send_function_types_test

Change-Id: I09b107ef7f6b6229a2a28ee5c3f94f3bc8d7751e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279902
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-01-26 23:10:01 +00:00
Ryan Macnak
3b57bac701 [vm] Use a weak set to represent dependent code.
Fixes a scaling limitation where compiling N functions using the same guarded field or CHA guarded interface will result in O(N^2) comparisons when registering the dependencies.

Don't use Instructions' address as the hash, as this gets relocated between the snapshot writer and reader.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51125
Change-Id: I9a13d57455e10865d9c5f7c12009d869a4ef0488
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279753
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-01-26 22:56:48 +00:00
Tess Strickland
2967b148ec [gardening] Fix genSnapshot detection in use_flag_test_helper.dart.
Previously handled cases:
- No cross compilation, gen_snapshot in same `buildDir` as rest.
- X64->SIMARM cross compilation, gen_snapshot in `${buildDir}_X64`.

Newly handled case:
- X64->ARM64 cross compilation, gen_snapshot in `${buildDir}/clang_x64`.

TEST=vm/dart{,_2}/analyze_snapshot_binary_test

Change-Id: I3d3a23be445496ab068926f7d76b56299e06d950
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-android-release-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279880
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2023-01-26 13:42:29 +00:00
Vyacheslav Egorov
c3d8f46c5b [vm/compiler] Devirtualize calls while inlining.
Inlined functions might contain call-sites which can be devirtualized
in the context of the caller. To achieve that we add a pass which
calls canonicalization on all dynamic calls (and their data
dependencies) between rounds of inlining.

More specifically this helps cases which require interleaving
some redundancy elimination and inlining to remove the cost of
abstractions. The primary example is for-in loop with an array of
a known type which usually requires inlining `get:iterator` and
propagating iterable value through interator's fields to specialize
and inline `get:length` and `operator[]` on the `Iterable`.

See https://github.com/dart-lang/sdk/issues/48433 for example.

TEST=vm/dart/devirtualization_during_inlining_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-product-x64-try
Change-Id: I1fae50484a111f8c21c81bcf0c3d6a63a856338a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279517
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-01-26 08:52:18 +00:00
Josh Soref
f7a2ea5e06 Spelling
Closes https://github.com/dart-lang/sdk/pull/50922

GitOrigin-RevId: 58fd7cfd5ef470a65a52ea28e0407244d853c917
Change-Id: I2e5a5ed991cb05270170a18b8f0169daa9eabdb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278537
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-24 18:00:25 +00:00