Commit Graph

1972 Commits

Author SHA1 Message Date
Daco Harkes 0295dfc74e [vm] Support redirecting external const factories
This CL introduces the first combination of `external const factory`
with `@patch const factory (.*) = (.*)`. This specific combination was
never used in the core libraries, and did not work.

Half of the fix is a missing flag from the CFE:
https://dart-review.googlesource.com/c/sdk/+/187440

The other half of the fix is matching on the
kRedirectingFactoryConstructor tag, and allowing constructor names
in procedure targets (even though we never compile those expressions
because they are invalid).

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

TEST=Using redirecting const factory in patch file in core lib.
TEST=tests/ffi(_2)/*

Change-Id: I5524bde928290bf32aaea9170eda1f2d03127fa6
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try,front-end-linux-release-x64-try,vm-kernel-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187003
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-26 11:15:26 +00:00
Dmitry Stefantsov 9aa2b61fee [cfe] Propagate isRedirectingFactoryConstructor flag when patching
Bug: https://github.com/dart-lang/sdk/issues/45101
Change-Id: Id0c9f3ce319111a79b2085f44a4e4243dbe6597a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187440
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-02-26 10:51:36 +00:00
Dmitry Stefantsov c191551fac [cfe] Remove BottomType
TEST=Covered by existing tests.

Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 13:21:55 +00:00
Daco Harkes d45fd0f9d5 [vm/ffi] Support inline arrays in Structs
Adds support for single dimension inline arrays in structs. Multi-
dimensional arrays will be supported in a future CL.

This CL adds:
- CFE static error checks for inline arrays.
- CFE transformations for inline arrays.
- VM consumption of inline array fields for NativeType.
- Test generator support for inline arrays + generated tests.

Previous CLs added support for inline arrays in:
- analyzer https://dart-review.googlesource.com/c/sdk/+/183684
  - updated in this CL to new API.
- ABI calculation https://dart-review.googlesource.com/c/sdk/+/183682

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

Open issue: https://github.com/dart-lang/sdk/issues/45101

CFE transformations are tested with expectation files:
TEST=pkg/front_end/testcases/(.*)/ffi_struct_inline_array.dart

Trampolines and CArray API are tested with end-to-end Dart tests:
TEST=tests/ffi(_2)/(.*)by_value(.*)test.dart
TEST=tests/ffi(_2)/inline_array_test.dart

Compile-time errors (both CFE and analyzer) are tested in:
TEST=tests/ffi(_2)/vmspecific_static_checks_test.dart

Change-Id: I014c0e4153f1b885638adce80de6ab3cac8e6bb2
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183640
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-24 13:02:45 +00:00
Dmitry Stefantsov 3c259a0ab0 [cfe] Add ExtensionType as an internal Kernel AST node
Change-Id: I14bfb014489b3ccec34c079d951fc875ec814ebe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186288
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 11:56:15 +00:00
Johnni Winther 4e1c79d86b [cfe] Don't clone synthetic members into mixin applications
Change-Id: I8e92b95ae29f8cec16f69f59cc52c203bba5ea6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186140
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-22 16:17:29 +00:00
Johnni Winther 79de274398 Revert "[cfe] Encode field references as @getters and @setters"
This reverts commit 3892e95547.

Reason for revert: Breaks Flutter web

Original change's description:
> [cfe] Encode field references as @getters and @setters
>
> This removes the @fields and @=fields canonical name
> encodings that allowed for encoding of conflicting members
> and didn't support field<->getter/setter conversion
> between dills or between outline and full dill.
>
> TEST=existing tests
>
> Change-Id: Id15e58ad4d1847d2c98a688705e5945196146c6d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184783
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

Change-Id: I744e284b16e097fa0833c5bdf1bc7653f13bdf63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186147
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-22 12:56:43 +00:00
Dmitry Stefantsov 55766c387a [cfe] Build extension types as their on-types if they are enabled
Change-Id: Iae52f25ffcc0517e9ec05c445ae1227af9fa3b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185881
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-22 11:17:48 +00:00
Johnni Winther 3892e95547 [cfe] Encode field references as @getters and @setters
This removes the @fields and @=fields canonical name
encodings that allowed for encoding of conflicting members
and didn't support field<->getter/setter conversion
between dills or between outline and full dill.

TEST=existing tests

Change-Id: Id15e58ad4d1847d2c98a688705e5945196146c6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184783
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-02-22 09:46:18 +00:00
Alexander Markov 9d4ad8a14b [core lib] Add unimplemented int.operator >>>
This change adds a placeholder for int.operator >>>.
No implementation is added yet.

This change unblocks implementation of this operator in
the backends (VM, dart2js, DDC).

Issue: https://github.com/dart-lang/sdk/issues/44912
Issue: https://github.com/dart-lang/sdk/issues/30892
Change-Id: I9912ca9f44d594e9c5fa91f5fc65e807fe48cc7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185480
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-02-22 00:02:47 +00:00
Dmitry Stefantsov 0912e56c09 [cfe] Delay resolution of redirecting factory invocations if needed
Closes #45003.

Bug: https://github.com/dart-lang/sdk/issues/45003
Change-Id: Ifa16c5859cd11efeed109ff78f5c40c20fe1790d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-19 16:05:14 +00:00
Johnni Winther 8a5b2efb2c [cfe] Allow generic metadata through experimental flag
Change-Id: If6dc5381546c2814cd838aee8ab7d6dc11e9106f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185544
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-19 10:19:08 +00:00
Johnni Winther 357e83e44d [cfe] Rename incremental_load/initialize_from_dill(_suite) to incremental(_suite)
Change-Id: I747151249330ed3c9c1026289be52d5ca0dca891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185600
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-19 08:41:07 +00:00
Johnni Winther 045a40d2e6 [cfe] Rename incremental_suite to incremental_dartino_suite
- to prepare for renaming incremental_load/initialize_from_dill to
  incremental

Change-Id: Ie47f8e46c90b61de0838a83dcc9a5be6d866aa19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185547
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-19 08:41:07 +00:00
Johnni Winther 821536f7a3 [cfe] Remove general_nnbd_opt_out
The folder 'general' now tests the same. Two tests unique to
general_nnbd_opt_out have been copied over to general.

Change-Id: Ibd02dc236cdddff0730fb99bf10504dd16329cab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185545
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-19 08:41:07 +00:00
Johnni Winther 667be21ae3 [cfe] Remove old sharding of suites.
Suites are now sharded through unit_test_suites.

Change-Id: Ifa810f9b7031d109ed85da012220cbea44c10245
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185541
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-19 08:41:07 +00:00
Johnni Winther 56f46b0659 Remove non-nullable experiment flag from front_end test cases.
This changes the CFE expectation test suites to use unsound null safety
as default to avoid passing --enable-experiments=no-non-nullable to opt
out old test folders.

This change removes most test folders from the 'strong' tester, since
this now only supports sound null safety, which requires all libraries
to be opted in. Instead, the 'weak' tester now runs all test folders.
Additionally the 'outline' tester is changed to use unsound null safety
so that it call be used on all test folders.

The 'fast_strong' tester is removed since it should just be run locally
and it can be run by passing an option to the other testers.

References to non-existing 'shaker' folder has been removed from
testing.json.


Change-Id: Ibcc306f7b27d06b9637c205238bc408194f1d062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184787
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 12:29:18 +00:00
Daco Harkes 5c7f7be9c4 [vm/ffi] Remove entry-point from Structs #sizeOf
Removes the entry-point on the `#sizeOf` field of `Struct` subtypes,
because we are no longer using it in the runtime.

Does not remove the entry-point from the constructor yet, because FFI
trampolines can instantiate these objects. Updated the TODOs to reflect
this.

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

TEST=tests/ffi(_2)/* in precompiled mode.

Change-Id: If3889e782b8fe34ef1c34cf8af83da041b4d2ef5
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185540
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-18 11:40:51 +00:00
Daco Harkes d763cd55fc [vm/ffi] Roll package:ffi to 1.0.0
G3 has been migrated (go/dart-ffi-1.0-g3-migration), so now we can roll
the package version which has all the deprecated methods removed.

Rolling `package:ffi` forward also means it is no longer using
`sizeOf<T>()` generically. So the problems in the CFE expect files
disappear.

Change-Id: I33c7c06c6b7b34178908b175f08f3fc0f275be41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185141
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-02-17 08:18:20 +00:00
Johnni Winther 4f65d69e5e [cfe] Handle duplicate getables and conflicting setables
Change-Id: Iea3cb2d74799f891367c27e1d5a460aa6e7ef803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183661
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-17 07:38:01 +00:00
Dmitry Stefantsov b994d51d98 [cfe] Disallow super-bounded aliased constructor invocations
This CL also threads through the inferredness of type arguments for
the factories, so that the error that is checked twice isn't reported
twice because the arguments are recognized as inferred in one place
and as explicit in the other.

Closes #42446.

Bug: https://github.com/dart-lang/sdk/issues/42446
Change-Id: I8cc158b6d8070d34c1489386962fa1f5e2592719
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184270
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-15 09:51:27 +00:00
Daco Harkes fca959e5f6 [vm/ffi] Add class to vm:ffi:struct-fields pragma
This CL changes `@pragma('vm:ffi:struct-fields', [...])` to
`@pragma('vm:ffi:struct-fields', _FfiStructLayout([...]))` which makes
it easier to add more data in subsequent CLs.

Extends `FindPragma` to allow returning multiple matched pragma's, so
that we can filter them. (In this case to avoid matching user-defined
pragma's that do not have an instance of the private class.)

Separated out from https://dart-review.googlesource.com/c/sdk/+/183640
because of the extra constant in existing expectation files.

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

TEST=tests/ffi(_2)/*_by_value_*_test.dart

Change-Id: Idef9f82e9b53c2a32dffabcec19669eae550fe2f
Cq-Include-Trybots: luci.dart.try:front-end-nnbd-mac-release-x64-try,front-end-linux-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-11 18:09:05 +00:00
Johnni Winther 504d63288e [cfe] Handle setter conflicts
Handle setter conflicts with non-setters and implicit setters.

Closes #44003
Closes #44844

Change-Id: I32c5e4022c187578e2cd37d13151c27451666dbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183660
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 15:56:35 +00:00
Jens Johansen cb89632bdc [CFE] Reproduction of error on recomile even without change (slight variation)
This is a slight variation of
https://github.com/dart-lang/sdk/commit/6aee7d0eb82c420a907af0a1da5e90ca66736db2
that was fixed in
https://github.com/dart-lang/sdk/commit/019ce33409e246973a217a7f9655444bc13d2619

This one still fails.

Change-Id: I92d62d96b3783243c0ff3ee2dab20f9c7c5ec22a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183663
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-09 07:30:12 +00:00
Paul Berry 680f5e6da5 Clean up error message nomenclature around metadata vs annotations.
Change-Id: I866900d2c4baca6ee000885f2126de2a97e643ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182800
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-08 22:00:04 +00:00
Dmitry Stefantsov c6bd2afc10 [cfe] Remove a side effect from computeConstCanonicalType
Closes #44857.

Bug: https://github.com/dart-lang/sdk/issues/44857
Change-Id: I1082fded9a0b06cbcf30c484975b0cf464db75a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182781
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-08 13:22:13 +00:00
Dmitry Stefantsov d3f3cfd531 [cfe] Report cyclic typedef use in bounds of type parameters
Closes #43975.

Bug: https://github.com/dart-lang/sdk/issues/43975
Change-Id: Ia7e7b6c46d3c0d2eaa2e809008847d3f47897d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-08 13:13:23 +00:00
Jens Johansen da4e3f4bbe [CFE] Textual outline requires ScannerConfiguration
The incremental compiler now passes the correct nnbd settings and
extension methods settings.

Change-Id: I89e6bad8af330c3c81f141c260b2325aca4a5bb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182630
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 12:10:27 +00:00
Jens Johansen 23a841c463 [CFE] Add a reordering fuzzing step to the strong unit tests
This CL:
* Adds a "reordering fuzzing step", i.e. it tries to sort the fields,
  procedures etc in both ascending order and descending order
  to verify that there are on crashes and no changes in error vs
  no error. This has been tested on http://dartbug.com/34803
  before the fix landed.
* Introduces an attempt at "visiting the outline" of the "direct from
  parser ast".

Change-Id: Ic3f5a776839030bb48a35eeee8575b37c19be453
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182504
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:00:10 +00:00
Johnni Winther 909c44cecf [cfe] Support dart2js and dartdevc targets in expectation tests
Change-Id: If087dfaf291f02812aa1191328a10ad2a5f135ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183007
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-08 08:30:20 +00:00
Johnni Winther 6ce8d74761 [cfe] Add Function.futureValueType and serialize Let.fileOffset
Serializing Let.fileOffset supports positions in stacktraces resulting
from null aware expressions, like `if (o?.foo) ...` when `o` is `null`.

Adding Function.futureValueType supports the proper backend
implementation for the fix in
https://dart-review.googlesource.com/c/sdk/+/181303

Closes #44654

TEST=existing

Change-Id: Ie5939a248d3d8bf41388e8f435e4ba4195afeabd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182269
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 14:06:47 +00:00
Johnni Winther 5a26dba0d4 [cfe] Add ExpressionGeneratorHelper.createVariableDeclarationForValue
This combines the creation of synthetic variables with registration
of the create variable in flow analysis.

The fixes the failing expectation tests that currently crashes with
assertion failures.

Change-Id: I0d581653775dab135abebdecd28c19c5712b8d88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182562
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 10:54:52 +00:00
Jens Johansen f3f831f103 [CFE] Enable asserts on unit test suites
This also updates the status files with the new crashes caused by
assert failures.

Change-Id: I0ec3fe8a10ad77c712760ab262297913f84e89b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182503
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-04 08:13:47 +00:00
Jens Johansen 1392263ecc [parser] Non-crashing recovery of in-progress generification of typedef
Fixes #43090

Change-Id: I1377ebf08a8c561e4f15abbf458c5bb0d8c61494
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182040
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 08:01:07 +00:00
Clement Skau 2236883ff2 [SDK] Removes non-exiting tests from .status
TEST=Tested all configurations.

Change-Id: Iec00d7e6ea56221ffebcf044de22647907f598f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182500
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-02-04 06:46:13 +00:00
Daco Harkes 75c17483d3 [vm/ffi] Rewrite .ref calls in CFE
This rewrites `Pointer<Struct>.ref` and `Pointer<Struct>[]` calls in
the CFE to skip the runtime entry when the type argument is constant.

The runtime entry is still used when the type argument is generic.
Forcing the type argument to be constant and removing the runtime entry
will be done in follow up CLs.

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

Removing the runtime entry speeds up `.ref` significantly.
before: FfiStruct.FieldLoadStore(RunTime): 18868.140186915887 us.
after: FfiStruct.FieldLoadStore(RunTime): 270.5877976190476 us.
Measurements from Linux x64 in JIT mode.

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

TEST=tests/ffi/structs_test.dart

Change-Id: I82abd930b5a9c5c78a8999c2bc49802d67d37534
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182265
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-02 16:33:54 +00:00
asiva 34f9734b41 Revert "[cfe] Handle conditional await in CFE"
This reverts commit 14032a6209.

Reason for revert : Several customer flutter tests are failing because
of the change in behavior.

TEST=revert of previous CL.

Change-Id: Ia235aa93b9c81fbab066803dc0625856f93acceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-02-01 23:41:01 +00:00
Dmitry Stefantsov 425e4dbe09 [cfe] Sort type variables topologically before building the bounds
Closes #44455.
Closes #34803.
Closes #42434.

Bug: https://github.com/dart-lang/sdk/issues/44455
Bug: https://github.com/dart-lang/sdk/issues/34803
Bug: https://github.com/dart-lang/sdk/issues/42434
Change-Id: I3be93b0d4a251de79c3bfe9829143f0fbec201ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181402
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 18:46:29 +00:00
Lasse R.H. Nielsen 4a484c88e1 Make ListMixin.take check that the argument is not null.
Fixes #41743, #30155
BUG= http://dartbug.com/41743

Change-Id: I223905a92b7353cdc50498d265a6dfe2f2f614d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160640
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-28 17:19:35 +00:00
Johnni Winther 019ce33409 [cfe] Don't handle synthesized as if they are declared in mixins
Members declared in mixins are treated as if these were declared in
the class where they are mixed in. This means that use their types as
declared types, instead of including them in a combined member signature.

This failed in the case where a member was synthetically added to the
mixin class, because the types of these we wrongfully be handled as
declared types.

We now skip all synthetic members when reasoning about mixed in members
as declared members.

Change-Id: I9c2311b4472fe16162fcdc4c56fce8db2d946f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181201
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-28 09:39:50 +00:00
Johnni Winther b4119d6787 [cfe] Add tests for how the CFE handles duplicates and setter conflicts
This is in preparation for a CL the removes @fields/@=fields canonical
names in favor of @getters/@setters and therefore needs stricter handling
of how duplicates and conflicts are emitted in the AST.

Change-Id: I87220a41c9777c94f9e9bce51ff5223fafdc738f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180342
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-01-26 14:27:39 +00:00
Johnni Winther 14032a6209 [cfe] Handle conditional await in CFE
This converts `return e` in async methods in opt-in libraries into

   return let v = e in v is Future<FTV> ? await v ; v

where FTV is the future value type of the enclosing function.

Closes #44395
Closes #44396
Closes #44397
Closes #44399

TEST=existing tests

Change-Id: I59687039bfe4a97ffdaa55ac0f193ca4fb208f44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175310
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2021-01-22 19:12:24 +00:00
Daco Harkes d74b2f4672 [vm/ffi] Deprecate Pointer.elementAt and sizeOf generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends NativeType>.elementAt()` and
`sizeOf<T extends NativeType>()` where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/178200 to
only deprecate but not error out on generic calls.

Does not roll forward `package:ffi` to a version with the `Allocator`
but keeps the generic `sizeOf` invocation. This causes extra warnings
in the pkg/front_end testcases.

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

TEST=tests/ffi/data_test.dart
TEST=tests/ffi/sizeof_test.dart
TEST=tests/ffi/structs_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I8f41c4dc04fc44e7e6c540ba87a3f41604130fe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180560
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Dmitry Stefantsov c1a401c5da [cfe] Implement weak mode constant canonicalization update
Closes #44641.
Closes #44246.

Bug: https://github.com/dart-lang/sdk/issues/44641
Bug: https://github.com/dart-lang/sdk/issues/44246
Change-Id: I78cb0514a57ab3adafb3639b09ea8930791da030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179340
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-22 12:06:49 +00:00
Jens Johansen 8dd585c5b4 [CFE] Initial 'semi-fuzz' option in strong tests
This CL introduces a 'semi-fuzz' option in the strong tests, that is
disabled by default.

The current version just compiles with the incremental compiler
and invalidate one file at a time, seing that we get the same
libaries in the output and that we either get errors in both cases
or no errors in both cases.

Future versions should for instance split libraries into more
libraries or parts etc., and the semiFuzz option should be enabled
by default.

Change-Id: I47f7d0f10798b0f2b19c9f2a02287f9431f67608
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180145
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-22 10:26:58 +00:00
Jens Johansen 6aee7d0eb8 [CFE] Reproduction of error on recomile even without change
This CL is a reproduction of a found bug, where upon recompile
- even with no change to the code - one suddenly gets an error
like this:

```
// org-dartlang-test:///main.dart:9:36: Error: The getter 'axis' isn't defined for the class 'Constraints'.
//  - 'Constraints' is from 'package:flutter/object.dart' ('org-dartlang-test:///flutter/object.dart').
// Try correcting the name to the name of an existing getter, or defining a getter or field named 'axis'.
//     print(renderObject.constraints.axis);
//                                    ^^^^
```

Run like
`out/ReleaseX64/dart --enable-asserts pkg/front_end/test/incremental_load_from_dill_suite.dart -DupdateExpectations=true -- incremental_load_from_dill/error_on_recompile_with_no_change`

Change-Id: I48b87ca3ce5b8301c4f8b6b7884ded7a328387d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180341
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-21 13:04:36 +00:00
Jens Johansen 6971cddaed [CFE] Fix crash with experimental invalidation and factory with same name as procedure
A factory is saved as a procedure in kernel, and was thus also indexed
as a procedure for the purpose of experimental invalidation.
This caused trouble when having a "real" procedure and a factory with
the same name.
That is fixed by this CL by indexing factories ad constructors.

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

Change-Id: Ieef0421c29a61e26f2a7ee4bb4f196672afd8445
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180148
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-20 13:56:05 +00:00
Johnni Winther fabf3efda4 [cfe] Refactor ClassHierarchyBuilder to use Tuple for computation
Change-Id: I8055552313786814bde6f66214a013a8bedb2078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177500
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-01-19 19:52:13 +00:00
Jens Johansen 989e42f189 [CFE] Incremental compiler and part as entry
This CL fixes the incremental compiler in the case where it gets a
part as an entry point.

Change-Id: I79f1735e0056f259500e2ef52d9b23047f2b812f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178999
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-15 15:23:18 +00:00
Johnni Winther 0fde98290e [cfe] Remove misleading comment from test
Change-Id: I97392718faf380d1431e76e808bbe775e25e3d4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177860
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-15 10:11:43 +00:00