Commit graph

100395 commits

Author SHA1 Message Date
Konstantin Shcheglov 19decc4270 QAF. Updates for SplitMultipleDeclarations.
Use all tokens of the declaration, otherwise static fields don't work.
Tests for fields.
Updates to the implementation.

After https://dart-review.googlesource.com/c/sdk/+/359280

Change-Id: Ibebe035ae664ca46b789fe80474ef041a9f8dea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359340
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-25 17:35:05 +00:00
Alexander Aprelev 2bc1ace7fc [vm/compiler] Let SIMD values become constants.
Reland of bdacbb8dec

Patchset 2 has fixes for tests failing in the reland.

TEST=ci

Change-Id: I1053ef653d4112d3998070cc4fc098d19d8ff264
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357440
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2024-03-25 17:33:01 +00:00
Srujan Gaddam 47f08fb143 [dart:js_interop] Change several operators back to JSBoolean
Related issues:
https://github.com/dart-lang/sdk/issues/55024
https://github.com/dart-lang/sdk/issues/55267

These operators were initially broken in 3.3 and were exposed
as returning JSBoolean but implemented as returning bool. They
were fixed to return bool in the public API, but we should
prefer to have them return JS types as they're likely to be used
in cases where implicit conversions are not useful.

CoreLibraryReviewExempt: Fixing type mismatch in backend-specific library.
Change-Id: I3b0e60550dcac78918f8399d11238dcfa34982cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359180
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-03-25 17:05:36 +00:00
Jonas Termansen 7c51a86267 [infra] Remove .packages OWNERS rule.
Fixes: b/331161789
Change-Id: Ib94b84ce89f7b70ab1af41e36fd2e1a44f5f4ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359460
Auto-Submit: Jonas Termansen <sortie@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-03-25 15:43:48 +00:00
Sigurd Meldgaard 63c507642f Bump pub to 3f0df78417f7c112b933fbcdc1c5c87bde680cb1
Changes:
```
> git log --format="%C(auto) %h %s" 4a0cd04..3f0df78
 https://dart.googlesource.com/pub.git/+/3f0df784 Close the global http client after `ensurePubspecResolved` (4199)
 https://dart.googlesource.com/pub.git/+/9532f0a8 Let add and remove act upon the work pubspec (4196)
 https://dart.googlesource.com/pub.git/+/2ce3da14 Remove stray lockfiles and packageconfigs from workspace (4194)
 https://dart.googlesource.com/pub.git/+/a44e2e51 Tests of workspace error handling (4195)
 https://dart.googlesource.com/pub.git/+/2179b765 Resolve workspace root and workPackage when invoking pub from any sub-directory (4186)
 https://dart.googlesource.com/pub.git/+/7a668d12 Update repository specification with info about the 'pub_display_url' field (4193)
 https://dart.googlesource.com/pub.git/+/cf9ba6c5 Use local pub in binstubs when testing (4192)
 https://dart.googlesource.com/pub.git/+/0b8a261e Import package:path `as p` everywhere (4187)
 https://dart.googlesource.com/pub.git/+/2a7c0e92 Update repository specification with info about the 'affected[].versions' fields in advisories (4191)

```

Diff: https://dart.googlesource.com/pub.git/+/4a0cd0403f70382feca9e17ae8854ffbef0fee98..3f0df78417f7c112b933fbcdc1c5c87bde680cb1/
Bug: https://github.com/dart-lang/sdk/issues/55289
Change-Id: Ifc2e6280cfbb83b463dd197b463d6841f0528e3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359480
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2024-03-25 15:19:58 +00:00
Chloe Stefantsova 5b0bf46bd2 [cfe] Implement sufficiency checks for the rest of type shapes
Part of https://github.com/dart-lang/sdk/issues/54998

Change-Id: Ib33391d56208e66dba0396da712ca05d21faece0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358453
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-03-25 14:45:52 +00:00
David Morgan 2d7af14120 [macros] Find platform from resolvedExecutable then from target dill.
`resolvedExecutable` is always running on the host, so this makes much
more sense than starting from the target which may be a different
platform. Still try from the target dill if that doesn't work: if the
running tool is a third party tool using the CFE as a library then
that might be the best we have to go on.

R=jakemac@google.com, johnniwinther@google.com

Change-Id: If73dc49e8ee4eb2bc729d9713fa50ddd4ccbccf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359062
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
2024-03-25 11:06:17 +00:00
Jonas Termansen 54cd684549 Remove additional --no-goma options since it's the new default.
Bug: b/296994239
Tested: Commit queue
Change-Id: I04f61149c1466db965866e95ffc6dccc457460d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359065
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
Auto-Submit: Jonas Termansen <sortie@google.com>
2024-03-25 10:35:49 +00:00
Alexander Markov 35d8630176 [vm] Make String.codeUnitAt monomorphic
The new implementation of String.codeUnitAt is always inlined and
doesn't depend on the polymorphic inlining of recognized methods.

String.codeUnitAt now has a custom body in the flow graph builder
which  performs non-speculative bounds check and then branches between
OneByteString and TwoByteString. Corresponding graph intrinsic and
native method are removed.

This change also fixes passing of unboxed arguments to runtime
in the slow path of GenericCheckBound instruction in JIT mode
(when shared stubs are not used).

TEST=ci

Change-Id: Iab2805fc752df84c37089165f828e31aca5f043f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359000
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-03-24 14:50:17 +00:00
Konstantin Shcheglov c61aecda75 Completion. Issue 55167. Suggest type names for DeclaredVariablePattern, in SwitchPatternCase.
Bug: https://github.com/dart-lang/sdk/issues/55167
Change-Id: I1f00fd0ea589786767443d97e7c74b7f482ba4be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-23 17:01:30 +00:00
Lasse R.H. Nielsen 5acb2132f8 Constant evaluator won't assume all dart.library.x entries exist.
The existing implementation assumed, hardcoded, that the compilation
environment had an entry for any string of the form `dart.library.`+X,
with a value of either `"true"` or `""`.
This did not match the runtime behavior of the standalone VM,
which allows non-constant access to the compilation environment.

Changed to only have entries with value `"true"` for libraries
which exist.
This changes the value of `bool.hasEnvironment` or a
`String.fromEnvironment` or `bool.fromEnvironment` with a
non-default `defaultValue`.
The existing behavior was that `bool.hasEnvironment` was always true,
and that the other constructors ignored the `defaultValue`,
so most likely such tests or `defaultValues` aren't used anyway.

Fixes #53815

Bug: https://dartbug.com/53815
Change-Id: I995bb34b5ab04b39a8a588d6a59c0027a0fe855c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331261
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-03-23 11:18:46 +00:00
Nate Biggs 6bc1b01241 [dart2js] Eagerly serialize generated impacts so that they can be GCed immediately.
When dump info data is being serialized as part of the codegen + emitter joint phase, all the impacts are considered "generated" and so they must all be serialized with the dump info data. If we wait to serialize them until the end of the phase as we usually do, these impacts cannot be GCed right away. This leads to a much higher memory footprint. By serializing them eagerly we can GC the object and just maintain the much leaner serialized data.

Change-Id: I11606f7291fe8d86af1f72724bd8c68e9666a00a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359300
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-03-23 03:58:52 +00:00
pq 19665111e5 remove unnecessary library names
Fixes generated using `dart fix --code=unnecessary_library_name --apply`

See conversation in https://github.com/dart-lang/lints/issues/181

Change-Id: Id2b975e4aa27348d8883f1aea22e00dd9f4fc493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-22 23:45:30 +00:00
pq a19c07ffd4 guard against empty entity lists
Unable to repro the reported issue, but this will at least protect against the exception.

Fixes: https://dart-review.googlesource.com/c/sdk/+/359280

Change-Id: I712f9b92879ca6b80b2f1004206e4f77a3178a47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359280
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-22 23:02:33 +00:00
pq 970582ec20 fix options map sorting
Fixes: https://github.com/dart-lang/sdk/issues/55252

Change-Id: I2dbd0513039903ed95265d4546163f68236d88e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-22 21:24:50 +00:00
pq 4145eeba06 don't replace is{Not}Empty for nullable targets
Fixes: https://github.com/dart-lang/sdk/issues/55250

Change-Id: Iae692c0f6a36e7fc89028acd1934580d1648c937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359262
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-22 21:24:41 +00:00
Keerti Parthasarathy ef3eb6b301 Modify completion test to address comments.
Change-Id: Ib5d1237e9008a9ec1b68558894c3cc15d17347ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359242
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-03-22 19:17:29 +00:00
Konstantin Shcheglov 5a65760042 Completion. Rework KeywordSuggestion to better constructors.
As requested in https://dart-review.googlesource.com/c/sdk/+/359240

Change-Id: I5047afaddfd74310303001669177f725aac9c02c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 19:04:39 +00:00
Tess Strickland 291051e02d [vm/compiler] Add an instruction to adjust unsafe untagged addresses.
ComputeElementAddress takes a base untagged address, an index, an index
scale, and an offset and returns base + (index * scale) + offset as an
untagged address.

This removes the last conversions between untagged and unboxed integers
for untagged GC-movable pointers. The only remaining conversions are
the following cases, which all involve non-GC-movable pointers:

1. Calls to the FFI resolver (on IA32 only).
2. Returning nullptr when a pointer to memory is expected in
   exceptional returns from FFI callbacks.
3. Converting user-provided integers to FFI pointer objects and back.

In addition, we no longer add the data field to materializations of
typed data views, but instead recompute the data field in
DeferredObject::Fill(). This removes the last source of unsafe untagged
pointers that may have arbitrary lifetimes in the flow graph.

Thus, we can now verify in the FlowGraphChecker that there are no
GC-triggering instructions between the creation of an untagged
GC-movable pointer and its use (including the use itself). To do this,
this CL adds a predicate MayCreateUnsafeUntaggedPointer to definitions,
which by default returns true for kUntagged results, false otherwise,
and should only be overwritten in cases where the result can be proven
to not be a untagged GC-movable pointer.

TEST=vm/dart/regress_54710_il_test
     vm/cc/AllocationSinking_NoViewDataMaterialization

Fixes: https://github.com/dart-lang/sdk/issues/54710
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-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-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-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-linux-debug-ia32-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-release-ia32-try
Change-Id: Ie172a8bd0330a728a4f151478664a530f8d9b38a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354862
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-03-22 19:03:31 +00:00
Konstantin Shcheglov 2447f1a973 Completion. Issue 55275. Suggest expressions in AssertStatement condition and message.
Bug: https://github.com/dart-lang/sdk/issues/55275
Change-Id: Icda00b5f472db29bfba8b58bd1a022bf43525221
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359260
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 17:19:05 +00:00
Danny Tuppeny 683917ddd7 [analysis_server] Change flag for enabling LSP virtual document support
This accepts the flag without a suffix because I'm fairly confident we can ship this support without breaking changes to the API.

For a short period, the old flag is still supported so that Dart-Code + SDK don't need to be updated at the same time to avoid the support disappearing. I will remove the old flag in a few weeks (after a beta SDK branch and a stable Dart-Code release).

Change-Id: I246a33f37a5d5fc5c05c15daab7d87d4cc4fd9e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359064
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-03-22 17:01:40 +00:00
Konstantin Shcheglov f1a064cd8a Completion. Issue 55276. Suggest 'part of' and URI completion in it.
Bug: https://github.com/dart-lang/sdk/issues/55276
Change-Id: I7cc4bb94a06115899de941d2e72aa5efeb8831b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359240
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 16:24:31 +00:00
Danny Tuppeny df0b1f74f7 [analysis_server] Tidy up LSP tests failTestOnAnyErrorNotification to be implied when using expectErrorNotification
This is a small tidy up that changes `failTestOnAnyErrorNotification` to be automatically set when using `expectErrorNotification` so there's slightly less noise in tests.

Change-Id: I44056a23aca872b8e96109be4d4ba4356b8af53d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359221
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 16:06:58 +00:00
Konstantin Shcheglov 219f8a9013 Completion. Issue 55167. Suggest type names for DeclaredVariablePattern.
Bug: https://github.com/dart-lang/sdk/issues/55167
Change-Id: I3fad2f2559bf8677afbe893d8d147a0d443e441a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359121
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 15:48:49 +00:00
Chloe Stefantsova 4d9aeda9a8 [cfe] Use StructuralParameters in TypedefTearOff and TypedefTearOffConstant
Change-Id: I6b221f36065b78c985c8a216b1ac43f9e518bb3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358905
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-03-22 13:01:05 +00:00
Jonas Termansen e8ed498902 [infra] Remove --no-goma from test matrix.
Goma is off by default, and RBE is only enabled where it is known to
work, so there is no need to disable RBE instead. Some of these builders
additionally disable RBE in their infra/config definitions and there is
no need to duplicate that information here.

Bug: b/296994239
Change-Id: I9f9733ba5189b53b899289a23d68126f7c6adcc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357610
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2024-03-22 12:21:39 +00:00
Tess Strickland 1cebdcb2da [vm/ffi] Use untagged pointer representations for FFI pointers.
Previously, the FFI used unboxed integers as a native representation
for pointers in FFI code, as the compiler only handled very specific
uses of untagged pointers flowing between instructions. Since then,
this restriction has been removed for untagged pointers that do not
point to memory managed by the GC, like FFI pointers, so now they can
have a more precise representation.

By being precise about when untagged (untagged pointers to freshly
allocated Handles and the contents of Pointer data fields) and tagged
(TypedData objects constructed to hold the byte representation of
compound data) values are expected, we can remove the need to have
untagged pointers to GC-movable objects and/or having untagged
pointers escape as unboxed integers in the generated IL.

This CL also renames kUnboxedFfiIntPtr -> kUnboxedAddress and limits
its uses specifically to where the unboxed integer represents the
numeric representation of an untagged pointer.

This CL changes CCall to take Representations for the arguments and
return value instead of what looks like an arbitrary
NativeCallingConvention. However, the serializer and deserializers for
CCall, used in IL tests, originally assumed that the argument and return
representations were kUnboxedFfiIntPtr, so providing an arbitrary
NativeCallingConvention which didn't match that assumption would cause
failures during IL tests. That assumption came from the fact that
the only creator of CCall instructions was in kernel_to_il.cc, and there
that was the case.

Now CCall builds the native calling convention during construction
and deserialization from the argument and return representations and
stores both the representations and built native calling convention
internally. In the future, if we want to create CCall instructions with
more arbitrary native calling conventions, then we'll need to handle
serialization/deserialization of arbitrary native calling conventions,
and also add consistency checks that the provided representations
appropriately match the native calling convention.

TEST=ffi vm/dart/regress_306327173_il vm/dart/address_local_pointer_il

Issue: https://github.com/dart-lang/sdk/issues/54710
Cq-Include-Trybots: luci.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-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-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-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-release-ia32-try
Change-Id: I34effe8fbdc80288b703e0152d5ba67ce2343400
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353101
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2024-03-22 10:20:48 +00:00
Tess Strickland a6a3434404 [vm/compiler] Use temps instead of writable registers in MemoryCopy.
This keeps the array registers unchanged across the instruction,
which can save instructions if there are unused registers to allocate
for the temporaries and the source or destination registers are live
after the copy (e.g., if the destination array is then used in a
LoadIndexed instruction post-copy).

On IA32, we still use writable registers due to register pressure.

TEST=ci

Change-Id: Ia955f8db39e4aba0f01b9d06ea50992a7375a492
Cq-Include-Trybots: luci.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-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-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-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-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357901
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-03-22 10:17:11 +00:00
Tess Strickland 0d3ade255b [vm/compiler] Limit exposure of untagged pointers to managed memory.
After https://dart-review.googlesource.com/c/sdk/+/330600, there were
more chances for the optimizing compiler to introduce or move
GC-triggering instructions like allocations or boxings between the
retrieval of an untagged pointer to GC-moveable memory and its use.

To limit the chance of this happening, this CL removes the explicit
loading of the untagged payload address when building the initial
flow graph in most cases when the array is not known to be an external
array (an external string, an external typed data object, or an FFI
Pointer).

The remaining case is during view allocation, which extracts the
payload address of the base typed data object underlying the view
(which may be GC-movable) to calculate the payload address that should
be stored in the data field of the view object. See
https://github.com/dart-lang/sdk/issues/54884.

During canonicalization of LoadIndexed, StoreIndexed, and MemoryCopy
instructions, if the cid of an array input is an external array
(external string, external typed data object, or Pointer), then a
LoadField instruction that extracts the untagged payload address
is inserted before the instruction and the corresponding input is
rebound to that LoadField instruction.

Once all compiler passes that involve code motion have been performed,
a new pass looks for LoadIndexed, StoreIndexed, or MemoryCopy where
the cid stored in the instruction for the array is a typed data cid.
In these cases, if the array is not an internal typed data object,
then the payload address is extracted. Waiting until this point ensures
that no GC-triggering instructions are inserted between the extraction
of the payload address and the use. (Internal typed data objects are
left as-is because the payload address is inside the object itself
and doesn't require indirection through the data field of the object).

This CL also replaces code conditional on the array cid with code
that is instead conditional on the array element representation in
cases where it makes sense to do so, since this is a less brittle
check than checking the array cid (e.g., checking for kUnboxedInt8
to load, store, or copy an signed byte from an array instead of
listing all possible array cids that store signed bytes).

This CL also fixes an issue with the ARM64 assembler where calling
LoadFromOffset with an Address that has a non-Offset type would
silently generate bad code instead of triggering the ASSERT in
PrepareLargeOffset.

TEST=vm/dart/typed_list_index_checkbound_il_test

Issue: https://github.com/dart-lang/sdk/issues/54710
Cq-Include-Trybots: luci.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-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-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-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-release-ia32-try
Change-Id: I25b5f314943e9254d3d28986d720a5d47f12feeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352363
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-03-22 10:12:39 +00:00
Jonas Termansen 495d08eca8 [infra] Disable goma by default in favor of RBE.
Bug: b/296994239
Change-Id: I99e1dcfb1016cbb064a742d8cc930f3468d26f3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358161
Reviewed-by: William Hesse <whesse@google.com>
Auto-Submit: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2024-03-22 10:09:06 +00:00
Jens Johansen 529d2c78d0 [CFE] update_expectations.dart can also run multiple special suits
E.g. the below command should update both strong, weak, etc and
incremental, parser etc suites with any test containing ffi:

`out/ReleaseX64/dart pkg/front_end/tool/update_expectations.dart *ffi*`

In the future we should, I think, update the tool to be more like
`unit_test_suites.dart` and get rid of the option for package:testing
to generate a program and then run that.

Change-Id: I19edfe2198cbe86326396dc2c8a8f871c599588d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359061
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-03-22 09:12:22 +00:00
Dan Chevalier b626c255eb Updating DTD docs to ensure they are ready for the consumption.
Change-Id: Iccbf88959bbd68bac897e3f5b05dbf5fe2a0a4bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/355460
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
2024-03-22 01:28:39 +00:00
Konstantin Shcheglov e5a60de9d8 Completion. Migrate UriContributor.
Change-Id: If2b50d47736277eca2a2f4a20189cdb14d775f17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359080
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-22 00:56:15 +00:00
Konstantin Shcheglov 9f64559a8d Completion. Issue 55263. Suggest formal parameters in AssertInitializer.
Bug: https://github.com/dart-lang/sdk/issues/55263
Change-Id: Id210e1c98f9c8f5e20c09e6cade6c9893bd40761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-22 00:13:09 +00:00
Konstantin Shcheglov 3ca76a245a Completion. Migrate LibraryPrefixContributor.
Change-Id: I26e3a2d2a4d724262a5444580987ab9ad8ca9507
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358665
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-21 22:44:02 +00:00
Ryan Macnak 4b5d3e05e9 [vm, gc] Use temporal coarsening when accounting for old-space bump pointer allocations.
To avoid accounting overhead during each bump pointer allocation, we add the size of the whole bump area when starting to use that area and
subtract the remaining size when switching to a new area.

TEST=ci
Change-Id: If0c429db47c27ca51aac5c055268e85f70bad9ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359160
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-03-21 22:22:42 +00:00
Jake Macdonald 5a8bc19faf add skeleton for _macros package
Change-Id: I9a4a84e4292b7fef1de76222a540c341ed041e51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359041
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
2024-03-21 21:22:12 +00:00
Konstantin Shcheglov fc168c6a5f Completion. Migrate EnumConstantConstructorContributor.
Change-Id: If09014bad3467a9c0933d4f8aad6950051172efe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358683
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-21 21:18:29 +00:00
Ben Konyi 5536951738 [ DDS ] Rework client resume permissions API
This change reworks the client resume permissions API to make it easier
for clients to deal with user provided `--pause-isolates-on-start` and
`--pause-isolates-on-exit` flags.

`requireUserPermissionToResume` should be called by the tool that
launches the Dart process to indicate whether or not the user provided
`--pause-isolates-on-{start,exit}`. The default behavior is to assume
that a tool set these flags for its own use (e.g., resetting breakpoints
after a hot restart in Flutter), where isolates will resume immediately
after each client that has indicated interest in that pause event has
invoked `readyToResume`.

If a user provided one of the previously mentioned flags, isolates will
not immediately resume after each relevant client has invoked
`readyToResume`. Instead, a call to `resume()` must be made to indicate
the user has triggered the resume request instead of tooling. If the
user permissions to resume are changed while the isolate is paused and
all relevant clients have invoked `readyToResume`, the isolate will
automatically resume if the user no longer requires us to wait for a
user resume.

`resume()` now also acts as a "force resume", bypassing any required
permissions set by tooling.

This behavior change is breaking, so the DDS protocol version is being
bumped to 2.0.

`package:dds_service_extensions` has also been updated to include the
following DDS RPCs:

 - `requireUserPermissionToResume`
 - `readyToResume`

Change-Id: Id5f0806b3c56507d39eb00b6305b8896bab13ae7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357420
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-03-21 21:09:42 +00:00
Ben Konyi 6eb85949fd [ VM / DDS ] Add --print-dtd-uri flag and launch DTD from the correct snapshot for AOT
This adds support for printing the DTD connection information to stdout
when --print-dtd-uri is passed.

This change also fixes an issue where DDS would fail to spawn an isolate
with the DTD snapshot when DDS was running in AOT mode. This means the
SDK must be shipped with both AppJIT and AOT DTD snapshots, at least
until dartdev is moved to run from AOT.

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

TEST=run_test.dart

Change-Id: I788ef9bfe76297a8d594992a2aac440ed9e2ecac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358541
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-03-21 19:50:46 +00:00
Devon Carew 87df8c4691 rev to the latest package:args; update pkg/dartdev
Change-Id: I7535e4c9cd9afb78905525fc0986dc6d60894362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358225
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-03-21 17:15:58 +00:00
Sam Rawlins 4c689ca7f5 das: Extract CorrectionUtils.getTypeSource; tidy ExtractMethodRefactoring
This is mostly a very tidy extraction of `getTypeSource`. This method
relied on a handful of helper functions, all of which were _only_
present in order to help `getTypeSource`. This method also does not
rely on `_buffer` or `eol`. And it is only used by one piece of code,
`extract_method`. Almost a slam dunk!

However, there appeared some strange caveats that I must document
here:

CorrectionUtils also featured two mutable fields, `targetClassElement`
and `targetExecutableElement`. Theoretically, these fields are
supposed to be set before calling `getTypeSource`, to help understand
whether a TypeParameter will be visible when extracting a method, or
something like that. But it appears to be totally broken:

* The singular caller of `getTypeSource`, `ExtractMethodRefactoring`,
  _never sets those fields_.
* Two other pieces of code, the AddTypeAnnotation fix, and the
  CreateField, CreateFunction, and CreateOverrides fixes, all set the
  fields, but _never call getTypeSource_.

Since this all looked like just very stale / rotten code, I removed
everything which looks to be dead: `targetClassElement` and
`targetExecutableElement`, and lo and behold: no tests fail! I've kept
those things deleted, and added a TODO for TypeParameters.

Lastly, since I was trying to figure out ExtractMethodRefactoring, I
tidied it up:

* Make it final
* Rename `ERROR_EXITS` to `errorExits`
* Privatize `searchEngine`, `resolveResult`, `selectionOffset`,
  `selectionLength`, `librariesToImport`, and `variableType`.
* Both `selectionRange` and `utils` could be final as they were set
  in the constructor body, so move that to initializers, make final,
  and make private.

Change-Id: Ia3fb948e5424971eb4250e711c179707552ad8aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358663
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-21 17:07:43 +00:00
Paul Berry 701cd77844 Ignore TODO in pkg/analyzer_plugin.
The analyzer team has decided to adopt the convention of using `TODO`
comments to document long term issues that should persist in the
codebase, and `FIXME` comments to document short term issues that need
immediate attention.  They may even consider adding a presubmit hook
to ensure that `FIXME` comments are only used during local
development.

Accordingly, it makes sense to suppress `TODO` comments from being
surfaced to the IDE "problems" view (since there are hundreds of them,
and they're not immediately actionable).  This makes VSCode's
"problems" view much more usable in "tree" mode.

(See also https://dart-review.googlesource.com/c/sdk/+/295662, which
made the corresponding change to the `analysis_server` and `analyzer`
packages, and https://dart-review.googlesource.com/c/sdk/+/325121,
which made the corresponding change to the `linter` package).

Change-Id: Ifbd2f6bed468408b1906b25ab94f745eed0b3e55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-03-21 16:38:11 +00:00
Keerti Parthasarathy 5119fb93c4 Completion Issue 52839: Show local declarations intead of global when shadowed.
Fixes https://github.com/dart-lang/sdk/issues/52839.

Change-Id: I84c112d2aff9cb60c829d366c14a621558eb7712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2024-03-21 16:22:38 +00:00
David Morgan 56f2e00fd6 [macros] Skip macro library augmentations when considering input sources.
Add `package:front_end/src/api_prototype/macros.dart` for utilities
related to compiling macros. Export `isMacroLibraryUri`.

Use `isMacroLibraryUri` instead of hard-coding in a few places.

Add TODO about need to handle macro deps to places that are currently
listing sources as deps.

R=jakemac@google.com, johnniwinther@google.com

Change-Id: I5d2473b810afd42f487178f0aad995804da945c4
Tested: Manually tested with Flutter; e2e tests will be added under tests/macro_build.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
2024-03-21 15:54:19 +00:00
David Morgan d45e3d1bac [macros] Really find platform for Flutter desktop and web builds.
The released layout is different from the "building Flutter to work on
it" layout, this should work for both. Of course, an end to end test
is needed--work in progress.

R=jakemac@google.com, johnniwinther@google.com

Change-Id: Ida664b6da62d8fd3b66b877f0441e771269d4fe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358443
Commit-Queue: Morgan :) <davidmorgan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
2024-03-21 12:01:14 +00:00
Vyacheslav Egorov df80cf9140 [core] Improve JSON decoding performance
Avoid polymorphic character access by turning _ChunkedJsonParser
into a mixin instead of the base class.

TEST=ci

Change-Id: Id2080724e07d16e96734a80629c8bd8906dc590b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358445
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-03-21 11:10:10 +00:00
なつき 867610409a [infra] Update alpine sysroot
Closes https://github.com/dart-lang/sdk/pull/55255

GitOrigin-RevId: d754c894720403f1a4c712855ed3fc718b6d2d06
Change-Id: I577f03977025156f14dc7207c0a50fde6fc0c10c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358860
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-03-21 10:43:15 +00:00
Chloe Stefantsova 6f4e0b403c [cfe] Add non-inferred not unaliased invocations into delayed queue
Such invocations were simply skipped before, remaining not unaliased
in the output Kernel code, which prevented evaluating them as
constants.

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

Change-Id: I3a54f7c806a0c4fbd8158691be113bd2deae04f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357621
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-03-21 10:40:50 +00:00
Vyacheslav Egorov 395b024685 [vm] Use codegen block order in regalloc in AOT.
Codegen block order keeps loop blocks together and reflecting that in
live ranges allows to produce better register allocation decisions.

Consider for example the loop:

    v = def();
    while (cond) {
      if (smth) { // (*)
        use(v);
        return true;
      }
    }

If block (*) is interspersed with loop blocks the register allocator
might decide to allocate it to the register in some of the loop blocks.
If the same block is "sunk" away from loop blocks - the register
allocator can clearly see that `v` does not necessarily have to live on
the register in the whole loop.

In JIT codegen block order is not topologically sorted and as such
is unsuitable for our linear scan.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-linux-release-x64-try
Change-Id: I0726815db998b559267949e157cd2158f5dd55f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358448
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-03-21 10:35:11 +00:00