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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>