Commit graph

223 commits

Author SHA1 Message Date
Anna Gringauze 789b1d1fcd [frontend_server] Add --canary flag
Closes: https://github.com/dart-lang/sdk/issues/52774
Change-Id: Ie42a803c5b63a41c37984a790ab0406c8939872d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311149
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2023-06-27 22:21:04 +00:00
Jake Macdonald d1ecf01f71 Cache remote objects by ID, only send IDs for already sent objects
This is done through a synchronized cache between the server and client. When serializing a remote instance, if the server has already serialized that object then it will only send the ID in the future.

These caches currently only live as long as a single macro application in a given phase, but could live longer in the future. They do need to get reliably cleared out to avoid memory leaks though, and the shorter lifetime is easier to manage consistently.

This also allowed me to remove the specialized server/client modes (clients would always only send back IDs previously).

Change-Id: I4e8a102403153829d66b0ac379636f5a95a70cea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311420
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-06-26 22:36:37 +00:00
Johnni Winther 82e3a751a9 [cfe] Remove unnecessary_null_comparison code
The frontend is now run with sound null safety so these are no longer needed.

TEST=existing

Change-Id: I6c1776845854695ff34e310a3bb5bc9d86715f06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307901
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-06-08 08:46:47 +00:00
Alexander Aprelev 17781dbc36 [frontend/dds] Enable frontend server and dds to pass through types, method and class information for expression evaluation.
This information is needed for correct expression compilation.
Method name, for example, introduced in 48d8225b17 is needed for the compiler to confirm extension method context.

For flutter https://github.com/flutter/flutter/pull/128084 will be needed.

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

Change-Id: I32e53a953ebfb51afb462f4e2169fac0bcee0a7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306908
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-06-02 16:27:28 +00:00
Daco Harkes 3466d6855a [frontend_server] Support @Native assets in compute_kernel
The utils/bazel/kernel_worker.dart entry-point uses
pkg/frontend_server/lib/compute_kernel.dart as entry-point.
So we need to cover this entry point to the frontend_server as well
to pass the native asset yaml file.

Upstreamed from cl/530924434 and cl/512913404.

Change-Id: I86204870807da4ee3e8a7b10c40a17862042da08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286141
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-05-16 09:50:38 +00:00
Sigmund Cherem 1bd1d9d320 [dart2js] delete bin/dart2js.dart
This entrypoint is practically unused. We normally use
`lib/src/dart2js.dart` instead.

Long ago it wasn't possible to launch a script from the `lib` folder
without running into import canonicalization issues. However, a few
years ago the VM and CFE now normalize the entrypoints. When we
invoke `pkg/compiler/lib/src/dart2js.dart` it gets treataed as
`package:compiler/src/dart2js.dart`. As a result, we really no
longer had a need to have a separate entrypoint in the `bin` folder
that reexports the other entrypoint.

The only remaining references to this file were from documentation
and a couple unit tests. This CL updates those remaining uses.

Change-Id: Ic4c3c5c030db4e497f1d136979f7212db29cc533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302640
Reviewed-by: Nate Biggs <natebiggs@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-05-10 17:21:41 +00:00
Johnni Winther 009cbfbeac [kernel] Merge front_end and kernel verifiers
This merges the front_end and kernel verifiers into one Target based
kernel verifier. The RedirectingFactoryBody work-around is moved to
package:kernel to support its verification.

TEST=existing

Change-Id: I0adf4d2c22c4009cf439b3b23fa14192253a2846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280161
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-04-26 14:14:36 +00:00
Lasse R.H. Nielsen 67797ef46f Add more class modifiers to dart:collection.
Pure interfaces made `interface`s
implementation classes which cannot/should not be extended made `final`.

A class like `HasHMap` which provides the `Map` interface,
and no implementation except factory constructors
for internal implementations, is made `final`.

Unified {List,Set,Map}{Base,Mixin} into their `Base` class.
Deprecations are retained in comments for now, to be landed
separately. Search for '// TODO: @Deprecated'.

Tested: No new test, only adding restrictions on use.
CoreLibraryReviewExempt: Everybody's on vacation, everybody everywhere.
Change-Id: Ia83b8a3bb20b5b214546b328d4492de6658253db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288240
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-04-04 10:39:48 +00:00
Konstantin Shcheglov 895540889e Update SDK constraints for SDK packages.
https://dart-review.googlesource.com/c/sdk/+/287660 implements it.
I want to fix pre-existing violations before enabling.

Bug: https://github.com/dart-lang/sdk/issues/34978
Change-Id: Ie7731162c643018a2312b265f444bc00534c0a51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287664
Reviewed-by: Leon Senft <leonsenft@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-09 19:52:47 +00:00
Daco Harkes 40787d84fc [frontend_server] Add support for @Native assets
The VM can read native asset mappings from kernel.

Previous CLs already added support to embed native asset mappings for
one-shot compilation.
This CL adds support for adding native assets mappings to kernel files
created by the frontend_server with the incremental compiler.

The frontend_server accepts a `--native-assets=<uri>` at startup and
accepts a `native-assets <uri>` message on stdin as compilation
command.

The frontend_server caches the compiled native assets library.

When a `reset` command is sent to request a full dill from the
incremental compiler, the native assets mapping is taken from the
cache and added to the final dill file.

Split of DartSDK & flutter_tools prototype to land separately.

TEST=pkg/frontend_server/test/native_assets_test.dart

Bug: https://github.com/dart-lang/sdk/issues/49803
Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: I6e15f177564b8a962e81261815e951e7c9525513
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282101
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-02-21 07:29:29 +00:00
Devon Carew 12f0711a5b [pkg/frontend_server] use package:lints/recommended.yaml
Change-Id: I13f6ede17a29972b53283e0bb32960b4ea364aa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282388
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-02-10 20:29:17 +00:00
Tess Strickland 2c0484c720 [pkg/vm] Initial work on constant operating system fields and getters.
* Add an `targetOS` argument to `pkg/vm`'s `compileToKernel`,
  that contains the target operating system's name.

* Add a new `--target-os` command line argument for all binaries
  that use `compileToKernel` for clients to provide the target
  operating system, if known.

* Add a new`"vm:platform:const"` annotation to certain field and
  getters in the Platform class.

  This annotation is used to annotate static getters and fields with
  initializers where the getter body or field initializer must evaluate
  to a constant value if the target operating system is known. This
  annotation may be used outside the Platform class and in user code.

  For example, this annotation can be used on a static `String` field
  that is initialized with one value if `Platform.isWindows` is true
  and to a different value if `Platform.isWindows` is false.

  Note: If the const functions experimental flag is disabled, then
  any annotated static methods can only contain a single expression
  whose value is returned. If it is enabled, then the static method
  is evaluated as if it is a const function with the special
  handling of annotated static fields and getters above.

* Create a VM constant evaluator that evaluates uses of static getters
  and fields marked with the above annotations when a target operating
  system is provided.

* Use the new VM constant evaluator in the unreachable code elimination
  transformer.

TEST=pkg/vm/test/transformations/platform_use_transformer
     pkg/vm/test/transformations/unreachable_code_elimination

Change-Id: Ie381de70486a767fd7b1d515fd9e6bb58c6bf090
Bug: https://github.com/dart-lang/sdk/issues/31969
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try
CoreLibraryReviewExempt: Just adding vm-specific annotations.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274386
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-02-10 16:29:50 +00:00
Daco Harkes 897acba77f [frontend_server] Cleanup tests
Await unawaited futures and run formatter.

Change-Id: I2808b8cdc44ef9462e0c65d2ece72fdda9e114fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-02-07 10:06:50 +00:00
Alexander Markov a9d9b7395b [kernel] Enable sound null safety in TargetFlags by default
TargetFlags.enableNullSafety is set to true by default and
also renamed to TargetFlags.soundNullSafety to better reflect its
meaning.

TEST=ci

Change-Id: I2c2f30c2af6502fd9a96141dc60e4afbf8c524fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280216
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-02-02 14:54:18 +00:00
Josh Soref 77978889eb Spelling
Closes https://github.com/dart-lang/sdk/pull/51143

GitOrigin-RevId: 9e21c99a222d588e4fc95980725a2f8c9784965c
Change-Id: If0870e8936c7649935dce7e23cd783d62aa5610c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279916
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-30 18:29:59 +00:00
Josh Soref 01b28894e7 Spelling pkg dev compiler
Closes https://github.com/dart-lang/sdk/pull/50861

GitOrigin-RevId: 71005e6f5bf5a151cb5c1aefb6a2a300fc40f592
Change-Id: Iadfafb5787a62e9a379437f6a3763d31f99ba7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277743
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2023-01-26 09:12:41 +00:00
Josh Soref ef42a0b110 Spelling pkg analyzer lib
Closes https://github.com/dart-lang/sdk/pull/50860

GitOrigin-RevId: b27066c37f93c8c6d1123d6ebd6a4c0afcf59844
Change-Id: I15fa4aea1dad45daf168e34d1c4450320ec9b40a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277742
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-01-25 14:08:27 +00:00
Nicholas Shahan c140324e1e [ddc] Rename .dill files
- Makes the names consistent with dart2js and dart2wasm.
- Prepares for the upcoming removal of the weak null safety .dill file.

Change-Id: Idcf694b27cd4731db8f7ed6f0fdab7766ced08a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277183
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2023-01-18 01:34:57 +00:00
Nicholas Shahan 404ddff69a [frontend_server] Flip to null safe by default
Flip the default value for the null safety argument in the kernel
compiler.

Change-Id: I9532cf4bdea117dd0a1a2a00dfa6887674e161d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278898
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-13 18:39:11 +00:00
Brian Wilkerson b9de2e1a72 Remove some unnecessary ignore comments in frontend_server
Change-Id: If1123901019c5fe83f232ba34b8c3d7f58dce448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274728
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-12-12 18:40:40 +00:00
asiva 606a64a743 [3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.
- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-06 04:04:23 +00:00
Joshua Litt e7b0d4fa68 [kernel_worker] Support unevaluated constants.
Bug: #50535
Change-Id: Iabdaa1460c74d70a0ae44b60c5ecc9287a9740cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271562
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-23 14:40:17 +00:00
Devon Carew 8e70a02f05 [dartdev] updates to the 'dart compiler-server-shutdown' command
Change-Id: I38c268dace6610083051f9ec62fc9c0846d202d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270023
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-11-16 21:14:41 +00:00
Konstantin Shcheglov 76c8886ff5 Use NnbdMode.Strong for frontend_server/ binary protocol.
Bug: https://github.com/dart-lang/sdk/issues/50100
Change-Id: Ibbacffd90c49d1446df4a59fd718b53017dda0f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262441
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-10-19 21:40:13 +00:00
asiva 1a8335b42b Migrate frontend_server_test to be null safe.
Change-Id: If31640eaa2de3ac91df377f4e9e4195e2b5cd641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260744
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-09-23 15:57:39 +00:00
asiva 24b6b94637 Migrate tests to not use the mockito package for testing.
Change-Id: Id927ef41e528d5c11776ab66b29e1e9670a528af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260001
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-09-22 16:54:49 +00:00
Johnni Winther 3640b60c8c [frontend_server] Migrate frontend_server_starter
Change-Id: Ic68ba05b920c18cc6d13c5141b71f6c4cb6eca84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259580
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-16 08:06:49 +00:00
Johnni Winther 8ab14dc7a8 [frontend_server] Migrate most of the rest of frontend_server to null safety
Bug:https://github.com/dart-lang/sdk/issues/49212

Based on https://dart-review.googlesource.com/c/sdk/+/253301

Change-Id: I248846c30f1ce30de415c8a0722b680add83b9a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258922
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-09-15 08:25:13 +00:00
Gary Roumanis 75f4e3cfdf [Frontend Server] Handle Nullable Options
Closes https://github.com/dart-lang/sdk/pull/49828

GitOrigin-RevId: 4b77259cfc2e5d640fa0f1111482c918a7af67c3
Change-Id: I2a895a6914d5c3b317d635f5d3f6437220d6650b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256430
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-08-30 13:58:47 +00:00
Anna Gringauze 6c548cedc2 Make module names and uris match source map relative paths
- Make previous behavior non-conditional
  (already default and flag uses are removed)

- Use relative  paths instead of package uris as module names
  under --debugging-module-names flag, false by default.
  (used as server paths in the browser, need to match relative
   paths in source maps)

- Pass packageConfig to Javascript bundle API

- Add tests

Closes: https://github.com/dart-lang/sdk/issues/49667
Change-Id: I57c2e2629ba5dd756cce9a8ec6ae891fb092e1d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255826
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-08-29 17:41:36 +00:00
Alexander Aprelev 0e9b056f39 [vm/resident_frontend_server] Use File.create(exclusive:true) instead of links.
This makes resident frontend server more Windows-friendly, uses recently introduced api to ensure only one file creator succeeds.

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

Change-Id: I520487f4f198cc2b2e9d656dca85607889723ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256543
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-26 21:09:11 +00:00
Gary Roumanis c5a5bb8887 [Frontend Server] Redirect Option
Closes https://github.com/dart-lang/sdk/pull/49820

GitOrigin-RevId: 3a0fbd74e57f918e3b63cae746cccc88f4e2d1a4
Change-Id: Ie311a15dbee82ea2f76bdcebb5a009d1f79b835a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256423
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
2022-08-26 16:22:27 +00:00
Lasse R.H. Nielsen 8a883fa54d Change : to = for default values in pkg.
Leaves some in parser test:
 pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_prime.dart

TEST=Refactoring, covered by existing tests.

Change-Id: I7a83ef95df3cbd283878b3685b5c747bd89a1b16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256125
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-24 15:57:16 +00:00
Michael Richards 89528710ac [frontend_server] These changes ensure that only 1 resident_frontend_server is running when multiple entities request to start the compilation server. Only 1 server is allowed to exist per server information file. Multiple resident_frontend_servers may exist if the user passes in different files each time a server is spawned.
Change-Id: I5cd0eceb391f6a289318c17e74069b63ff37126c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254800
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Michael Richards <msrichards@google.com>
2022-08-16 20:44:42 +00:00
Johnni Winther b928fd3083 [frontend_server] Add FrontendServer wrapper in test
This adds a FrontendServer class that wraps steam communication,
reducing the amount of boilerplate code needed to write frontend
server tests.

Change-Id: I9ff0fe6e04a83503e00eea9fc764231e50d6207a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253666
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-15 06:57:46 +00:00
Johnni Winther 1662441541 [cfe] Enable alternative-invalidation-strategy by default
Change-Id: If9f08f883318a5f0487beaa0f7dbd73366ed5074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251107
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-08-10 14:57:18 +00:00
Johnni Winther c3313e85e1 [frontend_server] Add support for advanced invalidation
Update the JavaScript bundler to maintain the state necessary for
the alternative invalidation strategy. This will provide the
javascript compiler with a single library component, so this must
handle re-combining this library with any SCC as well as keeping
the old summaries around.

Revived from https://dart-review.googlesource.com/c/sdk/+/196840

Change-Id: I1dd59d813172ac68ffcb189fcf3904c844828773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251960
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-08-09 00:02:31 +00:00
Michael Richards df87c7819e [frontend_server] This adds a more complete set of compiler options to the resident frontend server, allowing for AOT compilations and more options when used by the run cli command. This also adds the ability for the resident frontend server to shut itself down after a period of inactivity.
Change-Id: I1ac52c0bb7186e840c0af5aa48da42868bb41958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253640
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Richards <msrichards@google.com>
2022-08-08 16:24:20 +00:00
Johnni Winther 85fea8ff86 [frontend_server] Add test for in-body change
This adds a DDC frontend server test that shows DDC doesn't currently
support advanced invalidation.

Change-Id: Ie6176bc4fa9d91262c0a6e0a30a1fccee96023be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252424
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-08-04 07:10:26 +00:00
Michael Richards 1cd8b28cfe [frontend_server] This adds the ability for the frontend server to be a resident process, allowing it to live through invocations of the Dart CLI. This allows the CLI to utilize the frontend's incremental compilation mode and keep cached kernel files for better performance. This currently only supports VM targets.
When launched as a snapshot, the initial compile is slower than the existing pub approach because of a process start time of around 500 ms. When launched as a compiled executable, initial compile times are the same as the existing pub approach. Once launched, experimental results show times to produce a kernel file of at worst 1.5-2x faster than pub's solution and at best 10x faster than pub's solution. The typical workflow of making changes and recompiling results in an average of a 5x speedup with respect to pub's implementation.

Because compiler instances use a lot of memory, there is a limit on the number of active compilers that the resident server will keep alive, and will actively bring instances down when this limit is exceeded. If the user was previously compiling a given project during the lifespan of a ResidentFrontendServer and its compiler is taken down between requests, a new compiler instance will be allocated for the request. Performance is still between 1.5x-5x faster for this case when compared to pub's compile times.

Change-Id: If9ee1ecc71d660d34faf23381c764dc11d6a5902
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252001
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Michael Richards <msrichards@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-08-02 18:08:21 +00:00
Srujan Gaddam 61abaeda3f [CFE/web] Move static interop erasure and remove outline stubber
Deletes the outline stubber as it's not necessary on any backend.
DDC should compile the entire sources and outline dill in one step.
dart2wasm operates similarly, and so only needs the modular transformer.
dart2js moves the erasure to a global transform.

Also, this CL reverts now unnecessary plumbing that was needed for the
outline stubber.

Change-Id: Ic085c4fad5a6bdfc7d6916f7fa575c6ef9b20110
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253000
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-08-01 18:17:44 +00:00
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Alexander Markov 94c120a6ea [vm] Cleanup old async/async*/sync* implementation from kernel
This change removes kernel transformation which was used to
desugar async/async*/sync* functions in the old implementation of
async/async*/sync*.

The useful part of the transformation is retained in
pkg/vm/lib/transformations/for_in_lowering.dart.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ic70c1fb35162a31bcc22eac3a8f6488b61e945b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249944
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-11 18:12:41 +00:00
Devon Carew d60cf4938e [pkg/frontend_server] analyze using package:lints
Change-Id: I8890c6afc14e63c32c3f1a3cf8c082251dd1eda2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250774
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-07-07 20:52:16 +00:00
Srujan Gaddam b372fd4c52 [CFE/pkg:js] Find reference of stub if it already exists
Fixes #49301

From https://github.com/dart-lang/sdk/issues/49301#issuecomment-1165536192

Adds referenceFromIndex to outline transformations so that the eraser
can use it to find the reference for the stub if it was already created.
This is needed when the module where the stub exists is invalidated.
Since references in other modules should still be valid, we should
attempt to get that reference.

Change-Id: I5905a002480444aecd57de650cd439bdc34d4eba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249729
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-06-28 18:36:02 +00:00
Jens Johansen b4e2012f5b [CFE] Remove support for .packages file
This CL:
* Removed the redirect from .packages to .dart_tool/package_config.json
  (whenever such a file existed).
* Removes support for the old format entirely.
* Updates all tests etc that were found.

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

TEST=Existing tests updated.

Change-Id: Iccf711c455ac1885189aa773ca74dd8f55012964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248603
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-06-24 08:20:39 +00:00
Srujan Gaddam 459d57c8b8 [package:js] Add static interop stub for outlines
Fixes b/235393918

@staticInterop replaces factories with a new named node, a static
method. In order to persist this transformation in modular
compilation, this needs to be done to outlines that can then be
consumed by the source library. In order to allow erasure at the
time of 'performOutlineTransformations', coreTypes is added to that
API.

Change-Id: I90d17fff8bbe143982fcd12cfb06dc3e8d58781a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247928
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-06-17 19:58:49 +00:00
Konstantin Shcheglov ba4b3d20d2 Import dart:typed_data instead of deprecated re-export from dart:io
Bug: https://github.com/dart-lang/sdk/issues/23067
Change-Id: I6bfe7afabe344bb0de690f762b5f80604809021e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248344
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2022-06-14 06:29:37 +00:00
Ahmed Ashour 8bb3a10e40 Fix typos
Fixes #49228

TEST=ci

Change-Id: Idcc625554bcf07807bae9791ea37b73ae9394b87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247960
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-10 15:48:54 +00:00
Jake Macdonald b878294e06 Migrate parts of package:frontend_server to null safety.
This is a re-land of https://dart-review.googlesource.com/c/sdk/+/247601 with some additional changes to allow for certain null uris in some previously migrated package:front_end code.

Note that nulls were flowing through these apis already, this just acknowledges that fact :).

Bug: https://github.com/dart-lang/sdk/issues/49212
Change-Id: I4528bfdec1bc9114715afd3fea06d1249054d2a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247765
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-06-10 14:56:45 +00:00