Commit graph

227 commits

Author SHA1 Message Date
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
Devon Carew 77c79d678e [pkg/vm] analyze using package:lints
Tested: via static analysis on the CI
Change-Id: Icffb8d52001d5099cca3ab1f153d3f6e5300177d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250770
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-07 23:22:49 +00:00
Jens Johansen d998ba033d [VM] Resolve package config (absolute) uri in kernel service
Response to https://buganizer.corp.google.com/issues/237271829

TEST=Existing tests --- test specifically for this will come later.

Change-Id: Ife30492f222e6bdb56fc5f89da291a1cfebd48d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250040
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-06-28 11:09:03 +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
Alexander Markov 8bc1cda3f7 [vm] Fix --enable-mirrors VM flag to affect environment and conditional imports
This change propagates --enable-mirrors VM flag to CFE via
TargetFlags.supportMirrors. CFE uses that to select conditional
imports and for constant evaluation of bool.fromEnvironment.

TEST=runtime/tests/vm/dart/enable_mirrors_test

Issue: https://github.com/dart-lang/sdk/issues/49266
Change-Id: I9f6b03f1ab224d13cbe9f035fb5b6fa6eb59055c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249020
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-17 17:20:09 +00:00
Ahmed Ashour 85700570f6 Fix typos
Fixes #49241

TEST=ci

Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-06-15 11:08:28 +00:00
Nate Bosch 33e174084a Replace Uri.scheme == with Uri.isScheme
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.

TEST=No behavior changes.

Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-02-08 21:38:57 +00:00
Alexander Markov 129304e09b [vm, cfe] Add an option to include extra source files into kernel compilation
This change adds --source option to kernel compilers (front-end server
and gen_kernel). This option instructs compiler to include extra source
files into compilation even if they are not referenced from main
library.

TEST=Added test cases to pkg/frontend_server/test/frontend_server_test.dart
and pkg/vm/test/kernel_front_end_test.dart

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

Change-Id: If3d71538751e9ccfa8c82a5685d810cf811e021c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231334
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-02-04 15:23:39 +00:00
Jens Johansen adb1dc9380 [VM] [CFE]: Make VM send over type information for expression compilation
Missing:
* Function types.
* Type variables in bounds, like "method<T, S extends T>() {}" and
  "method<T extends Foo<T>>() {}"

This is in many ways a follow-up to
https://dart-review.googlesource.com/c/sdk/+/212286

TEST=service and (cfe) expression suite tests added.

Change-Id: I20472b59ed73e9845f073e176d73b2c213f9407a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-01-28 07:49:21 +00:00
Alexander Markov 80c6896040 [vm/test] Convert vm/cc/IRTest_TypedDataAOT_{NotInlining,Regress43534} to the new IL tests
There are 2 AOT-specific unit tests which rely on disabled
--use_table_dispatch flag. That flag is enabled everywhere and was
only disabled for the vm unit tests.

These 2 tests are now migrated to the new IL tests infrastructure
and --use_table_dispatch flag is enabled in the vm unit tests.

In order to support testing of IL of closures, IL test infra is
extended with pragma

@pragma('vm:testing:match-inner-flow-graph', 'inner name')


TEST=vm/dart/typed_data_aot_not_inlining_il_test
TEST=vm/dart/typed_data_aot_regress43534_il_test

Change-Id: I900e96136ddedb408ffca05d0c71893c3e12c2c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225325
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-01-04 15:29:06 +00:00
Johnni Winther 87c953bd0c [cfe] Pass class hierarchy and core types through IncrementalCompilerResult
TEST=existing

Change-Id: I78a61147998a630d88997e0cebccb3e815592822
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221088
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-11-25 11:27:29 +00:00
Vyacheslav Egorov 12b1773deb [vm] Fix issues with flutter_regress_91370_il_test
* Add Canonicalize pass after CSE to erase graph differences between
64-bit and 32-bit platforms. These differences originate from different
treatment of integers (we unbox more eagerly on 64-bit platform) and
consequently affect load forwarding - which generates some redundant[1]
phis on 64-bit platform, but not on 32-bit platform. Adding this pass
also addresses other cases of unpredictable performance when IL changes
can cause CSE not to trigger a Canonicalize inside itself and regress
performance, by inhibiting subsequent optimizations.
* Allow IL tests to check whether the graph was compiled in sound
null safety mode or not - because graphs can have minor differences.
* Use `"$i"` instead of `i.toString()` in the test to allow TFA to
infer non-nullability of fields in non-sound-nullsafety mode.

[1] The definition of redundant phi differs between canonicalization
pass and load forwarding pass. The former unwraps redefinitions and
the latter does not. We are going to address this difference in a
more systematic way when we split input dependencies from control
dependencies.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try
Change-Id: Ifbd68fbb7f3b374ecee8ada1b3a4a2249139a108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220541
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-11-17 12:12:31 +00:00
Vyacheslav Egorov a643e537fb [vm/infra] Improve IL testing framework
* Add support for dumping flow graphs in JSON (to make it machine
readable);
* Add support for controlling which functions are dumped through
a pragma annotation:
`@pragma('vm:testing:print-flow-graph'[, "passes filter"])`
* Replace simple matching DSL with programmatic matching
* Support obfuscated builds

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

TEST=vm/dart{,_2}/aot_prefer_equality_comparison_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: Ie067ba451d311e6019a8c3a88c012231b0c50eb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219240
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-11-16 12:39:11 +00:00
Vyacheslav Egorov 8740a4f10f [vm/infra] Nascent AOT IL tests infrastructure.
Our current unit testing infrastructure does not make it possible to
test AOT compilation pipeline end-to-end, because it does not run TFA
when generating Kernel.

This makes it challenging to write regression tests for certain issues.

Instead we extend test runner with a capability to perform IL matching
when running AOT tests.

runtime/docs/infa/il_tests.md provides details on how to write such tests.

TEST=manually

Change-Id: I6f5220b814f4a5d8c053efacd3711df495dea404
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214961
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-09-30 13:19:42 +00:00
Jens Johansen 48d8225b17 [VM] [CFE]: Expression compilation inside extension method
This CL handles expression compilation inside extension methods better.
It is now possible to evaluate "this" and other methods defined in the
extension.

https://github.com/dart-lang/sdk/issues/46757

TEST=service tests added.

Change-Id: I3c71eb23117e26b01961f32103f4046f0b537976
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212286
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-10 12:02:57 +00:00
Alexander Markov 730ab0583d Migrate pkg/vm to null safety, part 5
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/46620
Change-Id: Ifc5fe377b5dd8273a45ca0c28fcd27527baae146
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208021
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-07-28 18:38:30 +00:00
Alexander Markov 8e1fbc9ab3 Migrate pkg/vm to null safety, part 1
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/46620

Change-Id: I2ad3f3aac03c8c13d2562a385a5b6636675401f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207362
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-07-20 06:49:20 +00:00
Jens Johansen 93f4ac0a83 [cfe] Actually have both ansi and plain text formatted messages (2nd try)
The CFEs FormattedMessage always had two getters to get the text inside
one that would supposedly give an ansi formated version of the message
and one that would supposedly give a plaintext formated version of the
message. They both returned the same string, though, which would either
be with ansi escape codes or plain text depending on the environment at
compile time.

This CL fixes that by having both messages, and letting the reporting
(i.e. whenever the message is read) decide which to use. That way we
can - for instance - report errors with color if the terminal supports
it correctly when reusing a dill (and reissuing problems, but where the
terminal support changes) and if printing the problem to an html <pre>
field (like observatory does).

It also cleans up two different implementations of whether we think
the terminal supports colors or not, by deleting one of them.

This is the second try. Patchset #1 is the original.
Patchset #2(and possibly beyond) is the changes.

TEST=Existing test suites.

Change-Id: I8e483049ce81ce1bd8e5396b588a31e0ad3a8630
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187402
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-26 13:06:17 +00:00
Jens Johansen 3a4a4f53d0 Revert "[cfe] Actually have both ansi and plain text formatted messages"
This reverts commit f63f7736c5.

Reason for revert: This somehow breaks the Windows bots. `python tools/test.py -n dartk-win-release-x64 standalone_2/io/process_shell_test`.

Original change's description:
> [cfe] Actually have both ansi and plain text formatted messages
>
> The CFEs FormattedMessage always had two getters to get the text inside
> one that would supposedly give an ansi formated version of the message
> and one that would supposedly give a plaintext formated version of the
> message. They both returned the same string, though, which would either
> be with ansi escape codes or plain text depending on the environment at
> compile time.
>
> This CL fixes that by having both messages, and letting the reporting
> (i.e. whenever the message is read) decide which to use. That way we
> can - for instance - report errors with color if the terminal supports
> it correctly when reusing a dill (and reissuing problems, but where the
> terminal support changes) and if printing the problem to an html <pre>
> field (like observatory does (1)).
>
> It also cleans up two different implementations of whether we think
> the terminal supports colors or not, by deleting one of them.
>
> (1) At least sometimes. It works - I think - only for 'evaluateInFrame',
>     but that's another story (and will be fixed in a follow-up CL).
>
> TEST=Existing test suites.
>
> Change-Id: Iedaedd9a5c41458d40c23ed4b706324c004ae943
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186291
> Commit-Queue: Jens Johansen <jensj@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

Change-Id: I0b53f943a61f76705badfead30d9e1ee35baff57
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186941
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-24 12:30:18 +00:00
Jens Johansen f63f7736c5 [cfe] Actually have both ansi and plain text formatted messages
The CFEs FormattedMessage always had two getters to get the text inside
one that would supposedly give an ansi formated version of the message
and one that would supposedly give a plaintext formated version of the
message. They both returned the same string, though, which would either
be with ansi escape codes or plain text depending on the environment at
compile time.

This CL fixes that by having both messages, and letting the reporting
(i.e. whenever the message is read) decide which to use. That way we
can - for instance - report errors with color if the terminal supports
it correctly when reusing a dill (and reissuing problems, but where the
terminal support changes) and if printing the problem to an html <pre>
field (like observatory does (1)).

It also cleans up two different implementations of whether we think
the terminal supports colors or not, by deleting one of them.

(1) At least sometimes. It works - I think - only for 'evaluateInFrame',
    but that's another story (and will be fixed in a follow-up CL).

TEST=Existing test suites.

Change-Id: Iedaedd9a5c41458d40c23ed4b706324c004ae943
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186291
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-24 10:33:45 +00:00
Martin Kustermann 2e2d542969 [vm/concurrency] Use isolate group id as key for incremental compiler for reload
As part of implementing hot-reload for isolate groups, we have to ensure
reloads on a group are performed using the same state of incremental
compiler.

This means we cannot use a specific isolate's information (such as it's
main port) for reloading purposes. Instead we use the unqiue isolate
group id when communicating with the kernel service.

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

TEST=Existing test coverage, future test when hot-reload is fully
     implemented with isolate groups.

Change-Id: Ifab39cd2ba689c08507dfab4091cd26951ed54e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185320
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2021-02-18 06:59:24 +00:00
Jens Johansen 2d064faf74 [CFE] Incremental compiler guards against multiple simultaneous calls to computeDelta
package:vm "clones" an old incremental compiler when creating a new one
for a new isolate. It does that by calling .computeDelta on the first
available compiler. If that compiler is already compiling, though, things
can go bad.

The risk of that happening was made bigger by awaiting in the standard
filesystem instead of using the sync filesystem operations, but it can
happen either way.

If it has any practial importance (outside of tests) is an open quesiton
but this should nevertheless fix the issue by only letting the
incremental compiler allow one compile at the time (creating an implicit
queue when more is tried).

TEST=Existing test suites + added test.

Change-Id: I694e360aa4bce604db41908730c66ef3b96e6d8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184788
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-02-16 08:32:56 +00:00
asiva ac520f984d [ VM / CLI ] Add --verbosity to VM options
The verbosity option allows for specifying the CFE output verbosity

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

TEST=existing tests compile_test.dart and run_test.dart have new tests

Change-Id: I3d4e50811f84650aacf774ddb370a6eb765b9b24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181100
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-01-26 03:01:58 +00:00
Johnni Winther 97a4280e52 [cfe,dartdev,dart2js] Add support for --verbosity option
In response to https://github.com/dart-lang/sdk/issues/44727

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I56b67d9362a415acd721c1cce2f7e2232d2493df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180566
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-22 18:33:44 +00:00
Johnni Winther 55b34a467c Reland "[vm] Pass snapshot flag to kernel_service"
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: Id9e72751068d5f208055ab953d2c8392e84c4798
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180187
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-21 21:18:32 +00:00
Aske Simon Christensen 903e92a196 Revert "[vm] Pass snapshot flag to kernel_service"
This reverts commit f8b0d26cc3.

Reason for revert: Multiple test failures in app-jit and simarm(64)

Original change's description:
> [vm] Pass snapshot flag to kernel_service
>
> Enable reporting of null safety compilation mode when running
> `dart compile aot-snapshot`, `dart compile jit-snapshot`,
> and `dart compile kernel`.
>
> Closes #44234
>
> TEST=pkg/dartdev/test/commands/compile_test.dart
>
> Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,johnniwinther@google.com

Change-Id: I83aeaa8620c640d02d5ccfd1fe8112d8209a9ad4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179773
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-18 21:00:03 +00:00
Johnni Winther f8b0d26cc3 [vm] Pass snapshot flag to kernel_service
Enable reporting of null safety compilation mode when running
`dart compile aot-snapshot`, `dart compile jit-snapshot`,
and `dart compile kernel`.

Closes #44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-18 09:27:59 +00:00
Johnni Winther cad04f8604 [cfe,dart2js,dartdev] Show null safety mode for dart compile
This adds a new messages kind 'info' to the CFE for showing general
information during compilation. A 'configuration' options is added
to `CompilerOptions` for telling the CFE how it is run.

The configuration 'compile' is added for when the CFE is invoked to
produces an "executable" as when running `dart compile`. When
configuration is set, the CFE emits an info message about the
null safety compilation mode.

Support for `dart compile exe` and `dart compile js` is added in this
CL. Support for `dart compile kernel|app-jit|aot` is not included.

In response to https://github.com/dart-lang/sdk/issues/44234

TEST=pkg/dartdev/test/commands/compile_test.dart

Change-Id: I08f51e2a3f5ad4841c4d703bcd266b7afb63c7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-15 11:28:13 +00:00
Alexander Markov f4bb16232a [vm] Remove old version of protobuf-aware tree shaker
New, faster version of protobuf-aware tree shaker was introduced in
https://dart-review.googlesource.com/c/sdk/+/152100. It has been
used in Flutter use cases for a while.

This change replaces old version of transformation with the new one in
the pkg/vm/bin/protobuf_aware_treeshaker.dart tool and removes
the old version.

TEST=existing tests in pkg/vm/test/transformations

Change-Id: I01546ae9fdc9fea3228595270c2aff04a0894e6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178281
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-15 00:54:48 +00:00
Sam Rawlins fee45f9554 VM: Remove unnecessary imports
TEST=Existing tests on existing bots

Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: I0c8ee9afa85da3a1a39a983841e62956e76dd509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177242
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-30 14:52:48 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Alexander Markov 7588ed86de Remove bytecode mode from the VM
Change-Id: Ief167b7ffc128105a03cc225ab750234c9a6a7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169147
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-28 17:42:35 +00:00
Alexander Markov 1615c04c63 Remove bytecode generator
Change-Id: Ic5fd2ab67c10ae642ee277a5acd9b4084e059861
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167762
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-23 19:30:43 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Nate Bosch 5e6d949757 Remove some misleading int returns from main
During normal execution the return value from `main` is _not_ used as an
exit code. Fix some cases that try to use it that way.

Change-Id: I292dc8ebf0acc8cb3d4d72f55107e438df9112de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156143
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-29 00:47:01 +00:00
Jens Johansen e8d3389eb5 [VM] Expression compilation when loaded from dill (part 2)
Previous version
(landed via https://dart-review.googlesource.com/c/sdk/+/135683)
only worked if the dill was loaded via
Dart_LoadScriptFromKernel where script_kernel_size was set,
and when the platform dill could be loaded from a file called the right
thing.

This CL makes it work for Dart_LoadLibraryFromKernel too and allows
the VM to send the platform along (explicitly or implicitly) and only
tries to load the platform from a file with the right name if no
platform is given in any of the inputs.

This should fix http://b/148776866

Change-Id: I62317400a932b7dcd9e126a5a88907d507f9d658
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153609
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-09 14:55:11 +00:00
Alexander Markov 6f6b1f8818 [vm] Rename --null-safety option to --sound-null-safety
Deprecated option --null-safety still remains in order to allow
graceful migration.

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

Change-Id: Ie47b1bebc9dd6532658a60743ecb85dc7fdc108c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153660
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-09 01:37:23 +00:00
Alexander Markov 467c98b846 [vm/aot/tfa] Re-implement protobuf-aware tree shaker inside TFA
This change introduces handling of protobufs while doing type flow
analysis. Metadata in protobuf message classes is updated dynamically
according to the set of called accessors, invalidating and rebuilding
TFA summaries as needed.

Previously, protobuf-aware tree shaker required the 2nd run of TFA
in order to do the actual tree-shaking after protobuf messages are
pruned. This significantly increases compilation time.

AOT compilation time of a large app (--from-dill): 274s -> 152s

New tree shaker is available in kernel compilers under the flag
--protobuf-tree-shaker-v2.

Issue https://github.com/dart-lang/sdk/issues/42442
Fixes https://github.com/dart-lang/sdk/issues/40785

Change-Id: I4347896737b9b0f7407b845e614dda9ba7621921
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152100
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-06-23 21:17:03 +00:00
Vyacheslav Egorov 117df0e98b [vm/tools] Move snapshot analysis tool to its own package.
This code will be published on Pub so that Dev Tools can consume it.

Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: Iddfbd3f0976af218d29ac20b452fbb139983a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152008
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-06-23 13:14:41 +00:00
Siva Annamalai d46a696957 Revert "Reland : [VM/Runtime] Cleanup package config initialization code"
This reverts commit 03777dba31.

Reason for revert: Failures in couple of bots

Original change's description:
> Reland : [VM/Runtime] Cleanup package config initialization code
> 
> - Use _Init function for initialization of package config
> - Remove DartUtils::SetWorkingDirectory, SingleArgDart_Invoke,
> 
>   DartUtils::SetupPackageConfig
> - Rename Loader::InitForSnapshot to Loader::Init
> - Remove _setPackagesConfig, _setWorkingDirectory from builtin library
> - Rename _setPackagesMap to _setPackagesConfig
> Change-Id: I1e4a25e79706d7764247c9fbfcc8e8ce3231343c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151633
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

TBR=aam@google.com,asiva@google.com

Change-Id: Ibea8c35fe310ac7708f00bb9ffd58715b6924cb5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151869
Reviewed-by: Siva Annamalai <asiva@google.com>
Auto-Submit: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-20 08:02:53 +00:00
asiva 03777dba31 Reland : [VM/Runtime] Cleanup package config initialization code
- Use _Init function for initialization of package config
- Remove DartUtils::SetWorkingDirectory, SingleArgDart_Invoke,

  DartUtils::SetupPackageConfig
- Rename Loader::InitForSnapshot to Loader::Init
- Remove _setPackagesConfig, _setWorkingDirectory from builtin library
- Rename _setPackagesMap to _setPackagesConfig
Change-Id: I1e4a25e79706d7764247c9fbfcc8e8ce3231343c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151633
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-06-20 05:50:49 +00:00
Ryan Macnak 6cc943957b [vm] Compute a partitioning of the program into loading units.
The partitioning has the property that for every reference from loading unit S to unit T, either
 - the reference is through a deferred prefix, or
 - T is guarenteed to be loaded before S

The partitioning is constructed by cutting the dominator tree of the library import graph at deferred imports. It is suboptimal if there are deferred imports to multiple libraries in a connected component, but the expected use case involves loading units with a single deferred entry.

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I3c49044ae19112525f197b077b36e4ce874b81ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151470
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-19 21:35:47 +00:00
Vyacheslav Egorov 73e95f7f49 [vm/tool] Add snapshot_analysis summary command.
This CL also refactors ProgramInfo making it less structured - we remove
individual node types (LibraryInfo/FunctionInfo) and represent
the information using ProgramInfoNode class instead.

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

Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: I0156ae75f48a41b7689790860267ac88706d55c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151227
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-18 11:57:13 +00:00
Vyacheslav Egorov 80fed2cfc2 [vm/tool] Move snapshot analysis commands into their own directory.
Issue https://github.com/dart-lang/sdk/issues/41249

Change-Id: I3ce17d2ca2075e551c9e72e09731f99e7e0f9e69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151226
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-17 20:57:03 +00:00
asiva 4b9aa2bd7e Revert "[VM/Runtime] Cleanup package config initialization code"
This reverts commit 29e93bcdbd.

Reason for revert: Windows bots are failing with package resolution
errors. Looks like we are missing a windows path sanitization step.

Change-Id: Ib56f7e926b4f385fa3fde74c9c71947f64b8be1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151469
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-06-17 00:03:19 +00:00
asiva 29e93bcdbd [VM/Runtime] Cleanup package config initialization code
- Use _Init function for initialization of package config
- Remove DartUtils::SetWorkingDirectory, SingleArgDart_Invoke,
  DartUtils::SetupPackageConfig
- Rename Loader::InitForSnapshot to Loader::Init
- Remove _setPackagesConfig, _setWorkingDirectory from builtin library
- Rename _setPackagesMap to _setPackagesConfig
Change-Id: I0b83574593fa95e1b948134fcd4a7b4858ea19c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151045
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-06-16 23:24:26 +00:00
asiva a782dd82db [VM/runtime] - detect null safety before isolate initialization
- Detect null safety when not specified before isolate
      initialization
      - for source files by having CFE parse the source file
        for @dart annotations
      - for kernel files by sniffing the kernel file for
        compilation mode
      - for appJIT files by sniffing the feature string
      - for AOT snapshots by sniffing the feature string

    - Remove workaround of returning null safety to false during
      bootstrapping

    - Add a new Dart C API call for detecting null safety

Bug: 41766
Change-Id: Ia8cf264323a2d0d58c2855ce6491456aa6f1da07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150089
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-06-11 01:22:35 +00:00
Vyacheslav Egorov f93047de4a [vm/tools] Combine run_binary_size_analysis and compare_sizes into a single tool.
The functionality of these two separate tools will now be available as

$ pkg/vm/bin/snapshot_analysis.dart treemap ...
$ pkg/vm/bin/snapshot_analysis.dart compare ...

respectively.

This is first step towards making these tools share more infrastructure
and also work with --print-instructions-sizes-to and
--write-v8-snapshot-profile-to outputs.

Change-Id: I16a2d7d51680397ce22b931c00af6eeda446e634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148420
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-05-19 11:04:40 +00:00
Alexander Markov cbb5305f78 [vm/nnbd] Optimize type casts
Add a kernel transformation which removes redundant casts and reduces
some casts to null checks. This transformation assumes that type
system is sound and subtyping relation is transitive. So in NNBD weak
mode this transformation is always correct. In NNBD strong mode
this transformation is correct only if opted-out libraries are not
allowed.

The following patterns are handled:
If S <: T (this includes S <: T? in weak mode)
  S x; x as T => x
If S <: T? in strong mode
  S x; x as T => (x == null) ? x as T : x

This kernel transformation is not specific to the VM and can be reused
by other back-ends such as dart2js and DDC.

Fixes https://github.com/dart-lang/sdk/issues/40892
Issue https://github.com/dart-lang/sdk/issues/40893

Change-Id: I466ba96d763d5358011c768400c5225fa7bf5e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139314
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-19 02:35:12 +00:00
Alexander Markov bbe469eabd Reland "[vm/nnbd] Auto-detect null-safety from entry point in kernel compilers"
This is a reland of fd19c8cc25
No changes were made to the original CL.

The following fixes landed separately:
* Flutter tests which use --enable-experiment=non-nullable are
  disabled in https://github.com/flutter/flutter/pull/57235.
* Auto-detection of null-safety mode from dill file in gen_snapshot is
  implemented in https://dart-review.googlesource.com/c/sdk/+/148152.

Original change's description:
> [vm/nnbd] Auto-detect null-safety from entry point in kernel compilers
>
> If --null-safety flag is not specified, tools should infer null safety
> mode from a legacy status of an entry point script.
> This change adds such auto-detection to kernel compilers (front-end
> server and gen_kernel).
>
> Issue: https://github.com/dart-lang/sdk/issues/41206
> Change-Id: If78491d08390c28b98e86857ec7d61520433dee9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148024
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Ibc185caa6975087a35c89ff69faf3f6c11fcf14c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148201
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-14 22:10:45 +00:00