Commit graph

85024 commits

Author SHA1 Message Date
Konstantin Shcheglov
b12e5e16de Builder / executor for macros in AnalysisContextCollectionImpl by default.
Change-Id: Ie5455bbdd3f55f78f6acf54a617365da0467926d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241866
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-21 20:56:59 +00:00
Ryan Macnak
0c762283a4 [vm, compiler] Remove dead kKeepCalleePP.
Dead since cf1de7d46c.

TEST=ci
Change-Id: I6dd42a62a8bfc8ff71bae8f1e33930c1bacfe103
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242040
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-21 20:30:58 +00:00
Sam Rawlins
c32fe13239 Fix help for completion_metrics
As it is, it is broken if you pass `--help`.

Also, this adds line wrapping for option help text.

Change-Id: Ia1e096eba46b1f4db804f9c1ed771d4e67816ae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242020
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-04-21 20:14:29 +00:00
Konstantin Shcheglov
a5cc4b50cb Issue 48832. Watch only resource included into ContextRoot.
This does not solve all the problems, but might be enough for a
specific problem of analyzing a single file.

Bug: https://github.com/dart-lang/sdk/issues/48832
Change-Id: I02bfbf19fdbd6e8b848efdb76c355363bf2b86eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241983
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-21 19:57:28 +00:00
Konstantin Shcheglov
70e9d3f63e Use implementation (full content) based signatures for results that might be affected by macros.
Change-Id: I5106930ac904a99e674cba7e3ed1ecd29b104d1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241861
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-21 19:48:13 +00:00
itsjustkevin
d31c848c8a Angular Test Fix: Angular test failing due to attempts to utilize the length method on null. Add a null check.
Change-Id: I8d2560ce696865fec7719bc75d868f9e1b01ffcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242001
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
2022-04-21 18:22:51 +00:00
Ryan Macnak
a8d9119f00 [vm] Add missing field metadata for finalizers.
TEST=misc heap tools in Observatory
Change-Id: Iefaa6f749e3c950f7b5ee3d542e2db103fd47222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241841
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-21 17:59:28 +00:00
Mark Zhou
7f98a6dfe6 [dart2js] Adding holder info to dump info tests.
Change-Id: Ia45bc281cda289dcfa125aa40622a39e16f9422f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241500
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-21 17:55:58 +00:00
Devon Carew
bb0ee159d9 [deps] rev package:sse
Change-Id: I5c03ff1600571d33f8304a9409f03267c5a81b36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241981
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-21 16:37:18 +00:00
Joshua Litt
8e6fa91711 [dart2wasm] Add support for calling Dart functions from JS.
Change-Id: I83cb295ce61b266b86e9efa194dcbc61fc2c8d31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239200
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-21 16:30:18 +00:00
Ryan Macnak
cb7a765f14 [test] Mark disassemble_aot_test as slow.
Bug: https://github.com/dart-lang/sdk/issues/48849
Change-Id: I8d277a1ed1dca0179865c38c670789308c43941b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241900
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-21 16:13:18 +00:00
Alexander Markov
2afc34112c [vm,kernel] New async/await implementation in the VM, part 1 - kernel
This change includes kernel-related changes:

* --compact-async option is added to kernel compilers (front-end
  server and gen_kernel). This option disables desugaring of async
  and await on kernel AST. Note that 'await for' is still desugared.

* File offset of the 'await' is now written for AwaitExpression nodes
  in the kernel binaries (will be used for async stack traces).

* Async/async*/sync* functions and AwaitExpression nodes are supported
  in TFA.

Design doc: go/compact-async-await.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I4233086b7434bc48347f4220645b0be5f9133456
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241842
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-04-21 15:11:08 +00:00
Devon Carew
707e2013a6 [deps] rev webdev (and package:frontend_server_common) to the latest
Change-Id: I75cdd5ad2e014c64ad0f84a0277c9f663aa84300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241863
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-21 14:52:00 +00:00
Paul Berry
efe0bf3ec5 Push logic for constraining argument types into argument visiting loop.
In order to implement https://github.com/dart-lang/language/issues/731
(improved inference for fold etc.), we'll need to gradually accumulate
type constraints as we evaluate arguments, and periodically re-do
inference; we can't just accumulate all the formal types and actual
types and run them through an inference process at the end.

This change moves us a step toward that eventuality, by accumulating
type constraints after type inference visits each argument, rather
than all at once after all arguments have been visited.  The total
amount of work done is unchanged.

Change-Id: I91ed0529cd3142afe4153cac8c25bce3c20f137d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241800
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-04-21 13:38:16 +00:00
Paul Berry
e63cea6634 Unify named and unnamed argument handling logic for invocations.
In order to support https://github.com/dart-lang/language/issues/731
(improved inference for fold etc.) I'm going to need to add logic to
_inferInvocation to postpone type analysis of arguments that are
function expressions.  To avoid having to code up this logic twice, it
will be helpful to have both named and unnamed arguments handled by
the same chunk of code.

In particular, this change unifies the computation of
inferredFormalType, the recursive call to inferExpression, the logic
for hoisting, and the update of the local variables identicalInfo,
formalTypes, and actualTypes.  We pay a small price by having to have
multiple `if (isExpression)` checks, but these should be very fast.

Change-Id: I095a7eac84237eeb878cc3dd86e76a6a871f31d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241041
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-04-21 12:33:18 +00:00
Vyacheslav Egorov
28654b90e8 [vm] Avoid local labels in assembly snapshots.
Labels starting with L are treated as local by the assembler
and cause problems down the line. When targeting ARM64 Mach-O
having local labels cause linker to break when trying to
generate compact unwinding information with a cryptic error

    ld: too many compact unwind infos in function <...>

This happens because local labels are not seen as function
boundaries and multiple .cfi_startproc/.cfi_endproc are
mashed into a single function.

Fixes https://github.com/flutter/flutter/issues/102281

TEST=runtime/tests/vm/dart{,_2}/no_local_labels_test.dart

Change-Id: I0171dc08f49c71ccb1ca02b398e01ac241efd9a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241962
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-04-21 11:06:39 +00:00
Johnni Winther
b2717a1cd3 [cfe] Support adding default constructors through macros
This adds support for adding a no-name constructor using macros to a
class with no explicit constructor.

Change-Id: I4b614b74fe141ccb4797ace8d73c3ce2869f3826
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241750
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-04-21 10:34:18 +00:00
Chloe Stefantsova
59e6a37962 [cfe] Use NNBD-updated least closure in constraint gathering
Closes https://github.com/dart-lang/sdk/issues/47797

Change-Id: I58544e185fc691630d56960d54f0711f4a91b60a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241746
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-04-21 09:28:28 +00:00
Jens Johansen
64a169ec7e [CFE] Avoid crash with experimental invalidation when same file is imported with both package and file uri
If importing the same file both by package-uri and file-uri it becomes
two different libraries in the compiler. They both have the same file
uri though.
When invalidating such a file by file uri they will both be invalidated.
When having experimental invalidation enabled it will - for each of
those invalidated libraries - get the source, compare it to the current
on-disk source, and - if the outline hasn't changed - remove the old
source to avoid having something wrong in memory. When trying to process
the second version of the file the old source has been removed and we
thus will crash if using a bang on the output from the uriToSource
lookup.
This CL avoids the crash by postponing the removal of the old source
until we're sure we'll return successfully. This is also more correct
in general as we might otherwise remove sources where we're (for later
reasons) going to bail out.

Change-Id: If5d767764a958b2dbb09cc011745e13e572038a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241745
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-04-21 09:12:47 +00:00
Jens Johansen
3aa8f2519b [CFE] Fix using part as entry with experimental invalidation
Change-Id: I813aecd06aa2e7c4cc6b1aadff50a77268096ca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241743
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-04-21 09:12:29 +00:00
Stephen Adams
618db8a41d [dart2js] Rename lib/compiler.dart to lib/compiler_api.dart
Always import 'lib/compiler_api.dart' with prefix 'api'.
Remove import of 'lib/src/compiler.dart' with prefix 'api'.

Some of the test helper files under 'compiler/test' are a little tedious
with lots of 'api.' prefixes and I could be convinced to change them
back but I think we should stick with always using a prefix under
'compiler/lib/'.

Change-Id: I3f82d7d31f1c90a860c9811fce031a64cea04ddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241867
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-04-21 03:42:39 +00:00
Konstantin Shcheglov
20600aa86d Revert the comment line experiment.
We found a reason why it was failing - a failing test that started
to pass. So, we don't need this exprerument anymore.

Change-Id: I6cb837710706ff4826366a38ca9bd600b4212f72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241862
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-20 23:34:58 +00:00
Ryan Macnak
5f1bda06ee Revert "[build] Fix Android build for ARM64 Mac."
This reverts commit b50396740f.

Reason for revert: vm-kernel-precomp-linux-debug-simarm_x64

Original change's description:
> [build] Fix Android build for ARM64 Mac.
>
> TEST=local
> Bug: https://github.com/dart-lang/sdk/issues/48792
> Change-Id: Ia43dd46f90ef5f592e324bb889c20c221f69998a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241102
> Reviewed-by: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: William Hesse <whesse@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=whesse@google.com,rmacnak@google.com,dacoharkes@google.com

Change-Id: I0cfdb5653dff7675afdb005df0c37f7560b26ee3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/48792
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241860
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 23:13:29 +00:00
Ryan Macnak
6cea65bab7 [benchmarks] Add benchmark to record various startup durations.
TEST=ci
Change-Id: I65b298aa3f4a1ddf7752dc787e0a2ff1c2cacff8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241840
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 22:48:38 +00:00
Srujan Gaddam
a5cd295831 [CFE] Add 'futureValueType' to visitors/transformers
Closes https://github.com/dart-lang/sdk/issues/48835

This fixes an issue in which erasure is incomplete for
static interop types.

Change-Id: Ia2aef8c009d83df30bbb63b9c4dbb5b96e9f8e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241820
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-04-20 21:59:10 +00:00
Joshua Litt
43cfa8cea3 [dart2js] Support trimming modular analysis data.
Change-Id: I0e0902813fd71c0bda5de6171487fa0e941f6bad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241246
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-20 21:58:29 +00:00
Jake Macdonald
49f10b2ab8 fix a few issues discovered while implementing the observable example
Change-Id: Ic4c88ab446b682170489289799c63a9d57f8b700
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241802
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-04-20 21:28:58 +00:00
Ryan Macnak
744864c4c5 [vm] Reduce TLS access during runtime allocation.
TEST=ci
Change-Id: Iec212406bc0af93699b08a3c28394551647646b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241202
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 21:10:08 +00:00
Ryan Macnak
fbff8bd768 [vm, gc] Evacuate new-space when the store buffer overflows.
If the popular store buffer targets are copied instead of promoted, the store buffer won't shrink and a second scavenge will occur that does promote them.

TEST=ci
Change-Id: I09fd7f263a2a9e99179af7ee58bc93335c4f5d05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241203
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 20:30:18 +00:00
Stephen Adams
3634234ca0 [dart2js] Some simple NNBD migrations
- Migrate five trivial libraries.
- Add 'show' on some imports to help understand imports that use only a few definitions.

Change-Id: Ibc26b78d65cb808fa6146e47e8ae8c7d336303b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241693
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-04-20 20:18:38 +00:00
Mark Zhou
d8baf0e377 [dart2js] Adding initial unit test for dump info members
Change-Id: I9209d8bae4106eb2a8666fc24b37be4845d2639f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241346
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2022-04-20 19:34:18 +00:00
Devon Carew
a185c51973 [deps] rev package:shelf_proxy to the latest
Change-Id: Ic86d818169f12d7f6934e0b6df849d3afbac45bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241803
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-20 19:14:38 +00:00
Riley Porter
1c74986a2a [JSinterop] Skip csp build for new tests using eval
Change-Id: Id008ebd57d7f30e1a9a7dffb0e4b48105f63357e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241805
Auto-Submit: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-04-20 18:38:38 +00:00
Mayank Patke
45c1e51bb3 Revert "[dart2js] Lower late field checks during SSA."
This reverts commit 7187b2efe9.

Reason for revert: Broke flutter roll

Original change's description:
> [dart2js] Lower late field checks during SSA.
>
> Change-Id: I80e7a30c6f2a461e46b4f52ebf7eb7a13fbc6227
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240501
> Reviewed-by: Stephen Adams <sra@google.com>
> Commit-Queue: Mayank Patke <fishythefish@google.com>

TBR=sra@google.com,fishythefish@google.com

Change-Id: Idf4eff95425db4d770137d589d4bb5484fc6e187
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241806
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2022-04-20 18:37:18 +00:00
Konstantin Shcheglov
50a396c690 Support for Set macro argument.
Change-Id: If742693ba6dcfb7fe25214364e69a1bbfe901391
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241804
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-20 17:58:28 +00:00
Devon Carew
e7914887ca [nnbd_migration] add a dep on package:lints
Change-Id: I6719e140c8a3ec56fe90fbb3c67ca9548a3724a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241681
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-04-20 17:49:39 +00:00
Ryan Macnak
8778e322cc [build] Toolchain setup for ARM64 Windows.
Bug: https://github.com/dart-lang/sdk/issues/47824
Change-Id: I75fa3be1ea66d7f9c5fbafc8cd05640324531cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239542
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 17:21:58 +00:00
Ryan Macnak
b50396740f [build] Fix Android build for ARM64 Mac.
TEST=local
Bug: https://github.com/dart-lang/sdk/issues/48792
Change-Id: Ia43dd46f90ef5f592e324bb889c20c221f69998a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241102
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-04-20 17:15:48 +00:00
Konstantin Shcheglov
dd26a0eae1 Build FunctionTypeAnnotation(s) for macros.
Change-Id: Ia18c132cb05c4a9cd1df569bb65202a8f1379596
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241801
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-04-20 17:02:48 +00:00
Daco Harkes
c440a0d2bc [vm] Only use IL print functions if available
https://dart-review.googlesource.com/c/sdk/+/241607 broke product
builds.

TEST=SDK build

Change-Id: I996e0554e77798e2c5cac3521b15011da4885a62
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-product-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241749
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-04-20 16:51:24 +00:00
Danny Tuppeny
147dca35a3 [analyzer] Use LinkedHashSet for recording errors to keep order consistent
Fixes https://github.com/Dart-Code/Dart-Code/issues/3934.

Change-Id: I1cd9fd35ddbbd768877e6b2b2984056ed5ec5d9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-04-20 16:03:18 +00:00
Daco Harkes
1cce5e6090 [vm/ffi] Stop writing beyond allocated stack space
This CL adds an assert to check we're not writing beyond the allocated
stack space. This assert triggers at compile-time, rather than at
runtime, and it catches cases which would sometimes go correct at
runtime because the stack is also 16-byte aligned.

This only occurred on MacOS/iOS Arm64 because structs are word-aligned
on the stack in the other ABIs.

The fix in this CL is to always add 4 bytes extra in this ABI.

The alternative fix would be to stop copying word-size chunks and use
smaller moves. However, this would require a major re-engineering of
the marshaller because it breaks structs up in word-size definitions
currently.

TEST=tests/ffi/function_structs_by_value_generated_test.dart
     (would trigger the assert without the fix on MacOS arm64)

Fixed: https://github.com/dart-lang/sdk/issues/48806
Change-Id: Ia590be76919a192fed144520ee28b1abaf3aa485
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-mac-debug-arm64-try,vm-kernel-nnbd-mac-debug-x64-try,dart-sdk-mac-arm64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241607
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-04-20 15:42:58 +00:00
Joshua Litt
84497e41ca [package:js] Add @trustTypes annotation.
Adds an experimental `@trustTypes` annotation which can be used during
migration to static interop to preserve the older semantics for JS interop.

Change-Id: Ic00a6c968b15f8c8f5d0840b82db5a6670eaf0eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241362
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-04-20 15:24:18 +00:00
Clement Skau
af2de233e5 [infra][nit] Make test.py output a little cleaner.
test.py's output is truncated to a certain length to avoid
tests flooding the terminal.
However, the way it's implemented it likely cuts off a line
of output at an arbitrary point, and then prints its own
message to let the user know the truncation happened.
This ultimately means that said message will often be hard to
spot as it flows together with the output.

This change makes sure there is always a newline at the end
of the output, ensuring the message will be on its own line.

TEST=Manual testing locally.
Change-Id: I91146ce7ce3d4fb0a35465a77aaf783df2acf4b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241742
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2022-04-20 15:21:28 +00:00
Paul Berry
8f8a63fccb Don't hoist function literals when reordering expressions to support "named arguments anywhere".
Hoisting function literals isn't necessary because evaluating a
function literal doesn't have any side effects.

This paves the way for adding support for
https://github.com/dart-lang/language/issues/731 (improved inference
for fold etc.), which will require deferring type analysis of function
literals.  By not hoisting them, we will be able to avoid a lot of
unnecessary complexity in the logic to defer them.

Change-Id: I0a49aa9f769f0506569e6029a3697898308600c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241007
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-04-20 14:24:28 +00:00
Vyacheslav Egorov
d2126a3d5b [vm] Avoid deadlocks when launching subprocesses
Forked process should use _exit() rather than exit()
when exiting without exec-ing otherwise it risks
to hit an issue (e.g. deadlock) in an atexit handler.

Additionally `man fork` states:

> After a fork() in a multithreaded program, the child can
> safely call only async-signal-safe functions (see
> signal-safety(7)) until such time as it calls execve(2).

_exit is on the list of async-signal-safe functions, but
exit is not.

Fixes b/216834909

TEST=runtime/tests/vm/dart{,_2}/regress_b_216834909_test.dart

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-android-release-arm64c-try,vm-kernel-mac-release-x64-try
Change-Id: Ia67f23825fc0ee1c1918faf2d4ef3b81033263eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241608
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2022-04-20 13:55:59 +00:00
Clement Skau
1320e644d5 [infra] Make test.py --build fail fast.
Currently, running `test.py --build` will attempt to build
the necessary files, before running the tests specified.
However, the tests are run even if this build fails, which
usually means old build artefacts are used for running the tests.
This can lead to some very confusing results if you do not yourself
catch that the build failed half-way through the run.

This change makes `test.py` exit with an error code and a message,
and does not proceed with the tests, if the build fails.

TEST=Manual testing locally.
Change-Id: I4e0f1d3f8d695219f2e4c0d7b474542af136aca9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241740
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2022-04-20 13:55:58 +00:00
William Hesse
f2c6a374e1 [infra] Update firefox browser to 98.0.2
The checked-in Firefox browser used for testing is updated from
version 67 to version 98.0.2

Bug: https://github.com/dart-lang/sdk/issues/48318
Change-Id: I78bfb404ad1203496e19df5b48102338b9800fc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240720
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2022-04-20 13:18:19 +00:00
Johnni Winther
6bf48988c8 [cfe] Add test for type arguments on map().toList()
This updates the analysis helpers to add a test for the `map().toList()`
problem addressed in https://dart-review.googlesource.com/c/sdk/+/241605

Included in the CL is the addition of the 'analyze.dart' tools, which
can be used for advanced code searches. This was used to find the
occurences of `map().toList()`.

Change-Id: I6e9da282e37fde4534ed5e308260f092779d0750
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241744
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-04-20 12:28:18 +00:00
Johnni Winther
f26c0e2056 [cfe] Add explicit type argument to .map(...).toList()
Expressions like

  List<VariableDeclaration> variables = ...
  List<Expression> reads = variables.map((v) => VariableGet(v)).toList()

don't get the intended type argument `<Expression>` through inference,
but instead the type inferred from the return type of the closure, in
this case `<VariableGet>`.

This causes problems when used with the AST which assumes that
expressions are interchangeable wherever they are used, and is likely
the cause of https://github.com/flutter/flutter/issues/102077 .

This CL adds an explicit type argument in these cases.

TEST=general/infer_map

Change-Id: I0bcae21f06c54f290dc20686b0d84c065d8ea04c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241605
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-04-20 06:56:58 +00:00