Commit Graph

103037 Commits

Author SHA1 Message Date
Vyacheslav Egorov e2efffa005 [vm] Simplify implementation of native ports
This reland commit 5a32d8bc7c with a fix
for thread leak (Issue #56717): when `ThreadPool` is shutting down
asynchronously the last worker should detach itself to prevent
leaking associated low-level data structures, because no thread will
join it.

A hang in service isolate shutdown (caused by an existing bug) was fixed by commit 157a0dc7f9.

This CL turns native ports into a thin abstraction over underlying
thread pool instead of building them as full fledged MessageHandler.

This allows to easily implement a variation of native ports which can
handle messages concurrently with the given degree of concurrency.
This type of port can be used to greatly simplify implementation of
IOService - which previously had to do its own concurrency management
on top of "single threaded" native ports. This capability is exposed
as `Dart_NewConcurrentNativePort` API.

The new implementation is in general much cleaner then the old one
with one exception: `Dart_CloseNativePort` API has unfortunate design
where underlying message handler is destroyed asynchronously and
`Dart_CloseNativePort` returns immediately without waiting for pending
tasks to complete. Implementing this on top of `ThreadPool` requires
some changes to thread pool implementation.

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

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

TEST=ci

Change-Id: Ic68bfb60757685afd75c80a70cdec66cc13c149b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/385000
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-09-12 15:16:12 +00:00
Alexander Markov 24eafd67d3 [vm/interpreter] Fix return value and type arguments in constructor tear-offs
TEST=ci

Change-Id: Ibe1ede1bc1c4e044285ee3b3f75ca138d7596e8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384682
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-09-12 15:15:08 +00:00
Johnni Winther d2302c441f [cfe] Create SourceExtensionBuilder via fragments
Change-Id: If46a906fc70f7af6cc6bb2f2fa7ef779a5c632bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384763
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-09-12 15:08:08 +00:00
Alexander Markov 80b092de04 [dart2bytecode] Throw exception instead of crashing when external member is called
TEST=ci

Change-Id: I60a598dd5f8ac05a4f5f3283d257c2c6a74490e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384820
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-12 14:52:58 +00:00
Johnni Winther b3e1eec36f [cfe] Create SourceTypeAliasBuilder via fragments
This adds TypedefFragment as the first Fragment class and creates this
instead of the SourceTypeAliasBuilder during outline builder. The
SourceTypeAliasBuilder is created when the library name space is built.

Change-Id: Ib35a6f3b501ab1732cec84f5dcbd95ac7d54f5f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384741
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-09-12 14:03:30 +00:00
Paul Berry 0850220ad5 Fix unreachable switch cases in standard_bounds.dart.
I'm currently working on a fix for
https://github.com/dart-lang/sdk/issues/56710 (Analyzer fails to
report UNREACHABLE_SWITCH_CASE when there is a when clause). In order
to avoid spurious warnings when I land the fix, I first need to fix
any existing locations in the SDK that would cause the warning to
fire.

One such place is in the `standard_bounds.dart` file.

Bug: https://github.com/dart-lang/sdk/issues/56710
Change-Id: Icc917c3289b76760d29b6d7386a3794030274807
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384861
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-09-12 12:31:49 +00:00
Vyacheslav Egorov 157a0dc7f9 [vm/service] Shutdown service isolate if its main errored
If main function throws an error it might leave service isolate
in an inconsitent state and it does make sense to keep the isolate running
we might even dead lock trying to shut it down later (e.g. it might have failed
to create native port).

Flutter engine has a unit test which beings startup sequence for service
isolate and then quickly shutdowns VM - in this case vmservice main throws
and error trying to create native port. If we mark service isolate as
running at this state we will end up deadlocking in shutdown sequence
because main thread can't send exit message to the service isolate (as
we failed to create a port).

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

TEST=flutter engine unit test DartIsolateTest.CanCreateServiceIsolate

Change-Id: Ia0dc089cd31f93022708ff647950febd25eb3d7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384482
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-09-12 12:18:02 +00:00
Erik Ernst 46cff10fc7 Add lint avoid_futureor_void
This CL adds support for a new lint, `avoid_futureor_void`, that reports on every occurrence of the type `FutureOr<void>` in a covariant or invariant position. More details can be found at https://github.com/dart-lang/linter/issues/4622.

Change-Id: I1b86e04921d1fb0b3661be091ea1f4ad72089e8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382403
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-09-12 10:49:48 +00:00
Ömer Sinan Ağacan c8a7922160 Reland "Reapply "[dart2wasm] Allocate boxed bools once" and "[dart2wasm] Box Pointer values obtained from FFI calls""
This is a reland of commit fca5417d49

- Patchset 1 is the reland.
- Patchset 2 adds a regression test and fixes the bug.

Also tested engine chrome-dart2wasm-html-engine,chrome-dart2wasm-html-html,chrome-dart2wasm-html-ui,chrome-dart2wasm-canvaskit-canvaskit,chrome-dart2wasm-canvaskit-ui,chrome-dart2wasm-skwasm-ui tests manually.

Original change's description:
> Reapply "[dart2wasm] Allocate boxed bools once" and "[dart2wasm] Box `Pointer` values obtained from FFI calls"
>
> This reverts commit a4e9775a99.
>
> - Patchset 1 reverts the revert.
>
> - Patchset 2 adds regression tests. These tests fail.
>
> - Patchset 3 and the rest fixes the bug in `_loadPointer` and
>   `_storePointer` intrinsics. Also adds some inline annotations to
>   reduce the noise in unoptimized builds.
>
> Tested: updated test web/wasm/ffi/ffi_native_test
> Change-Id: I748a8aa8ff7cc663b1980d2bfab0d0da9f369e3b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384760
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ömer Ağacan <omersa@google.com>

Tested: web/wasm/ffi/ffi_native_test updated. Manual run of engine chrome-dart2wasm-html-engine,chrome-dart2wasm-html-html,chrome-dart2wasm-html-ui,chrome-dart2wasm-canvaskit-canvaskit,chrome-dart2wasm-canvaskit-ui,chrome-dart2wasm-skwasm-ui tests.
Change-Id: Ifcd5156b8a03228119b2146edcfc56db8ac6273b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384843
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-09-12 09:55:11 +00:00
Vyacheslav Egorov 4ba2764a9b [vm] Avoid field guard on Compound._typedDataBase
`KernelLoader::FinishClassLoading` was leaving guarded state of this
field in an inconsistent state: it was setting guarded cid to
`kDynamicCid`, but not setting guarded length to `kNoFixedLength`.

As a result in JIT mode we would generate stale length guards
for these fields and these guards would inhibit allocation
sinking.

This CL fixes this.

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

TEST=vm/cc/Ffi_StructSinking
R=dacoharkes@google.com

Change-Id: I2eae6447555a7c1dfa25591e51815936aa3dbaf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384842
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2024-09-12 09:18:20 +00:00
Moritz 81daf8e563 Use package:record_use
- Rename resource identifiers in the VM to usage recordings.
- Use package:record_use for serialization.
- Rename and use the experimental flag for this feature.
- Recognize tear-offs and top-level methods as well.

Next steps:

- Add constant instance recording.
- Expose API in package:native_assets_cli's link callback.

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

Change-Id: I8af3625165f78925ae943711245af93a239d1012
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
2024-09-12 08:47:53 +00:00
Slava Egorov 120dac365d Revert "[vm] Simplify implementation of native ports"
This reverts commit 5a32d8bc7c.

Reason for revert: DartIsolateTest.CanCreateServiceIsolate flutter engine unit test hangs on Windows.

Original change's description:
> [vm] Simplify implementation of native ports
>
> This CL turns native ports into a thin abstraction over underlying
> thread pool instead of building them as full fledged MessageHandler.
>
> This allows to easily implement a variation of native ports which can
> handle messages concurrently with the given degree of concurrency.
> This type of port can be used to greatly simplify implementation of
> IOService - which previously had to do its own concurrency management
> on top of "single threaded" native ports. This capability is exposed
> as `Dart_NewConcurrentNativePort` API.
>
> The new implementation is in general much cleaner then the old one
> with one exception: `Dart_CloseNativePort` API has unfortunate design
> where underlying message handler is destroyed asynchronously and
> `Dart_CloseNativePort` returns immediately without waiting for pending
> tasks to complete. Implementing this on top of `ThreadPool` requires
> some changes to thread pool implementation.
>
> Issue https://github.com/dart-lang/sdk/issues/55844
>
> TEST=ci
>
> Change-Id: I062040ff233e93962ae93684e9b044d8facdaffc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382163
> Commit-Queue: Slava Egorov <vegorov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Change-Id: I7de27793a54072e974bf1a9f17a07c12159a202d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384481
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2024-09-12 08:25:27 +00:00
Johnni Winther e106b7bf09 [cfe] Ensure that enum constructors are created during outline
Enum constructors for enums with mixins were not built in the outline
phase because code assumes that initializers have to be present in order
to have a non-trivial constant constructor.

Closes #56681

Change-Id: Id614e3cde24ba3649db9ca67d938ba21575d7454
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384264
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-09-12 07:58:01 +00:00
Ömer Sinan Ağacan 3c1c13db3a [dart2wasm] Add some prefer-inlines in typed data
Inlining typed list to `ByteBuffer` conversions eliminates allocating
intermediate `ByteBuffer`s when converting a typed list to `ByteData`.

Change-Id: I357056c395414c1465fff8da7a888c2f575d05a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384520
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-09-12 07:49:32 +00:00
Johnni Winther 0f2897a419 [cfe] Build library name space late
This moves the building of the library name space until after the
library and its parts have been resolved.

Change-Id: I9d999cd779b07402fc247f10a58118d08ff0a2c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384521
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-09-12 07:34:38 +00:00
Johnni Winther b47ab9e851 [cfe] Remove BuilderFactory.addBuilder
Call sites now add builders directly to the NameSpace.

Change-Id: Id1cf27548e0a97799184a71854fb2364cfbdd3f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384281
Reviewed-by: Jens Johansen <jensj@google.com>
2024-09-12 07:34:38 +00:00
Johnni Winther c750a9f908 [cfe] Remove LibraryNameSpaceBuilder.prefixBuilders
These are instead computed from the built NameSpace.

Change-Id: I84c852f6557b84b4bc07f542e3efafbfe07c6a65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384262
Reviewed-by: Jens Johansen <jensj@google.com>
2024-09-12 07:34:38 +00:00
Johnni Winther 88d56f0420 [cfe] Add SourceLibraryBuilder.state
This adds a state enum to SourceLibraryBuilder to help document and
check that methods and properties are access in a valid state.

Change-Id: I16d207995cd716965bad4dfaf010ed96b3761b26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383984
Reviewed-by: Jens Johansen <jensj@google.com>
2024-09-12 07:34:38 +00:00
Brian Wilkerson b06e324dd9 Implement local elements
As previously discussed, there are not tests for this code.

Change-Id: I008db0a7bece4538b22b74baf59d0c1d82c8e87d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384920
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-12 04:19:39 +00:00
Ben Konyi 9f5246e8c6 Revert "[ CLI ] Don't disable DDS when --disable-dart-dev is provided"
This reverts commit 81b9957bdd.

Reason for revert: Breaking multiple configurations.

Original change's description:
> [ CLI ] Don't disable DDS when --disable-dart-dev is provided
>
> Fixes https://github.com/dart-lang/sdk/issues/56605
> Fixes https://github.com/dart-lang/sdk/issues/54841
>
> TEST=N/A
>
> Change-Id: I6a13afe5f51fe67d2366c6d87ae74473651e24c8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383780
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Auto-Submit: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>

Change-Id: I5c6cb302d8160f19bad437341cdcd80bcc08d921
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384881
Reviewed-by: Siva Annamalai <asiva@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2024-09-12 01:15:27 +00:00
Konstantin Shcheglov 28b9898433 Parts. Remove remaining 'augment library' uses in analyzer/.
Change-Id: I683dffae2dcc7ad91d856cfa49e12092aea7d143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384822
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-11 22:58:39 +00:00
Ben Konyi a5cd16c0cb [ DDS ] Fix failing tests
Fixes failing tests introduced by
https://dart-review.googlesource.com/c/sdk/+/383780.

Change-Id: I700543f4dc6481dd905ffdc44177b009612565d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384880
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2024-09-11 21:43:08 +00:00
Ben Konyi 6f1887a1f2 [ DDS ] Fix tests broken by https://dart-review.googlesource.com/c/sdk/+/383780
TEST=N/A

Change-Id: I50e12596ebb7dc687e4c3d408104e450c3e91c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384900
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-11 21:08:58 +00:00
Danny Tuppeny 0ed690798d [analysis_server] Replace URI fields in tests with getters to avoid having to set all paths twice
This is a minor refactoring to swap some fields for URIs to getters so that any tests that modify them don't have to set both a path and URI (or risk them being out-of-sync).

Change-Id: Ic3776d250f4cfd9b0f16a7fc578ab5e7f19e52a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384762
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-11 20:14:23 +00:00
tguerin e4b505b366 Propagate http status code when http upgrade request failed
R=mosum@google.com

Change-Id: I547d19da251bdea0c259d3896e6e333f9afd0bca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384522
Auto-Submit: Thomas Guerin <thomas.guerin2@gmail.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-09-11 20:02:14 +00:00
Danny Tuppeny 009f3d0868 [analyzer] Fix a bug in TopLevelDeclarations.publiclyExporting matching elements only by name
Previously this was only checking if an element existed in the library with the same name, and not that it was actually the element being searched for.

Change-Id: I2d571f175a17f040352399a3c9777e8606367d00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384781
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-11 19:18:45 +00:00
Danny Tuppeny e7442b7066 [analysis_server] Add a semantic token modifier to wildcards
Also fixes top-level variable declarations to be treated as variables and not properties (see https://github.com/dart-lang/sdk/issues/55956).

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

Change-Id: I899ce4fc5950369acae70517d76a2830fe082731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384746
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-11 18:59:55 +00:00
Nate Biggs 91f099aa59 [dart2wasm] Fix switch statements containing jumps but no awaits.
This would throw when compiling before because there was no label target recorded for the target case statement.

Change-Id: Id00af345cf2a167a079f6ef8c077fa97cffdb3f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384587
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2024-09-11 18:42:23 +00:00
Brian Wilkerson eaef371b11 Improvements to the implementation of the new element model
This does a couple of things:
- Overrides `Fragment.element` consistently (and removes unnecessary
  casts)
- Adds the `element` for each fragment to the dump
- Implements support for field-formal and super-formal parameters and
  adds constructor parameters to the dump

Change-Id: Ie30806912842e3243e7bdc5e84ec7a11cb623751
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384860
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-11 18:24:57 +00:00
DEPS Autoroller d45b5a7a41 Roll Fuchsia Test Scripts from NWpblL_DFACOx_Spi... to Yg1lOiz5SYPjAx83-...
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-test-scripts-dart-sdk
Please CC chrome-fuchsia-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Fuchsia Test Scripts: https://bugs.fuchsia.dev/p/fuchsia/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:vm-fuchsia-release-x64-try;luci.dart.try:vm-fuchsia-release-arm64-try
Change-Id: I5bf8019a51794e330eff5ef935fd95dea5a89e4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384461
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-09-11 18:18:54 +00:00
Ben Konyi 81b9957bdd [ CLI ] Don't disable DDS when --disable-dart-dev is provided
Fixes https://github.com/dart-lang/sdk/issues/56605
Fixes https://github.com/dart-lang/sdk/issues/54841

TEST=N/A

Change-Id: I6a13afe5f51fe67d2366c6d87ae74473651e24c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383780
Commit-Queue: Ben Konyi <bkonyi@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-09-11 18:01:25 +00:00
pq c386f13a83 [enhanced-parts] Code Folding tests
Fixes: https://github.com/dart-lang/sdk/issues/56696

Bug: https://github.com/dart-lang/sdk/issues/56696
Change-Id: I20011f1c60bab29d8ed6e78be70b6f807dce03f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-09-11 17:33:51 +00:00
Danny Tuppeny a79ab854f0 [analysis_server] Remove unnecessary pending imports for elements that are available from newer imports
When adding imports for elements, we could leave unnecessary imports because the first element is imported through one library, and then a subsequent element is imported through a library that _also_ includes the first element.

With this change, any time we add a new element import, we will check the existing pending imports to see if any of those can be satisfied by this new import, and if so map it over and check whether the old import is now unused by any element imports (and not an explicit import), in which case it can be removed.

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

Change-Id: I82b638dfd2a36a72e5c7c55cae73842907ea3896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-09-11 17:33:20 +00:00
Ömer Ağacan d146083865 Revert "Reapply "[dart2wasm] Allocate boxed bools once" and "[dart2wasm] Box Pointer values obtained from FFI calls""
This reverts commit fca5417d49.

Reason for revert: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20Engine%20Drone/2677631/overview

Original change's description:
> Reapply "[dart2wasm] Allocate boxed bools once" and "[dart2wasm] Box `Pointer` values obtained from FFI calls"
>
> This reverts commit a4e9775a99.
>
> - Patchset 1 reverts the revert.
>
> - Patchset 2 adds regression tests. These tests fail.
>
> - Patchset 3 and the rest fixes the bug in `_loadPointer` and
>   `_storePointer` intrinsics. Also adds some inline annotations to
>   reduce the noise in unoptimized builds.
>
> Tested: updated test web/wasm/ffi/ffi_native_test
> Change-Id: I748a8aa8ff7cc663b1980d2bfab0d0da9f369e3b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384760
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ömer Ağacan <omersa@google.com>

Change-Id: I2cb55b6d2fdf429c5a0634329079e9df7e9e5871
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384841
Reviewed-by: Martin Kustermann <kustermann@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-09-11 17:06:58 +00:00
Danny Tuppeny f50975e3b5 [dds] Bump DDS to 5.0.0, use devtools_shared 11.0.0, and support a second DTD URI for web editors
devtools_shared 11.0.0 updates some signatures to use a new DTDInfo class to support both a local + exposed URI for DTD. A new CLI flag `--dtd-exposed-uri` for `devtools server` allows passing this second URI.

The DevTools server will use `--dtd-uri` to connect to DTD itself, but serve `--dtd-exposed-uri` to the frontend.

`--dtd-exposed-uri` is entirely optional and if not supplied, the value from `--dtd-uri` will be used in its place.

Change-Id: I5ab052ff9c4e7b2b186c1592f1ba2d63b7711113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/383400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2024-09-11 17:05:09 +00:00
Sam Rawlins 5ee4eb52e6 DAS plugins: Add plugin package generator
This generator will be used create shared plugin package entrypoints from
plugin configurations.

Work towards https://github.com/dart-lang/sdk/issues/53402

Change-Id: If5c6aeb7bc7845311975928fba1cb9c8d273423c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-09-11 16:54:29 +00:00
Alexander Thomas 5c1ceb0020 Improve "no new test failures" message
Previously, the output looked like this:
```
[00:45 | 100% | + 7999 | -   14]

=== 7999 tests passed, 14 failed ===
================================================================================
Test Results
================================================================================
There were no test failures.
```

The last message was confusing because there were test failures, but they have already been approved. The new messaging hopefully clarifies this.

Change-Id: I88f065523efb7778588d467c5491b0789cfc49ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384745
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2024-09-11 16:31:35 +00:00
Alexander Thomas 5cb1e4d962 [test.dart] Fix configuration override with one configuration
Bug: https://github.com/dart-lang/sdk/issues/56660
Change-Id: I9831b51cb2493789f8d9dc662ebc06cfd2410fce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384744
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
2024-09-11 16:09:43 +00:00
Alexander Markov ef19c7e948 [vm] Throw error if library is already loaded when loading a dynamic module
TEST=DART_CONFIGURATION=DebugX64 out/DebugX64/dart-sdk/bin/dart pkg/dynamic_modules/test/runner/main.dart -r aot --verbose

Change-Id: I4a7e59e9bb6472fc615c2fc9d9af10bf03945adb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384325
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-09-11 14:18:06 +00:00
Paul Berry f7259983d7 Remove redundant test from variable_pattern_switch_test.dart.
This test was out of place (since it doesn't contain any variable
patterns). Also, it was an exact copy of a test in
record_literal_switch_test.dart. There's no point in having the same
test in both locations, so remove it from the location where it
doesn't belong.

Change-Id: I1d3a786caba2b2591255b68c035eff40b2f08237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384565
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2024-09-11 14:06:42 +00:00
Vyacheslav Egorov 5a32d8bc7c [vm] Simplify implementation of native ports
This CL turns native ports into a thin abstraction over underlying
thread pool instead of building them as full fledged MessageHandler.

This allows to easily implement a variation of native ports which can
handle messages concurrently with the given degree of concurrency.
This type of port can be used to greatly simplify implementation of
IOService - which previously had to do its own concurrency management
on top of "single threaded" native ports. This capability is exposed
as `Dart_NewConcurrentNativePort` API.

The new implementation is in general much cleaner then the old one
with one exception: `Dart_CloseNativePort` API has unfortunate design
where underlying message handler is destroyed asynchronously and
`Dart_CloseNativePort` returns immediately without waiting for pending
tasks to complete. Implementing this on top of `ThreadPool` requires
some changes to thread pool implementation.

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

TEST=ci

Change-Id: I062040ff233e93962ae93684e9b044d8facdaffc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/382163
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-09-11 13:38:24 +00:00
Vyacheslav Egorov dfccc4a268 [vm/aot] Fix debug-info generation
The algorithm for ordering sections in `CreateProgramTable` permitted
skew between the order of sections in snapshot and corresponding
debug info. This skew can lead to inconsistencies in `.text` section
memory offset between two generated ELF files making debug info
invalid.

This skew was left unnoticed for a long time because executable
segment has a huge alignment requirement (64K) while the effect
of the skew was usually rather small and thus hidden by realignment.

This CL adds a strict verification pass (always enabled) which
guards against such skew in the future.

A better architecture would be to ditch parallel generation of
snapshot and corresponding ELF files altogether and other implement
splitting as a post processing path over generated ELF or
rely on external tooling. But this is a much bigger change
than I am willing to invest time into right now.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try
Change-Id: I0881783237faa6534eb3c076b6cae472bbdc7243
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384742
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-09-11 12:51:23 +00:00
Paul Berry 0a4f390b72 Rename Enum to E in exhaustiveness tests.
In the code review for
https://dart-review.googlesource.com/c/sdk/+/378960, Erik Ernst
pointed out that it's confusing to have enum declarations called
`Enum`, since there's a system library declaration whose name is also
`Enum`.

This CL changes the names to `E`, which is short and simple, and
adequate for testing purposes.

Change-Id: I6a36e1e55279ca6ad95a9f1d5a06292824f1c9d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384720
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-09-11 12:50:37 +00:00
Alexander Thomas 0ccb9e06ad Upgrade gsutil to remain compatible with newer versions of python
Fixes "ModuleNotFoundError: No module named 'six.moves'" on python 3.12.

Change-Id: I28ff9eab2d5c77b9374e3da199fde2765b56465e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384701
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-09-11 11:14:20 +00:00
Ömer Sinan Ağacan fca5417d49 Reapply "[dart2wasm] Allocate boxed bools once" and "[dart2wasm] Box Pointer values obtained from FFI calls"
This reverts commit a4e9775a99.

- Patchset 1 reverts the revert.

- Patchset 2 adds regression tests. These tests fail.

- Patchset 3 and the rest fixes the bug in `_loadPointer` and
  `_storePointer` intrinsics. Also adds some inline annotations to
  reduce the noise in unoptimized builds.

Tested: updated test web/wasm/ffi/ffi_native_test
Change-Id: I748a8aa8ff7cc663b1980d2bfab0d0da9f369e3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384760
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-09-11 11:09:39 +00:00
Martin Kustermann d7cff6c809 [dart2wasm] Make --omit-implicit-checks also omit AsExpression checks inserted by CFE
There are several different kinds of implicit type checks. The most
common ones are the checks on covariant parameters of methods. Those are
not represented in the kernel AST via `AsExpression`s but backend
compilers have to insert them themselves.

Then there's other implicit type checks that users haven't written but
the CFE inserts as synthetic `AsExpression`s. There's several different
kinds.

=> We make --omit-implicit-checks now also not perform those anymore
   (which one would expect given the name of the flag)

Change-Id: Ie61536c0a7269e5c62cd98c62e77d1b6a34e3f1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384740
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-09-11 10:04:28 +00:00
MarkZ 0aba085523 [ddc] Disabling hot reload tests on non-canary mac bots.
Hot reload tests were updated to depend on our canary SDK, which isn't generated for our mac bots.

Fixes some of our bot purpleness.

Change-Id: I92f81cc5122364fafa1c444b14114584fb48ae3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384582
Auto-Submit: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2024-09-11 00:03:50 +00:00
Konstantin Shcheglov 1a99ac6474 Parts. More tests for import/export related warnings.
Change-Id: Ia758cc27b05536a9969a6f510755e79b7d18f204
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384564
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-09-10 22:22:49 +00:00
Ryan Macnak 11aa02365c [vm] Give a better error message on pthread_join failure.
TEST=ci
Change-Id: I53206676ed02c398c12c318fb80fe719853cad5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384680
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-09-10 22:11:32 +00:00
Jason Simmons 2da438289d [vm] Add a GNI that lists the source files in vm_shared
This will be used by the Flutter engine build scripts that create the sky_engine package.

TEST=manual build of Flutter engine

Bug: https://github.com/flutter/flutter/issues/151171
Change-Id: Ib90c1934b99e42037e44d9e3c2804776e88047bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384660
Commit-Queue: Jason Simmons <jsimmons@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2024-09-10 21:53:23 +00:00