Commit graph

20382 commits

Author SHA1 Message Date
Johnni Winther f17cf33c6d [kernel] Move Pattern nodes to package:kernel
These AST nodes were so far internal to the CFE, but since we need to
move the pattern lowering to the constant evaluator we need to support them in the AST defined in package:kernel.

TEST=existing

Change-Id: Ie6c5f0f8ad75a866c5d965fdf506bc869ffaf654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288241
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-03-13 08:43:07 +00:00
Robert Nystrom 56eaffb392 [flip-patterns] Enable "records" and "patterns" experiment flags.
This turns on the flags for these two language features and makes
them generally accessible.

Doing so causes a number of tests to fail, but the failures are
approved and there are filed issues for them. Most of the
failures are minor or only affect code using the new language
features.

This CL:

- Enables the features in experimental_features.yaml.
- Re-generates all of the various files generated from that.
- Makes some analyzer and front end changes that this CL
  inherited from Paul's original CL flipping all of the 3.0
  feature flags. I don't know what these changes are about, but
  I assume they are necessary.
- Pins a couple of tests to 2.19 since they deliberately test
  behavior that is specific to 2.19. (For most test changes, I've
  landed them separately, but there are a couple of stragglers
  in this CL.)

This doesn't enable "class-modifiers" or "sealed-types" and doesn't
include the core lib changes related to those.

TEST=On bots

Change-Id: Id387753772286a958e20a3589a6e983995f2e4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286344
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-10 20:02:23 +00:00
Ben Konyi fadbd51c83 [ Service ] Remove unused variable in GetIsolateMetricList
TEST=N/A

Change-Id: I7e9eb8db64952a9f40d82514935beaced4bffdb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288102
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2023-03-10 18:35:43 +00:00
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
Ben Konyi edead9cfd1 [ Observatory ] Disable serving Observatory by default
Observatory can still be enabled by providing `--serve-observatory` or
invoking the `_serveObservatory` private service RPC via web socket or
HTTP.

Related to https://github.com/dart-lang/sdk/issues/50233

TEST=pkg/dartdev/test/commands/run_test

Change-Id: I89b000e69bb31c91a9a5386fed1ee590cdafa58c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287821
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-03-10 16:01:41 +00:00
Johnni Winther 04e6f4c282 [kernel] Add VariableDeclaration.isSynthesized
This adds an [isSynthesized] flag to the [VariableDeclaration] the
signal when the variable doesn't correspond to a variable in the
source code.

The name of a variable can only be `null` if it is synthesized.

Partially in response to
https://github.com/dart-lang/sdk/issues/51554

TEST=existing

Change-Id: I94591971f11da09d210c8b25a2d05e22ca05dc62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286961
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-10 11:13:36 +00:00
Jake Macdonald 737b6f7356 [flip-modifiers]: flip the flags for sealed classes and class modifiers
Includes several updates to tests that needed to land with this flip, as well as some other tests that needed to be updated and could land separately, but are being included here to expedite things.

Removes some unnecessary experimental release versions, as well as bringing up to date the generated files, which were previously out of sync with the yaml file.

TEST=bots

Change-Id: I71a86d7a86190069b504bd27d687f62b97a7251e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285080
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-03-10 05:27:57 +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
Konstantin Shcheglov 895540889e Update SDK constraints for SDK packages.
https://dart-review.googlesource.com/c/sdk/+/287660 implements it.
I want to fix pre-existing violations before enabling.

Bug: https://github.com/dart-lang/sdk/issues/34978
Change-Id: Ie7731162c643018a2312b265f444bc00534c0a51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287664
Reviewed-by: Leon Senft <leonsenft@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-09 19:52:47 +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
Alexander Aprelev 63bea106d6 [vm/regexp] Name generated Regexp function with actual expression.
Currently all generated Regexp functions share the same name making profile information with RegExp functions harder to use.

BUG=https://github.com/dart-lang/sdk/issues/51624
TEST=ci

Change-Id: I67acf73df4be301dbcb17a60b8be1793002897b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287247
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-03-09 03:49:58 +00:00
Ryan Macnak 5c76d099a6 [build] Use relative paths.
go/remotely-cacheable

TEST=ci
Change-Id: Idee4ab56de2df15e90c5e4106b6200bf82e76155
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287320
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-08 22:10:42 +00:00
Alexander Markov 8ff777e61f [vm] Fix equality of uninstantiated generic closures
Equality of uninstantiated generic closures should match equality
of corresponding instantiated generic closures.

We cannot use identity for equality of instantiated generic closures
as distinct instantiations of the same generic closure should be equal.
So, identity shouldn't be used for uninstantiated generic closures
neither.

This change fixes equality for uninstantiated generic closures
and also updates closure hashCode correspondingly.

TEST=language/closure/instantiation_closure_equality_test
TEST=co19/LanguageFeatures/Constructor-tear-offs/equality_*

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

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: Ieafc052de4a4f5f9ffcd2d9d26cb36a209c0e127
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287581
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-08 21:44:56 +00:00
Vyacheslav Egorov 56ad16f4de [vm] Make VM strict about min required Mac OS X version.
Refuse to initialize VM if current Mac OS X version is below
MAC_OS_X_VERSION_MIN_REQUIRED, which was configured in build
time through mac_sdk_min GN argument.

TEST=tested manually by changing return value of MacOSXVersion

Cq-Include-Trybots: luci.dart.try:dart-sdk-mac-arm64-try
Bug: https://github.com/flutter/flutter/issues/121739
Change-Id: I9d913516077dbb196e8d6ebd7fe9f3914de7c748
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286932
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-03-08 09:08:39 +00:00
Nicholas Shahan d77e22a20b [dart2js] Update tests matrix entries
- Update options for existing configurations.
- Add one new configuration for running _2 test suites.
- Rename builders and update to run new configurations.

Tested: Tested with led runs.
Change-Id: I87de456b6b2e53d9e211cbd716fef18910aba69c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281348
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-08 08:40:57 +00:00
Ryan Macnak c023db4dd0 [vm] Fix false-positive in const field removal detection.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51526
Change-Id: I86dfa625a218dd58c2c009081230ca0d0729e807
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286959
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-07 18:19:07 +00:00
Daco Harkes 7cfbfc6a25 [vm/ffi] Change late Finalizable implementation
This CL replaces `late Finalizable` variables with the original and
a nullable non-late variable. Every assignment is done first to the
late variable, and the immediately to the nullable non-late shadow
variable. The reachability fences are then inserted only for the
nullable non-late shadow variable.

The advantage of this is that the semantics are fully valid and none
of the further compiler pipeline has to know about late Finalizables.
(1) We remove the special casing in the VM.
(2) The TFA logic with finalizables is no longer blocked.

The downside of this approach is that we use more memory, we need
two fields at runtime, one storing a null and the other storing a
sentinel on initiazation. Moreover, we get some extra store
instructions.

TEST=pkg/vm/testcases/transformations/ffi/finalizable_late.dart
TEST=pkg/vm/testcases/transformations/ffi/finalizable_late_2.dart
TEST=tests/language/vm/regress_49005_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51511
Change-Id: Ifedd3387a368233a2d01e1bcaa9f5e3eceb76856
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286782
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-07 10:10:25 +00:00
Ryan Macnak 63e6041ca9 [vm] Update to variadic FATAL.
TEST=ci
Change-Id: Ic6bc784605e10760bb28ea6df34242336a33b4d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286947
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-06 22:06:59 +00:00
Ryan Macnak 203998d021 [vm] Timeline docs.
Change-Id: Ie9415e02adc84a1f01178f16585f2bb6e7436f3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286863
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-03-06 21:33:24 +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
Ryan Macnak 08634ec4ee [vm] Remove thread time from the VM-internal recorders.
Querying the thread clock takes the overwhelming majority of time when using the VM-internal recorders (ring, startup, endless, file). Including the thread clocks in the timeline allowed visualizing roughly how much an event got scheduled out, but not when. This is a high price to pay for such fuzzy information. Precise scheduling information is available from Fuchsia tracing, systrace or Signposts.

```
import "dart:developer";
main() {
  var n = 1000000;
  var watch = new Stopwatch()..start();
  for (var i = 0; i < n; i++) {
    Timeline.timeSync("EventName", () {});
  }
  print("${watch.elapsedMicroseconds.toDouble() / n} us/event");
}
```

--timeline_recorder=ring      2.751822 -> 0.487936 us/event (5.64x)
--timeline_recorder=systrace  0.440439 -> 0.435997 us/event

TEST=ci
Bug: https://github.com/flutter/flutter/issues/121372
Change-Id: Ib6d625f28384a4e87df2a3305483f0f6facd08ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286661
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-03-03 19:05:28 +00:00
Ryan Macnak 3633ff4e71 Roll Clang from 20d06c833d83 to 28ee6040710f.
Address overflow warnings in ffi test library.

TEST=ci
Change-Id: I80e54d367532cbc392d6176dae97e9b545968de3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286660
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-03 18:22:32 +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
Daco Harkes 8b33eb6114 [vm] RISC-V fix build
Prevent build error with `gcc-riscv64-linux-gnu (4:12.2.0-4)`.

TEST=build on RISC-V bot + tested locally.

Change-Id: If349cccc49ed5ce9c76da8fdd1c48704cb57d9de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286820
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-03 14:07:47 +00:00
Lasse R.H. Nielsen cc736dfb65 [flip-modifiers]: Reapply "Enforce current library restrictions."
This reapplies commit 0c05e33836
and reverts the revert 029e0cec71.

Tested: Added few new tests, updated existing. Mainly regression testing.
CoreLibraryReviewExempt: Reviewed in original CL.
Change-Id: Ifcc79ce2f9375f607722643a04957b0961e6c295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284304
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 09:37:38 +00:00
Ryan Macnak e31c3713bf Reland "[build, vm] Access TLS with less code."
- Avoid TLS initialization checks by using inline initialization.
 - Avoid global offset table indirection by reducing -fPIC to -fPIE.

out/ReleaseXARM64/exe.stripped/dart_precompiled_runtime
11137992 -> 11274776 (-1.21%)

We still need -fPIC in some places because we build a few shared libraries for FFI, so copy some of Fuchsia's GN setup to use -fPIE or -fPIC as appropriate.

Account for older gcc that does not default to -fpie.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51602
Change-Id: I85072153cb1aef9047c1adbf36c7496fbeb11e10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286221
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-02 23:07:16 +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 Markov e27923a5a0 [dart2js] Static weak references to method tearoffs
TEST=language/static_weak_reference_test
TEST=language/static_weak_reference_error_test

Bug: b/269223463

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I760476a7c81751f6c302f21251b525cb5c916c02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284489
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-02 20:04:19 +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 Markov ed277908ae [vm/compiler] Unify reading and writing of MoveOperands in IL serialization
TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I2a0ad11e1264dbef4e23fc7acf9ff9df885b83a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285941
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-03-01 16:09:49 +00:00
William Hesse ec53fdd0bf Revert "[build, vm] Access TLS with less code."
This reverts commit aa79cf2708.

Reason for revert: -fPIC is needed in more places than the CL adds it to, see CI builds at https://ci.chromium.org/ui/p/dart-internal/builders/ci/dart-sdk-linux-riscv64-dev/405/overview

Original change's description:
> [build, vm] Access TLS with less code.
>
> - Avoid TLS initialization checks by using inline initialization.
> - Avoid global offset table indirection by reducing -fPIC to -fPIE.
>
> out/ReleaseXARM64/exe.stripped/dart_precompiled_runtime
> 11137992 -> 11274776 (-1.21%)
>
> We still need -fPIC in some places because we build a few shared libraries for FFI, so copy some of Fuchsia's GN setup to use -fPIE or -fPIC as appropriate.
>
> TEST=ci
> Change-Id: I6402fce3366a9c4b2741ffb4811562292b8ecb71
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285704
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

Change-Id: Idacb7869e9fa9ad0f7ed7b0caa2bae19deece7d0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286144
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: William Hesse <whesse@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-03-01 12:19:07 +00:00
Ryan Macnak aa79cf2708 [build, vm] Access TLS with less code.
- Avoid TLS initialization checks by using inline initialization.
- Avoid global offset table indirection by reducing -fPIC to -fPIE.

out/ReleaseXARM64/exe.stripped/dart_precompiled_runtime
11137992 -> 11274776 (-1.21%)

We still need -fPIC in some places because we build a few shared libraries for FFI, so copy some of Fuchsia's GN setup to use -fPIE or -fPIC as appropriate.

TEST=ci
Change-Id: I6402fce3366a9c4b2741ffb4811562292b8ecb71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285704
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-03-01 01:21:55 +00:00
Jake Macdonald 4947481ff6 convert class M to mixin in observatory test
TEST= only test changes

Change-Id: If372c032ed2e84dc4c442c7cae9897b3c8ecc37e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285801
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-02-28 22:45:14 +00:00
Ryan Macnak 818509b775 [vm] Fix GCC and MSVC builds.
TEST=ci
Change-Id: I0d74db69e044b7a97526d4b8c9ce392a5f69e9d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286040
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-02-28 22:06:22 +00:00
Alexander Markov 4de07617b1 [vm] Fix vm/cc/CodeRelocator tests
There is no need to adjust instruction address by Page::AliasOffset()
when copying them to the image, as instructions are still readable
even if dual-mapped. The adjustment can be harmfull if Code is not
properly finalized and instructions in the Code are not replaced
with executable version.

TEST=ci
Fixes https://github.com/dart-lang/sdk/issues/51525

Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64c-try,vm-win-debug-x64c-try
Change-Id: I4af0ded149f27f6a68d2962805748d1eef6625e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286022
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-28 21:49:33 +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
Oleh Prypin 2e01df50e9 Revert "[VM] Begin supporting Perfetto file recorder"
This reverts commit 7424295ce9.

Reason for revert: Causes VM crash in internal tests - b/271081079

Original change's description:
> [VM] Begin supporting Perfetto file recorder
>
> This CL adds the `TimelineEventPerfettoFileRecorder` class, which is a
> timeline recorder that writes a trace to file in Perfetto's proto
> format. This CL supports the recording of all types of timeline events
> except flow events. Support for flow events will be added in a future
> CL.
>
> TEST=Recorded traces with the Perfetto file recorder and explored them
> in Perfetto's trace viewer, CI
>
> Change-Id: Iaa2051e536589a473c5e15f9de9bb9c251f13d38
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278942
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

Change-Id: I1c4b0b78be3748b525b82ea66079dd95d412d82e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285906
Auto-Submit: Oleh Prypin <oprypin@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-02-28 12:41:00 +00:00
Vyacheslav Egorov 27230ae008 [vm/compiler] Split ParallelMove codegen into scheduling and emission
This CL does not contain any changes to behaviour, but simply moves
ParallelMoveResolver to a separate file. Additionally instead of
immediately generating code we produce a move schedule which is
attached to the ParallelMoveInstr and later converted to the
native code.

This refactoring prepares the code for subsequent improvements, e.g.
we want to rework how temporaries used by move resolution are
allocated: instead of pushing/poping them around every move that needs
them we will allocate space for them in spill area.

Having ParallelMove scheduling separated from code emission also
allows to unit test it.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64c-try,vm-aot-linux-product-x64-try,vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-asan-linux-release-x64-try
Change-Id: Ifeb17940f4cfb3c0cc004cb3f74895f0d3c2b7bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285840
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-02-28 12:21:41 +00:00
Alexander Markov e7af7ea88f [vm/compiler] Avoid undefined evaluation order in IL deserialization
IL deserialization should not read 2 components of pair Location
via 2 sub-expressions as they can be swapped due to a different
evaluation order.

TEST=language/records/simple/constants_and_field_access_test/1
(on Windows)

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

Change-Id: I7f97dbb5ed10b700d4cdcea6fa5ebb873ca789c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285860
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-02-28 00:24:39 +00:00
Ryan Macnak 854dc20416 [vm, compiler] Use ARMv8.1 AMOs in the write barrier stub on Mac.
Cf. 1af37bd92a.

TEST=ci
Change-Id: I61186646ef2aab69d8ffac36073829d5cc865408
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284547
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-02-27 22:26:36 +00:00
Derek Xu 14af4fac49 [VM] Implement GetCurrentThreadName() on Android
TEST=I recorded a trace using the Perfetto recorder on an Android device and ensured that the "DartDev Runner" track name was correct.

Change-Id: I87ef31ff5b4d7817e77536430cf474cf34c22678
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279200
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-02-27 21:24:47 +00:00
Derek Xu 67f3e1f4a0 [VM/Service] Add support for class modifiers
TEST=CI

Fixes https://github.com/dart-lang/sdk/issues/50742
Fixes https://github.com/dart-lang/sdk/issues/50743
Fixes https://github.com/dart-lang/sdk/issues/51296
Fixes https://github.com/dart-lang/sdk/issues/51297
Change-Id: I52de34219883ca8680b1a8968ac9f4183fc5e970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285360
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-02-27 21:07:41 +00:00
Derek Xu 7424295ce9 [VM] Begin supporting Perfetto file recorder
This CL adds the `TimelineEventPerfettoFileRecorder` class, which is a
timeline recorder that writes a trace to file in Perfetto's proto
format. This CL supports the recording of all types of timeline events
except flow events. Support for flow events will be added in a future
CL.

TEST=Recorded traces with the Perfetto file recorder and explored them
in Perfetto's trace viewer, CI

Change-Id: Iaa2051e536589a473c5e15f9de9bb9c251f13d38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278942
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-02-27 18:37:48 +00:00