Commit graph

79971 commits

Author SHA1 Message Date
Danny Tuppeny
10b83a4882 [analyzer] Tag constructor names as methods instead of classes in LSP semantic tokens
Fixes https://github.com/Dart-Code/Dart-Code/issues/3374.

Change-Id: Icb6e6b01e3abd77aa9da02ac9d9c9d62b77e2c21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201831
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-06-01 15:22:23 +00:00
Michael Thomsen
af957d9578 Roll pub
Replaces previous attempt from https://dart-review.googlesource.com/c/sdk/+/201825

Change-Id: I2226d48b21f1bdd69fa5bb73af8816975409d475
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201826
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-06-01 14:08:53 +00:00
Martin Kustermann
a44d1eefe6 [vm/compiler] Allow lazy deopts to continue in unoptimized code at beginning of IR instruction
If an IR instruction lazy-deopts it usually continues in unoptimized
code in the same IR instruction after-call.

Though in certain situations we want to continue before-call in
unoptimized code.

Two cases relevant in this CL:

  * An instruction gets LICMed: If it lazy-deopts it will continue
    at the Goto instruction outside the loop.

  * A recognized method which got it's InstanceCall replaced by several
    IR instructions. If any of them (except the last one) lazy-deopts
    it should re-try the call in unoptimized code (e.g. []=)

In order to faciliate this we add a bit to the [Environment] which
encodes whether the continuation point in unoptimized code is
before-call - if so, we issue corresponding metadata.

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

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

Change-Id: Ib824081768a2fd6293751a8fe09753e0d8155c87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200644
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-06-01 12:59:23 +00:00
Michael Thomsen
7fb2e50d74 Revert "Roll pub"
This reverts commit 372f2d49e7.

Reason for revert: Contains unintended change to package_config.json

Original change's description:
> Roll pub
>
> Change-Id: Id197e006099ee4ee8ccb644a398b944f4500cce8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201824
> Reviewed-by: Jonas Jensen <jonasfj@google.com>
> Commit-Queue: Michael Thomsen <mit@google.com>

TBR=mit@google.com,jonasfj@google.com

Change-Id: Ibbae0f5f5b0cf0e7396988790933bd1bcb5fd3f2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201825
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-05-31 14:36:24 +00:00
Michael Thomsen
372f2d49e7 Roll pub
Change-Id: Id197e006099ee4ee8ccb644a398b944f4500cce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201824
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2021-05-31 14:17:32 +00:00
Michal Terepeta
659fdae898 Move most of the code from u/b/kernel_worker.dart to p/frontend_server
This should allow us to import the code in cases when we want to
implement the Bazel worker loop ourselves. This opens some possibilities
of extra optimizations for internal use cases.

I'm leaving some of the code (e.g., `main`) in the old location, so that
we do not break anything that depends on it.

The only thing that I've done is to pass the input-digest map to
`computeKernel` instead of using `Input` objects directly, this way
we can avoid the dependency on `package:bazel_worker` from
`frontend_server`. So now, if we're using the worker loop, the map will
be computed by `kernel_worker.dart` (in non-worker mode, we rely on
the default empty map).

Bug: http://b/187910394
Change-Id: I408407ebdebc17c7898552c053a8e1c269cf2df5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201187
Commit-Queue: Michal Terepeta <michalt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-31 13:47:14 +00:00
Jens Johansen
b3de23ef14 [flutter-frontend] Fix potential flutter-frontend bot failures caused by mismatch in NnbdMode
Previously there *could be* lots of failures caused by the compiler
auto-detecting nnbdmode (and as a consequence setting a specific nnbd
mode based on the first file compiled).

That means that the ordering of the files - which seems to be different
on the bot and on my local machine for instance - decides the nnbd mode
and as a consequence if there are errors because of it.

This CL splits compiles up into weak and strong and compiles those in
chunks, thus avoiding the errors.

Change-Id: If796458782fdbf4f7da4ebc98f6110f0279a12cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201565
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-31 12:27:22 +00:00
Daco Harkes
2a130ff363 [vm] Remove dead code LinkedHashMap RTEs
These natives are implemented in kernel_to_il.cc. Now that the bytecode
interpreter has been removed, the RTEs are dead code.

TEST=test/language includes many tests with Map.

Change-Id: I42bb49434f4be0b0a881353f2f24816bfda7a3ed
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-simarm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201820
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-05-31 10:25:22 +00:00
asiva
0742ed66a7 [VM/Tests] - Fix new abstract_socket_test.
- Skip in configurations that do not build the abstract_socket_test
executable
- Fix MemorySanitizer: use-of-uninitialized-value error

TEST=existing test - unix-socket-test

Change-Id: Ie9bf6dc1cd6bea98cd7859584473154f6ac49eee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201722
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-05-29 00:16:34 +00:00
Konstantin Shcheglov
d05093e5f9 Deprecate ImportElement.prefixOffset
Change-Id: I74441b4c060c326b68c446b2483d6509dd2b2970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201663
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-05-28 23:08:34 +00:00
Konstantin Shcheglov
2242843b97 Convert FunctionTypeBuilder type into synthetic.
We don't want types to track from where there were created.
This becomes an issue when we keep linking elements.
We already make synthetic FunctionType(s) during writing into bytes.
(and maybe we would don't need now, need to check)

This is a preparation for:
https://dart-review.googlesource.com/c/sdk/+/201661

Change-Id: I96e7d032409c47862fe6cb0344d7009f3afb28f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-05-28 16:11:08 +00:00
Alexander Aprelev
ed82bb6f4c [io/file_watcher] Ensure start/stop file watching requests are run on dart thread.
At present start/stop requests are scheduled on RunLoop thread.
This results in deadlocks since same RunLoop thread might be busy
with blocking writes of file watching events, not giving a chance
for Dart to read previously-written events. Reading would unblock
writer.
So this CL moves start/stop requests to run on Dart thread instead.

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

TEST=run analysis_server against flutter_gallery github-backed folder, switch between branches and ensure analyze_server remains responsive

Change-Id: I0464eeecf8e46ba3027fa0ed21cc323495d965c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201442
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-05-28 03:39:18 +00:00
Stephen Adams
bac8e8b0c0 [language] Add test for super-tearoff default arguments
Change-Id: Iec5d525b1f7f60f3245b6dca65eda90279b5eead
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201540
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2021-05-28 02:48:08 +00:00
Robert Nystrom
0e5417a48f Rename mis-named NNBD language tests.
Without "_test" in the name, the test runner ignores them.

Change-Id: I7dc2da51b980b1b5512fc2c2087238129bf1bd78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200930
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2021-05-28 01:12:07 +00:00
Konstantin Shcheglov
4be3201936 Infer the base constructor before inferring a mixin application constructor.
Change-Id: I79bdbb5dce8bd7dc7a5f705bce706b98be706c72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201640
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-05-27 23:56:15 +00:00
Ryan Macnak
ab00dcff12 [vm, compiler] Once an UnboxIntegerInstr is discovered to not deopt, remember this by switching to kNotSpeculative.
An UnboxIntegerInstr may have a Redefinition as its input when environments are removed from instructions that !ComputeCanDeoptimize, but the Redefintions may be removed during graph finalization, changing the type attached to the unbox's input from Int to non-Int, and so changing ComputeCanDeoptimize back to true.

TEST=vm/cc/IL_UnboxIntegerCanonicalization
Bug: https://github.com/dart-lang/sdk/issues/46018
Change-Id: I9e89055f07d0f40a374b1e8fd81122763a7a6bd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200906
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-05-27 23:49:34 +00:00
Zach Anderson
5dc1f8db8c Trim abstract unix socket path length
Fixes https://github.com/dart-lang/sdk/issues/46149

TEST=unix_socket_test
Change-Id: Icc5273941f880f581cc2621431b5cecb7782c71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201441
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-05-27 21:50:24 +00:00
Alexander Aprelev
f827c53315 [vm/transferable] Adjust the test so it throws OOM on bionic.
Bug: https://github.com/dart-lang/sdk/issues/46167
Change-Id: I99d4d4584605414ef1438a5b2cd1d9666b654a8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201641
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-05-27 21:35:24 +00:00
Joshua Litt
6a4bd42396 [dart2js] Create set of uppercase reserved symbols.
Change-Id: I07958be1832041a80db9c9dc6281270460d530a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201360
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-05-27 19:29:14 +00:00
Sam Rawlins
9f85dc07a7 Improve quality of @protected doc comment
Fixes https://github.com/dart-lang/sdk/issues/29804

Start doc comment with a single-sentence summary.
https://dart.dev/guides/language/effective-dart/documentation#do-start-doc-comments-with-a-single-sentence-summary

Separate the first sentence of a doc comment into its own paragraph.
https://dart.dev/guides/language/effective-dart/documentation#do-separate-the-first-sentence-of-a-doc-comment-into-its-own-paragraph

Replace text which refers to "using" an "invocation" of a member with text which refers to "referencing" a member.

Explicitly call out mixins and superclass constraints.

Improve language around using "this" as a receiver.

Attempt to use more straightfoward sentences.

Change-Id: Ib465b640c217d3759455611116aef0545b5665fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201445
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-05-27 18:41:24 +00:00
Ben Konyi
71238faee8 [ benchmark ] Use '.' instead of '_' to represent sub-benchmarks in SDKArtifactSizes
Change-Id: Ia47f9565025b79440aa179a215db2d7a95b744e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201582
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-05-27 18:14:14 +00:00
Brian Wilkerson
f09b484cca Fix a couple of bugs in DocumentationCache
Change-Id: I66a890a1aebc39d9cf11acd82d285b2328574102
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201581
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-27 17:55:54 +00:00
Alexander Aprelev
39dead4394 [io] Ensure bcrypt.lib is declared as a lib dependency for downnstream users.
Follow-up to 1731050b29

TEST=ci

Change-Id: Ic9119069bc58af71787e225b0efbc1d79155f0c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201580
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-05-27 17:26:54 +00:00
Konstantin Shcheglov
e021d0c171 Prepare for keeping elements created during linking.
Mostly set informative data that was previously omited because we
were setting it during loading from bytes.

Change-Id: I68a527a21628ee57ad0e574b34b7415d866159a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201500
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-05-27 17:12:54 +00:00
Ryan Macnak
266ad2a568 [vm, service] Include mapped files in GetProcessMemoryUsage.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46166
Change-Id: I66322c70e066bb89c1d568848e17f2ec4f8552d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201444
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-05-27 17:10:05 +00:00
Jens Johansen
33aac34b02 [CFE] Reproduce crash Class.superclassConstraints RangeError
```
Crash when compiling null,
at character offset null:
RangeError (index): Invalid value: Valid value range is empty: 1
#0      List.[] (dart:core-patch/growable_array.dart:254:60)
#1      Class.superclassConstraints (package:kernel/ast.dart:1090:73)
#2      ClassBuilderImpl.checkMixinApplication (package:front_end/src/fasta/builder/class_builder.dart:801:51)
#3      SourceLoader.checkMixins (package:front_end/src/fasta/source/source_loader.dart:1165:19)
#4      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:339:14)
<asynchronous suspension>
#5      withCrashReporting (package:front_end/src/fasta/crash.dart:121:12)
<asynchronous suspension>
#6      Outline.run.<anonymous closure> (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/fasta/testing/suite.dart:1850:21)
<asynchronous suspension>
#7      Outline.run (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/fasta/testing/suite.dart:1837:12)
<asynchronous suspension>
#8      ChainContext.run.doStep.<anonymous closure> (package:testing/src/chain.dart:188:22)
<asynchronous suspension>
```

or with assertions enabled:

```
'package:kernel/ast.dart': Failed assertion: line 1087 pos 14: 'currentClass.implementedTypes.length == 2': is not true.
#0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
#1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2      Class.superclassConstraints (package:kernel/ast.dart:1087:14)
#3      ClassBuilderImpl.checkMixinApplication (package:front_end/src/fasta/builder/class_builder.dart:801:51)
#4      SourceLoader.checkMixins (package:front_end/src/fasta/source/source_loader.dart:1165:19)
#5      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:339:14)
<asynchronous suspension>
#6      withCrashReporting (package:front_end/src/fasta/crash.dart:121:12)
<asynchronous suspension>
#7      Outline.run.<anonymous closure> (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/fasta/testing/suite.dart:1850:21)
<asynchronous suspension>
#8      Outline.run (file:///usr/local/google/home/jensj/code/dart-sdk/sdk/pkg/front_end/test/fasta/testing/suite.dart:1837:12)
<asynchronous suspension>
#9      ChainContext.run.doStep.<anonymous closure> (package:testing/src/chain.dart:188:22)
<asynchronous suspension>
```

Bug: https://github.com/dart-lang/sdk/issues/46161

Change-Id: I452729ae4b3d0a14528ea2dda51de14185bb965b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201562
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-05-27 13:23:24 +00:00
Jens Johansen
db6f72212b [CFE] Crash on recompile: TypeBuilderComputer.visitInvalidType 'Not implemented'
```
Crash when compiling null,
at character offset null:
Not implemented
#0      TypeBuilderComputer.visitInvalidType (package:front_end/src/fasta/kernel/type_builder_computer.dart:42:5)
#1      InvalidType.accept (package:kernel/ast.dart:10619:42)
#2      TypeBuilderComputer.visitInterfaceType (package:front_end/src/fasta/kernel/type_builder_computer.dart:102:43)
#3      InterfaceType.accept (package:kernel/ast.dart:10896:42)
#4      DillLoader.computeTypeBuilder (package:front_end/src/fasta/dill/dill_loader.dart:117:17)
#5      computeTypeBuilder (package:front_end/src/fasta/dill/dill_class_builder.dart:188:24)
#6      DillClassBuilder.interfaceBuilders (package:front_end/src/fasta/dill/dill_class_builder.dart:156:21)
#7      ClassHierarchyNodeBuilder.build (package:front_end/src/fasta/kernel/class_hierarchy_builder.dart:1490:39)
#8      ClassHierarchyBuilder.getNodeFromClassBuilder (package:front_end/src/fasta/kernel/class_hierarchy_builder.dart:603:10)
#9      ClassHierarchyBuilder.getNodeFromTypeBuilder (package:front_end/src/fasta/kernel/class_hierarchy_builder.dart:608:33)
#10     ClassHierarchyNodeBuilder.build (package:front_end/src/fasta/kernel/class_hierarchy_builder.dart:1524:25)
#11     ClassHierarchyBuilder.build (package:front_end/src/fasta/kernel/class_hierarchy_builder.dart:742:14)
#12     SourceLoader.buildClassHierarchy (package:front_end/src/fasta/source/source_loader.dart:1213:46)
#13     KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:332:14)
```

Bug: https://github.com/dart-lang/sdk/issues/46160

Change-Id: Ic9198da47dde1a9c1653bcfa98c55e738ca93e64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201561
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-05-27 08:39:34 +00:00
Jens Johansen
4f26789bf2 [CFE] Reproduction of type change on recompile
Bug: https://github.com/dart-lang/sdk/issues/46159

Change-Id: I2d628eb803e6b29c40ddb666e496f8fc98727960
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201560
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-05-27 08:16:24 +00:00
Sergey G. Grekhov
a7273673a4 [co19] co19_2 status file cleanup
Change-Id: I69c7d0daf01dca4b84dfc84286d1bb2fa067a4a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201480
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-05-27 08:15:04 +00:00
Johnni Winther
8453731dfd [cfe] Migrate wave 8+9
Change-Id: I6d95247fa088dba2f887e799c1cac6acd8456402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201403
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-05-27 07:59:54 +00:00
Daco Harkes
b0bfee6627 [benchmarks/vm] Add benchmarks for #45908
The implementation of const map literals is based on linear lookups in
an array containing key/value pairs instead of a hash table.

Bug: https://github.com/dart-lang/sdk/issues/45908

Golem CL:
https://chrome-internal-review.googlesource.com/c/golem/+/3852562

Change-Id: If0a980339ee1342c41f9388e0bd7b3615a4ef4e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200188
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-05-27 07:54:14 +00:00
pq
f00dc3d056 @useResult verification
See: https://github.com/dart-lang/linter/issues/1888

Change-Id: I3d5ed31f3a1dd0d69da5f47ae38496a4fe6051c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-05-27 00:26:54 +00:00
Sam Rawlins
fd8607c8f4 Implement inference_failure_on_function_invocation checks
The "inference failure" checks implemented here are long overdue. They
are part of the strict-inference spec [1]. I think I caught most function
invocation cases. All of the work done to determine which error to report
and whether @optionalTypeArgs is annotated is done _after_ the check
for whether strict-inference is enabled, so this should have no effect
on code which does not opt in to that mode.

[1] https://github.com/dart-lang/language/blob/master/resources/type-system/strict-inference.md#function-call

Bug: https://github.com/dart-lang/sdk/issues/33749 and
Change-Id: Ic1d4321fb289acb118e0dbddd48ff917ad39d69a
https://github.com/dart-lang/sdk/issues/45371
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201321
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-05-26 21:02:42 +00:00
Brian Wilkerson
6de639b71f Move TargetKind.displayString from analyzer to meta
Change-Id: Ifa24fb96c97c6b7a2f27794e671672796c56331e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-26 19:37:40 +00:00
Dmitry Stefantsov
f81de15da7 [cfe] Add first portion of tests for constructor tearoffs feature
Change-Id: I868849ce96d2bfcbc05e7afc131a9fe43a83949c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201261
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-05-26 18:12:00 +00:00
Ryan Macnak
26f50368d2 [build] Check that a second Ninja invocation does nothing.
Not checking Windows, where the set of linker outputs is not constant.

Change-Id: I1241aa4108f7feebc2638ca762743464fcb48a52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201165
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-05-26 17:48:30 +00:00
Danny Tuppeny
f9b6901baf [dds] Add a basic DAP server that can run simple Dart scripts
Change-Id: I0f10b81b0b9ad3875727f606dd1a5a44798486b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201263
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-05-26 17:22:00 +00:00
JustWe
3422467426 [analyzer] bugfix: never's type should be an type-type, but not neverType or dynamicType.
try to fix: https://github.com/dart-lang/sdk/issues/45399

Closes https://github.com/dart-lang/sdk/pull/45808
https://github.com/dart-lang/sdk/pull/45808

GitOrigin-RevId: 96c3ba69635c310f5352ae7eb6a6344ef5f1495a
Change-Id: I25cce181070f8e097721ab6e3f08071ea7162360
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196641
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-05-26 16:29:50 +00:00
Alexander Markov
a3767f7db8 [vm/compiler] Generate non-speculative Unbox instructions for Phis
TEST=runtime/tests/vm/dart/regress_flutter83094_test.dart
Issue https://github.com/flutter/flutter/issues/83094

Change-Id: Ib4eebc993e06f6925f11bd18e5f29f22ba3c6322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201363
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-05-26 16:02:10 +00:00
Alexander Aprelev
ee0952d8f5 [vm/concurrency] Grab read isolates_lock when iterating over isolates.
When iterating over isolates in IsolateGroup::RegisterStaticField we need to grab read isolates_lock
to prevent data races as isolates_ list might be being updated.

TEST=generated_stress_test

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

Change-Id: I46b9826a268d38d07b1aeec9362de3e5945642fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201342
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-05-26 15:55:19 +00:00
Daco Harkes
939960ca0c [cfe/ffi] Remove dead code
TEST=tests/ffi

Change-Id: Idf2a81d186393aa507ef66c162cd9f080b9b534d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201404
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-05-26 15:29:00 +00:00
Paul Berry
784812418c Fix error recovery for : super.<keyword>() / : this.<keyword>()
Previously, if a keyword was used in place of a constructor name in a
constructor initializer list, it caused an analyzer crash, because as
part of error recovery, the AST builder would try to create a
SuperConstructorInvocation or a RedirectingConstructorInvocation using
a null argument list.  This CL fixes the problem by creating a
synthetic argument list.  It re-uses logic that previously existed for
creating a synthetic argument list.

To avoid a crash happening later in analysis, it was also necessary to
modify the AST cloner so that when it encounters the `(` and `)`
tokens in the synthetic argument list, it is able to clone them even
though they are not in the token stream.  (Note that this is not an
ideal solution; I would have rather inserted the `(` and `)` into the
token stream, but with the current parser architecture there's no good
way to do this without the parser then trying to interpret those
tokens).

Change-Id: Ibbdcdd956d80c16d427ba1ba7a9cd7ce374e941b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201282
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-05-26 13:50:12 +00:00
Daco Harkes
50640bdb81 [vm/ffi] Fix ia32 struct by value return with no arguments
On IA32 arguments are passed in registers. When a struct is returned
by value, a pointer is passed in on the stack containing the address to
which the return value is written. We did not account for this pointer
in the stack-height calculation.

This problem only surfaced when there are no arguments to the function.
Because if an argument is passed it has a higher stack height than the
pointer for the result being passed in.

Fix in: runtime/vm/compiler/ffi/native_calling_convention.cc

TEST=runtime/vm/compiler/ffi/native_calling_convention_test.cc
TEST=tests/ffi/regress_46127_test.dart

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

Change-Id: Ia78fe07cc7e3a3c8625143d491935a959b4a7895
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201269
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-05-26 13:37:32 +00:00
Tess Strickland
45b51f9ab6 [vm/tests] Fix vm/dart/disassemble_aot_test.
Bug: https://github.com/dart-lang/sdk/issues/46143

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I2fa01046030471266c04b233adbd0016ec67ea82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201270
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-05-26 13:25:32 +00:00
Jens Johansen
57e467b6ee [CFE] Speedup test_generator_test by not verifying platform for every compile
Fixes https://github.com/dart-lang/sdk/issues/46088

Change-Id: Id46b06c90f68fa93300cbfbd8f4e0914e11abb35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-05-26 12:33:52 +00:00
Daco Harkes
1d38c98b69 [vm/ffi] Fix CFE crash on missing Array sizes
Closes: https://github.com/dart-lang/sdk/issues/46085

TEST=tests/ffi/regress_46085_test.dart

Change-Id: I04e05baccb6eb490ef32702677e3d5c1bb815560
Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-linux-debug-x64-try
Fixed: 46085
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201264
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-05-26 11:02:22 +00:00
Johnni Winther
e817b2d05a [cfe] Migrate kernel/collections.dart
Change-Id: I2cfb17e8afd75e966688d8c3a142378efdf29025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201265
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-05-26 10:28:52 +00:00
Daco Harkes
cd0f6aed25 [vm] Replace KernelConstantsMap with array
This CL replaces the KernelConstantsMap (backed by an Array that got
replaced on growing) by an Array that is allocated to be the required
size.

Does not cache the start of the constants table in the constructor
as proposed in [1], because the constants table is null when the
ConstantReader constructor is called in the KernelLoader constructor.

[1] https://dart-review.googlesource.com/c/sdk/+/196925/6..10/runtime/vm/compiler/frontend/constant_reader.cc#b116

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

TEST=vm test suite, including GC tests.

Change-Id: Ie111bedc7eb7fcd627ab700a9906245bc7dd14ce
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try
Fixed: 45903
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200871
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-05-26 09:41:42 +00:00
Tess Strickland
1d0bac85bc [vm/compiler] Create AllocateObjectABI struct in constants.
Also make all other Allocate*ABI structs explicitly use the same result
register as AllocateObjectABI for consistency.

TEST=Refactoring, so existing tests.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Change-Id: Iede8ff499ae3e7741e57090c36bc6b5dcc9217b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201184
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-05-26 09:39:22 +00:00
Tess Strickland
619f46cd19 [vm/compiler] Various cleanups involving CreateArrayInstr.
* Rename values and methods like kElementTypePos or element_type() to
  corresponding names like kTypeArgumentsPos or type_arguments() (since
  the input to CreateArrayInstr is the type arguments vector for the
  array, not just the type of the element.)

* Create a AllocateArrayABI struct for the input and output registers of
  the AllocateArray stub and use those where applicable.

* Explicitly list what registers are clobbered in the AllocateArray
  stubs in their documentation comment.

* Avoid clobbering the type arguments input register in the arm64
  version of AllocateArrayInstr, so all input registers are preserved
  across all architectures.

TEST=Refactoring, so existing tests.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-linux-debug-simarm64c-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm64c-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-precomp-nnbd-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-simarm-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try
Change-Id: I3a7c2b6afdd307c26f8d4f97a4c8bd7684e7b242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201183
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-05-26 09:39:22 +00:00