Commit graph

100929 commits

Author SHA1 Message Date
Ryan Macnak
1ff4f72ebc Mark file system event tests as slow.
Restore timeout for windows-arm64, which did not get faster.

Change-Id: I9f032c25fc69454929348f0589d35200a4728142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364625
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-04-26 23:46:17 +00:00
MarkZ
6357371c0a [reload_test] Adding diffs to existing tests.
Change-Id: Icf7135ae46159ca834a54849c72405eec83f9b4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364384
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-04-26 23:05:10 +00:00
MarkZ
09f523fbb5 [reload_test] Adding support for diff checking and generation.
Change-Id: Ifdfb5f92c4ab6190ceb290979c2a8c793c3cc740
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364165
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2024-04-26 23:05:10 +00:00
Ryan Macnak
f02007839d [test_runner] Reduce timeouts.
We've roughly doubled bot speeds; half timeouts to provide pressure against this simply getting filled with slower tests.

Change-Id: I812da7adc6c08e6d484732c2558e0d3f63b2694a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364385
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-04-26 21:39:34 +00:00
pq
f68a70d55a annotate_overrides test for augmented hasOverride
Adds a failing test for the case where a `hasOverride` getter should consider augmentations.

See: https://github.com/dart-lang/linter/issues/4925


Change-Id: I8d7e8f145d630abbef438a79076820613a801940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364623
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-04-26 21:39:06 +00:00
Kenzie Schmoll
adfbcc7657 Update DevTools rev to e15c47243362b160646f03df9b1ad8d41e9a2d30
Change-Id: I8def4dca26b200a9f03cfbd2ef8e66edb0f6bac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364621
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2024-04-26 21:31:31 +00:00
Nicholas Shahan
ab2dd17ac7 [ddc] Erase extensions before calling .isTop()
The CFE test for top types doesn't and probably shouldn't erase
extension types so now they are earased before calling.

Change-Id: I4d2c9d13149031925fb144aff9c1628eef84941c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364601
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-04-26 21:31:02 +00:00
Sam Rawlins
4c888ab54c linter: do not report use_is_even in const situations
Fixes https://github.com/dart-lang/linter/issues/4915

Change-Id: I4b353b3f8cc064d15bbe366c9008c9a2fc1e1144
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364620
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
2024-04-26 20:44:19 +00:00
Konstantin Shcheglov
15c3434efe Completion. Issue 55576. Support for completion in IndexExpression.
Bug: https://github.com/dart-lang/sdk/issues/55576
Change-Id: I30369fa9259e6852204acd8ad2d130617f2b8e12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-04-26 20:08:41 +00:00
Konstantin Shcheglov
4432585051 Augment. Store 'augmentationTargetAny', check type in 'augmentationTarget'.
So, we can distinguish "no target" from "invalid target".

If we augment a setter, and there is no target, we also probe getters
(and methods, constructors). Which theoretically is not the same as
augmenting e.g. a class with a mixin - they live in different names.
Not sure. Maybe don't look for `name` when `name=`?
The difference is that we will report "No augmentation target" vs
"It is wrong when a setter augments a method".

Change-Id: Ibee84b2d039cf16824cb367fefdcda72b99f54bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364603
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-04-26 19:25:23 +00:00
Srujan Gaddam
307d739158 [dart:js_interop] Fix lowerings of ExternalDartReferences
Closes https://github.com/dart-lang/sdk/issues/55549
Closes https://github.com/dart-lang/sdk/issues/55340

Fixes several issues around using ExternalDartReferences:
- Better inlining of interop methods is enabled when this
type is used. This also indirectly improves inlining when
using JSAny.
- Adding some missed inlining for setting properties in
general.
- Allows opaque references of Dart functions to be passed
to JS
- Allows type parameters that extend ExternalDartReference
to be used in interop methods.
- Fixes up parent pointers of nodes in transforms.

Change-Id: I8cbd163ee3c1b98e733c35a61e6e83a0787d334c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364580
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-04-26 19:08:13 +00:00
Lasse R.H. Nielsen
b464fc9037 Reland "Tweak expect.dart library."
This reverts commit cd2c566bcf.

Reason for revert: Updating to not remove field used by Flutter engine.

Original change's description:
> Revert "Tweak `expect.dart` library."
>
> This reverts commit ff5f391c0a.
>
> Reason for revert: The expect library is used by Flutter engine, and some of its tests use assertStatementsEnabled. There should be a migration path that doesn't require an atomic change, like adding the replacement api before removing the old one.
>
> Original change's description:
> > Tweak `expect.dart` library.
> >
> > Make API more consistent for a few methods.
> > Reduce the number of language features used in tests:
> > * Never iterating an iterable, always converting it
> >   using `.toList()` first and iterating using indices
> >   (fx `setEquals`).
> >   Also require a `List` in places where an `Iterable`
> >   wasn't necessary.
> > * Avoid doing complicated computations that are also
> >   used for the error message. Do simple check first,
> >   then recompute to get better error messages
> >   (fx `allDistinct`).
> >
> > Renamed some rarely used members for consistency
> > (`stringContainsInOrder`->`containsInOrder`,
> > where other string-contains functions just start
> > with `contains`, and `containsOneOf` -> `containsAny`
> > to match `Iterable.any` phrasing, and also it accepts
> > if containing at least one, not precisely one.)
> >
> > Removed a function that wasn't used anywhere.
> >
> > Moved `assertStatementsEnabled` to `variations.dart` as `asserts`.
> > Removed `typeAssertionsEnabled` and `checkedModeEnabled`. The former used in one place, where it was replaced with `checkedImplicitDowncasts` from `variations.dart`, the latter wasn't used anywhere.
> >
> > Deprecates `package:expect/minitest.dart`. It was never intended
> > to be used for new tests, only as a help to convert existing tests
> > written against `package:unit_test`.
> > All existing imports marked as `// ignore: deprecated_member_use`.
> >
> > Change-Id: I07e21d4c0f3ccf11b82ee34af2668fdbb22264d2
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352360
> > Reviewed-by: Slava Egorov <vegorov@google.com>
> > Reviewed-by: Ömer Ağacan <omersa@google.com>
> > Reviewed-by: Nate Bosch <nbosch@google.com>
> > Reviewed-by: Stephen Adams <sra@google.com>
> > Commit-Queue: Lasse Nielsen <lrn@google.com>
>
> Change-Id: I360b4347470a0bb2b63c3108e2b83ee2a771bf3f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362020
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: William Hesse <whesse@google.com>

CoreLibraryReviewExempt: Reland
Change-Id: I53db40edc0733842a008839c3913d51c885e39ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362502
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-04-26 15:28:26 +00:00
Daco Harkes
94890c86c7 [vm] Resource Identifier fix loading units
The loading units were taken from the definitions instead of the
references.
This CL fixes that and adds test cases.

Add some doc comments and references to TODOs.

TEST=pkg/vm/test/transformations/resource_identifier_test.dart

Change-Id: I59a640344206555ae1b190521ee3e36d52199700
Cq-Include-Trybots: dart/try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-win-release-try,pkg-win-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364103
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
2024-04-26 14:49:20 +00:00
Chloe Stefantsova
54031e2752 [cfe] Ensure default values in synthesized function nodes
Closes https://github.com/dart-lang/sdk/issues/55529

Change-Id: Ic4738e9b8abc333a39ec52b642bbf844128ef61b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364325
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Chloe Stefantsova <cstefantsova@google.com>
2024-04-26 14:06:30 +00:00
Johnni Winther
dd3fbffac7 [cfe,analyzer] Support new as identifier in metadata
The parser didn't support 'new' as identifier in this context.

The CL also adds the reporting of tear-offs as metadata for the CFE.
This was already handled by the analyzer.

Change-Id: I7ab5868fa83e5f216d0e7be7ae9cec4a2c865e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364480
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2024-04-26 14:00:04 +00:00
Alexander Markov
9b07891e4f [vm] Unsound mode cleanup: disallow reading legacy types from kernel
TEST=ci

Change-Id: Ia4fb1dc04b5ed3dce04ba9455575836bbb5aec35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364560
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-26 13:58:27 +00:00
Alexander Markov
c9e386fe16 [kernel] Cleanup legacy types from kernel type checker
Change-Id: Iea66efe173d0f342e4257fe1976f7baaf14ff524
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364523
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-26 13:52:00 +00:00
Alexander Markov
29b4e5bff5 [vm] Unsound mode cleanup: remove legacy types from VM-specific kernel transformations
TEST=ci

Change-Id: I1de94863ed0c66497c9487fb4a9edf6e6d91ea5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364520
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-04-26 13:50:19 +00:00
Sergey G. Grekhov
cf564396d2 [co19] Roll co19 to c18ac1b2cb497b23fcb3c8d04cdab1069cd16e2b
2024-04-26 sgrekhov22@gmail.com Fixes dart-lang/co19#2622. Fix typo, add issue numbers (dart-lang/co19#2623)
2024-04-25 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmenting expression tests for setters (dart-lang/co19#2620)
2024-04-24 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmenting expression tests for getters (dart-lang/co19#2619)
2024-04-24 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmented expression tests for setters (dart-lang/co19#2618)
2024-04-24 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmented expression tests for getters (dart-lang/co19#2617)
2024-04-23 sgrekhov22@gmail.com dart-lang/co19#2559. Fix augmenting operators syntax (dart-lang/co19#2616)
2024-04-22 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmenting functions tests (dart-lang/co19#2615)
2024-04-19 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting functions signature tests. Part 2 (dart-lang/co19#2614)

Change-Id: I8c187cda88baa2e638f189e2a9251c479d14ad79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364502
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-04-26 13:06:30 +00:00
Jens Johansen
fc67d31862 [parser] Listener calls should not be on the next (unrelated) token
When the parser sends events to the listener some events has a pair of
parameters, `beginToken` and `endToken`. Most of these are constructed
in such a way that the `beginToken` is the first token and the
`endToken` is the last token in that construct. This is for instance the
case with `endClassDeclaration`.
It was, however, not the case for `endMetadata` where `endToken` instead
was the next token *not* in the metadata.

In this CL I've found a changed the following to point to the last token
in the construct instead of the next token not in the construct and
renamed the parameter where it made sense:

* `endAssert` --- and renamed `semicolonToken` (which only pointed to
  a semicolon for statements) to `endToken`.
* `endAwaitExpression`
* `endConstLiteral` --- and renamed `token` to `endToken`
* `endConstructorReference`
* `endFieldInitializer` --- and renamed `token` to `endToken`
* `endForIn`
* `endForInBody` --- and renamed `token` to `endToken`
* `endForStatement`
* `endForStatementBody` --- and renamed `token` to `endToken`
* `endFunctionExpression` --- and renamed `token` to `endToken`
* `endInitializer` --- and renamed `token` to `endToken`
* `endInitializers`
* `endInvalidAwaitExpression`
* `endMetadata`
* `endSwitchCase`
* `endTopLevelDeclaration` --- and renamed `nextToken` to `endToken`
* `endWhileStatement`
* `endWhileStatementBody` --- and renamed `token` to `endToken`
* `handleNoConstructorReferenceContinuationAfterTypeArguments`

In the few places in listeners where these values were used I've mostly
updated to do e.g. `endToken.text!` to retain the current behavior.

Change-Id: I25495e160d1eec5c75bcf1313b512cd04bcb1533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364322
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-04-26 06:59:23 +00:00
Konstantin Shcheglov
6e7aca792c Augment. Report AUGMENTATION_WITHOUT_DECLARATION in more places.
Change-Id: I2e38a31f987788e97cb61f0985aad0b6ef861582
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-04-25 21:29:28 +00:00
Konstantin Shcheglov
5c3cad7a33 Augment. getInterface() works only with declarations.
Change-Id: I37a81edd760ebd5b2aa7e54ba1c27c4bfc60ef31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364561
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-04-25 20:15:39 +00:00
pq
15798dd2f7 augmentation support for type_annotate_public_apis
Fixes: https://github.com/dart-lang/linter/issues/4893

Change-Id: I8984d76b9d752c74756a9c3947358f105ad70544
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-04-25 18:57:15 +00:00
Sam Rawlins
f759281cd8 meta: introduce TargetKind.optionalParameter
Fixes https://github.com/dart-lang/sdk/issues/55567

Change-Id: I45a1b6af9d9522b2f374ee627cc07f1d3fb47817
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-25 18:55:59 +00:00
Devon Carew
fb1dae4572 [deps] rev dartdoc, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (1ae5b4c..d9e31ff):
  d9e31ff9  2024-04-22  Sam Rawlins  Extract Canonicalization from the ModelElement hierarchy (dart-lang/dartdoc#3753)

webdev (d4f9f67..50bf268):
  50bf2687  2024-04-24  Elliott Brooks  Add `dwdsLaunch` and `dwdsAttach` events (dart-lang/webdev#2418)
  804eb5c5  2024-04-24  Elliott Brooks  Reset DWDS and WebDev after release (dart-lang/webdev#2419)
  988b03bf  2024-04-23  Elliott Brooks  Prepare webdev for release to version 3.5.0 (dart-lang/webdev#2417)
  68513c8f  2024-04-23  Elliott Brooks  Prepare DWDS for release to version 24.0.0 (dart-lang/webdev#2413)
  0b188169  2024-04-22  Elliott Brooks  Fix test timeouts related to weak null safety (dart-lang/webdev#2416)

Change-Id: Ie366c07cf46d7efb15d67322eac045e6a6bd7fe3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364522
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-25 18:38:10 +00:00
Sam Rawlins
f6828ddd8d DAS: Simplify CorrectionProducer, et al.
Just a lot of tidying in preparation for this code being public API
in the `analysis_server_plugin` package.

A big change:
* Convert `CorrectionProducer.assistArguments`,
  `CorrectionProducer.fixArguments`, and
  `CorrectionProducer.multiFixArguments` each from a `List<Object>?`
  to a `List<String>?`. This should be a no-op.

Smaller changes:
* Make private: `AssistProcessor.generators`, `.multiGenerators`,
  `.assistContext`, `.assists`,
* Make private: `CorrectionProducerContext.selectionOffset`,
  `.selectionLength`, `.utils`, `.sessionHelper`, `.unitResult`,
  `.applyingBulkFixes`, `.diagnostic`, `.node`, `.token`.
* Make private: `FixProcessor.fixContext`.
* Remove `CorrectionProducerContext.selectionEnd`, `.unit`, `.file`,
  `.session`, `.workspace`, `.typeProvider`; these can be accessed via
  getters.
* Remove unused `FixProcessor.computeFix()`.
* Make doc comments more idiomatic.

Change-Id: I100fe81aad612967191568fe207ff0b807f131b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-25 18:02:42 +00:00
Vyacheslav Egorov
b0535bddd6 [vm] Add pragma vm:unsafe:no-bounds-checks
This pragma instructs compiler to remove all bounds checks from the
annotated function. This can be helpful when tuning performance of
hot tight loops where compiler is unable to eliminate bounds check
itself.

For very tight loops I have measured 25-50% overhead from bounds
checks which I think comes from some combination of general code
quality issues due to fixed input registers and increased branch
density.

In future it could be possible to teach our range analysis to
eliminate bounds checks when loop bound is itself bounded by
array length, but for now we can resort to this pragma for
extremely hot library code.

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

TEST=vm/cc/BoundsCheckElimination_Pragma
R=alexmarkov@google.com

Change-Id: Ia7b1e88a16a2b45fa8593a227a4985568892b29c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364500
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-04-25 14:26:55 +00:00
Martin Kustermann
350954ae9d [dart2wasm] Fix this restoration code in sync* handling.
Noticed that the same bug that was fixed in [0] also exists in other
places.

=> Remove duplicated code & share in macro assembler.
=> Make use of this in async & sync* generator.

[0] https://dart-review.googlesource.com/c/sdk/+/364321

Change-Id: Id424ab5e8ed8ab70d19977d10cf80fb8b44b3872
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364441
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-04-25 10:38:35 +00:00
Daco Harkes
4b66657b98 [vm/ffi] address of operator for FFI leaf calls
During FFI leaf calls, the Dart GC will not run. This means that we
can pass pointers into `TypedData` to FFI calls that take `Pointer`
arguments.

After this CL, we have three types of arguments that can flow into
`Pointer` argument in an FFI call:
* `Pointer`.
* `TypedData`: Any typed data including views.
* `_Compound`: A TypedData/Pointer and an offset in bytes.

The is only possible for `@Native external` functions, `asFunction`
does not support passing in `TypedData`. (See related GitHub issues
for discussion. TLDR: FFIgen should generate bindings without config.)

`.address` expressions on `TypedData` and `Array` elements do _not_
introduce bounds checks, even though `TypedData` and `Array` have
bounds information. E.g. `ffiNative(Uint8List(10)[20].address)` does
not throw.

Implementation details:

The CFE analyzes call-sites to `@Native external` functions. If the
arguments are `.address` expressions, it transforms the call site to
pass the compound or `TypedData`. If an additional offset needs to be
applied, the CFE constructs a new `_Compound` with the correct offset
in bytes.

The CFE then also creates a new `@Native external` function which have
`TypedData`s and `_Compound`s parameters. To avoid name clashes, these
functions are postfixed with `#` and `P`, `T`, or `C` for each Pointer
parameter.

TEST=pkg/vm/testcases/transformations/ffi/address_of_*

In the VM, `TypedData` arguments are passed as tagged values, and the
address is loaded inside the `FfiCallInstr`. `_Compound` arguments
turn into two IL definitions, one for the `TypedDataBase` (tagged),
and one for the offset in bytes (unboxed). The address is then loaded
inside the `FfiCallInstr` and the offset in bytes is applied.

Adding the offset in bytes required an extra temp register for ia32.
Also, it uncovered that the temp register in arm32 was conflicting
with the argument registers. However, TMP should suffice instead.

TEST=tests/ffi/address_of_array_generated_test.dart
TEST=tests/ffi/address_of_struct_generated_test.dart
TEST=tests/ffi/address_of_typeddata_generated_test.dart

Closes: https://github.com/dart-lang/sdk/issues/44589
Closes: https://github.com/dart-lang/sdk/issues/54771

CoreLibraryReviewExempt: VM only, unsupported in dart2wasm
Change-Id: I01fb428cfd6f9096a34689c2819c124a8003cb6b
Cq-Include-Trybots: dart/try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360882
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-04-25 10:06:16 +00:00
Jens Johansen
8c1475c6c2 [CFE] Update parser ast and utils
Change-Id: I616b597826903dce4d4b38144eb8b729f5699bbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354229
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-04-25 08:55:59 +00:00
Konstantin Shcheglov
a96841ee31 Augment. Build extension type elements.
Change-Id: I4ca70585cd6b8463d6779a552bdc85e60ba6a87c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364421
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-25 00:13:39 +00:00
Konstantin Shcheglov
d0d8696f9a Write library units before augmentations.
This makes it consistent with how we build elements - first the
defining unit, then augmentations.

Change-Id: I1cfdca462392d8df19a864af22776759a8f9971a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364381
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-24 20:01:49 +00:00
Danny Tuppeny
1d8a9280da [analysis_server] Fix AddDiagnosticPropertyReference when in augmentations
Fixes https://github.com/dart-lang/sdk/issues/55312

Change-Id: I219e529a247814d8680babd07c30bf7a7a82747d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360043
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-24 19:49:33 +00:00
DEPS Autoroller
261715208e Roll gn from 155c53952ec2 to f284b6b47039
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/gn-dart-sdk
Please CC dart-ecosystem-gardener@grotations.appspotmail.com,dart-engprod@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in gn: https://bugs.chromium.org/p/gn/issues/list
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try;luci.dart.try:dart-sdk-mac-try;luci.dart.try:dart-sdk-mac-arm64-try;luci.dart.try:dart-sdk-win-try
Change-Id: I218df2606f843e25cafcd32ae1202bbe41dc3db1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364302
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2024-04-24 19:27:59 +00:00
Matan Lurey
dbd8e3fe32 Ignore abstract classes, mixins, sealed classes.
Bug: https://github.com/dart-lang/sdk/issues/52965, https://github.com/dart-lang/sdk/issues/55550
Change-Id: I8ec70f909f55663eb299764f0402c5a992729846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364206
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Matan Lurey <matanl@google.com>
2024-04-24 18:37:15 +00:00
Nate Biggs
6118b2f590 [dart2js] Fix missing offset logic from indexed sink source.
See https://dart-review.googlesource.com/c/sdk/+/363541 for more context.

Change-Id: Iaf681101410a2505376e0522bf1228035c088028
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364080
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-04-24 17:46:39 +00:00
Sam Rawlins
e06e82d8c8 DAS: Remove unnecessary BaseProcessor
It turns out the superclass of FixProcessor and AssistProcessor does
not buy us much:

* It has 1 method, which has one call site. The method is just two
  statements, so that can be inlined.
* It has 10 public final fields:
  * 5 of these were simply unused. Never referenced. 🤷
  * The other 5 were referenced, but only directly in the direct
    subclasses. These were set in the constructor, all coming from an
    "assist context" or a "fix context", which is ultimately a more
    direct way to reference them later in AssistProcessor and
    FixProcessor.

Change-Id: I2b1d20f2f79206d744ad4edeedc3463d4523cf0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364360
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-04-24 17:32:41 +00:00
Danny Tuppeny
2f2564c99f [dds/dap] Don't untruncate toString() values in debug views
Generally we don't untrucate values in the debugger in places where there might be lots of data (such as calling `toString()` on all variables) because it can cause performance issues if the variables are huge.

If you use the "Copy value" ("clipboard") or Debug Console evaluation ("repl") we _do_ always untruncate the values.

However, this code was always untruncating when we called `toString()` on custom classes. This changes it to no longer do so, making long string values consistent between what you see as the values of fields, and the `toString()` results against a class.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4986

Change-Id: Ica3c5ecfed9492ab76fbfa83d161765b3b24eb22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363320
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2024-04-24 15:54:24 +00:00
Danny Tuppeny
f7451f7a3f [dds/dap] Don't include empty output events when output ends with \n
Empty output events are harmless but unnecessary. The stack frame parsing code would always send one with the output ended with \n which until recently was only for stderr, but recently was enabled for stdout.

The extra events broke some Flutter tests that were not expecting them.

See https://github.com/flutter/flutter/pull/147250#issuecomment-2075128834

Change-Id: I13624f763d57a089d6b2d2c9e794cafb6a2f0023
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364340
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
2024-04-24 15:37:21 +00:00
Danny Tuppeny
8d5794aa70 [analysis_server] Fix missing types on factory constructor arguments in LSP completion
There are two fixes here, either of which solve the problem but it seemed like both should exist:

1. Always set "element" on an argument suggestion, not only if it's a field formal
2. In LSP mapping, use the "parameterType" from a suggestion in addition to other fields to find the type

Fixes https://github.com/Dart-Code/Dart-Code/issues/4943

Change-Id: Iba21c94a157bfca4d53daad203d518d9fa765a59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-04-24 15:12:10 +00:00
Ben Konyi
ec34e34d12 [ VM ] Remove hard coded line and token numbers from JSON_JSONStream_DartObject
Fixes https://github.com/dart-lang/sdk/issues/51389

TEST=json_test.cc

Change-Id: I303c5981d8fd43d82e2498410f6d2abc6b3f5bc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364221
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-04-24 14:44:28 +00:00
Vyacheslav Egorov
d801cb4f19 [vm] Fix pragma vm:unsafe:no-interrupts
It was not removing all CheckStackOverflow instructions.

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

TEST=vm/cc/CheckStackOverflowElimination_NoInterruptsPragma

Change-Id: I1a3db6539951ab4b6450804393c89bc6aafff5b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364324
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-04-24 14:17:30 +00:00
Sam Rawlins
1b400ed68d DAS plugins: Move CorrectionUtils to analysis_server_plugin
* Move the only 3 files from server_plugin to analysis_server_plugin.
* Copy some test infra into analysis_server_plugin. This is temporary,
  as we need some shared test infra location.

Change-Id: If2b41d436c9d3051e590f60ae2eb7ab31e529321
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364161
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-24 14:12:24 +00:00
MarkZ
9d08a13721 [reload_test] Adding support for negative tests in reload suite.
* Extends the frontend server controller to validate/reject compile errors in compiles/recompiles.
* Extends the config to permit an 'expectedError' entry.
* Adds a handful of tests to the suite (adapted from the VM's hot reload tests).

Change-Id: I47d814e375c4c72d0406ebf5bdfee3f1975c64f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363800
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2024-04-24 12:45:44 +00:00
Daco Harkes
c42fd69433 [gardening] Skip test in iso-stress
Closes: https://github.com/dart-lang/sdk/issues/55554
Change-Id: I2ca3ecab0d0f985fb1aa50aa12ded52469d08d8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364323
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-04-24 11:00:07 +00:00
Martin Kustermann
e44bc22ca3 [dart2wasm] Fix bug in restoration of this in async functions.
When entering async functions we read the suspend-state's context and
populate local variables with the context parent chain as well as the
this pointer.

This restoration code assumed that `this` is stored in the outermost
context, which isn't necessarily the case.

In constructors the outermost context can contain the type parameters.

TEST=tests/web/wasm/capture_type_and_this_test.dart

Change-Id: Ie8e3c8732203aea4964d48cb78c97578d0322b2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364321
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-04-24 10:03:00 +00:00
Vyacheslav Egorov
2a2781edff [vm] Add vm:align-loops pragma
This pragma forces compiler to align loop headers within the
function by architecture specific boundary: 32 bytes on X64
and ARM64 (with the exception of Apple Silicon, which explicitly
discourages aligning branch targets in the optimization manual).

Current implementation is rather naive and does not do any
attempt to decide whether aligning is actually profitable
based on loop body itself.

I have found this pragma to be helpful both to stabilize
benchmark results and achieve better performance
for tight loops on Intel hardware.

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

TEST=vm/dart/align_loops_test

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_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-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-aot-win-product-x64-try,vm-aot-win-release-arm64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-simriscv64-try,vm-aot-dwarf-linux-product-x64-try,vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try
Change-Id: Ic22fb90d85e7fdebeeaa3908a43328c59436ab58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364121
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-04-24 08:52:18 +00:00
Ömer Sinan Ağacan
39276e9bd4 [dart2wasm] Simplify libraries.yaml setup:
Move common libraries of wasm and wasm_js_compatibility to wasm_common,
remove wasm_base.

Change-Id: I0293cfd11b58be3d921413fdb2fff7171f0b3d4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-04-24 08:04:58 +00:00
William Hesse
c10ecb8fe5 [test] Convert most lib/mirrors multitests to static error tests
Change-Id: I4f3b728a94291bf0a31a5f38af9d8b877a9900af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363702
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2024-04-23 23:33:48 +00:00
William Hesse
d6c9c9f8bf [test] Convert syntax_native_test to a static error test
Multitests of compile-time errors should be converted to static
error tests, so they don't run on runtime configurations.
Static error tests also test for all the static errors,
their positions, and error message, in a single test run.

This test is currently failing on the common front end,
and on all runtimes, and passing on the analyzer. The
change keeps the failure on common front end by adding
expectations for an error to be reported at the right places.

Bug: https://github.com/dart-lang/sdk/issues/54153
Change-Id: Ic64961f6e0e575ec60626d4f70a0fdc5d71d024e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363085
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-04-23 23:11:17 +00:00