Commit Graph

701 Commits

Author SHA1 Message Date
Daco Harkes 532c116cd2 [vm] Implement NativeFinalizer
This CL implements `NativeFinalizer` in the GC.

`FinalizerEntry`s are extended to track `external_size` and in which
`Heap::Space` the finalizable value is.

On attaching a native finalizer, the external size is added to the
relevant heap. When the finalizable value is promoted from new to old
space, the external size is promoted as well. And when a native
finalizer is run or is detached, the external size is removed from the
relevant heap again.

In contrast to Dart `Finalizer`s, `NativeFinalizer`s are run on isolate
shutdown.

When the `NativeFinalizer`s themselves are collected, the finalizers are
not run. Users should stick the native finalizer in a global variable to
ensure finalization. We will revisit this design when we add send and
exit support, because there is a design space to explore what to do in
that case. This current solution promises the least to users.

In this implementation native finalizers have a Dart entry to clean up
the entries from the `all_entries` field of the finalizer. We should
consider using another data structure that avoids the need for this Dart
entry. See the TODO left in the code.

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

TEST=runtime/tests/vm/dart(_2)/isolates/fast_object_copy_test.dart
TEST=runtime/vm/object_test.cc
TEST=tests/ffi(_2)/vmspecific_native_finalizer_*

Change-Id: I8f594c80c3c344ad83e1f2de10de028eb8456121
Cq-Include-Trybots: luci.dart.try:vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-ffi-android-debug-arm64c-try,dart-sdk-mac-arm64-try,vm-kernel-mac-release-arm64-try,pkg-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-win-debug-x64c-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-nnbd-win-release-ia32-try,vm-ffi-android-debug-arm-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,benchmark-linux-try,flutter-frontend-try,pkg-linux-debug-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-gcc-linux-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236320
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-03-26 09:41:21 +00:00
Konstantin Shcheglov cbcbf898cf Prepare to publish analyzer 3.4.1 and _fe_analyzer_shared 38.0.0
Bug: https://github.com/dart-lang/sdk/issues/48658
Change-Id: I1d3d531cf3550a657a1cdd9d7a29467e4c92df0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-24 17:44:29 +00:00
Chloe Stefantsova d291c5330f [cfe] Report errors in inherited restricted members in enums
Part of https://github.com/dart-lang/sdk/issues/47453

Change-Id: I5f80c3507a0264c4516d42967b148f4dc3fd08ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237684
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-03-24 17:17:39 +00:00
Chloe Stefantsova 050ffd6d70 [cfe] Report errors on restricted members in Enum implementers
Closes https://github.com/dart-lang/sdk/issues/48577

Part of https://github.com/dart-lang/sdk/issues/47453

Change-Id: I949052f153c2e7b1c818069149c75b977ca8ac95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237580
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-03-24 16:29:59 +00:00
Chloe Stefantsova 112f987fa3 [cfe] Report errors on super parameters not in a constructor
Part of https://github.com/dart-lang/sdk/issues/47525

Change-Id: I9ac7f5a49c09755445b6b407af5abf1037cba2e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237687
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-03-24 12:41:01 +00:00
Konstantin Shcheglov 26aa3273ea Prepare to publish analyzer 3.4.0 and _fe_analyzer_shared 37.0.0
Change-Id: Id361cfa1068d1c85eee46c6f581815716542d75b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-03-23 17:17:17 +00:00
Johnni Winther 988b8093e4 [cfe] Remove TypeBuilder as supertype of MixinApplicationBuilder
MixinApplicationBuilder was never a real TypeBuilder and just cluttered
the interface.

MixinApplicationBuilder.supertype is also removed and instead passed
separately.

Change-Id: Iac4e119aff39e27e6e589b5123da1d0cc0604dbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238081
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-23 09:02:15 +00:00
Jens Johansen 116706e74e [parser] Delete unused functions in scanner/characters.dart
Change-Id: Ia802cce1d032d5275dd78ca0fbd62498a6a41e19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238045
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-23 07:45:10 +00:00
Paul Berry b9ed13c76f Rework flow analysis API for operator == and identical.
In order to address https://github.com/dart-lang/language/issues/731
(improved inference for fold etc.) I'm going to need to sometimes
change the order in which the resolution process visits invocation
arguments.  As a preparatory step, this change reworks the flow
analysis API so that it doesn't depend on the order in which arguments
to `identical` are visited.

Bug: https://github.com/dart-lang/language/issues/731
Change-Id: Ic886bb44537523a1cab75762925e62d46e33f290
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237933
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-22 22:49:10 +00:00
Johnni Winther e50b7e77b8 [macro] Support fresh names in MacroExecutor.buildAugmentationLibrary
This adds support for generating truly unique fresh names when building
augmentation library code. The synthesized names are used for import
prefixes and as placeholders for not-yet-inferred omitted type
annotations.

Change-Id: I6fe9bc37b39a243c93187f561ee32e07237341f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237823
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-22 16:30:08 +00:00
Jake Macdonald ded8936d35 Add TypeInferrer interface, this is what macro authors will use to infer real types from OmittedTypeAnnotations.
Bug:https://github.com/dart-lang/language/issues/2154
Change-Id: I00484ddbd09a3c2371b96e540b9926144d80c832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237844
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-03-21 16:19:47 +00:00
Clement Skau 2c0ba56ea1 [vm/ffi] Add error for FFI annotation with opt. args.
Optional arguments (positional and named) in @FfiNative
annotations are not meaningful, and should result in a
compile-time error.

TEST=tests/ffi/ffi_native_test.dart
Bug: https://github.com/dart-lang/sdk/issues/47169
Change-Id: I8896e6a43f9399b537e6ee7c7a0e2857a370203f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232622
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2022-03-18 20:58:51 +00:00
Jake Macdonald 8d2c630052 add OmittedTypeAnnotation and support in code objects
Bug: https://github.com/dart-lang/language/issues/2154
Change-Id: Ie48d308a822798da22ea38954774e393f81e2e2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237740
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-03-18 14:30:07 +00:00
Jens Johansen fd4e41a7af [parser-ish] Better errors on invalid unicode escapes
https://github.com/dart-lang/sdk/issues/48542

Change-Id: Icbdcc939a93c737914091c00aaefa3c4efb2dde0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237364
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-17 13:57:45 +00:00
Chloe Stefantsova 5bd7d75b1e [cfe] Report errors on restricted instance members in enums
Part of https://github.com/dart-lang/sdk/issues/47453

Change-Id: I2fddd2ad5da82807fef7e9ed1d7a6781fde38600
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237365
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-03-16 13:47:44 +00:00
Paul Berry 41a330b8f4 Remove _functionNestingLevel from flow analysis logic.
Previously, this field existed as a sanity check to help ensure that
the client didn't accidentally call `functionExpression_end` more
often than `functionExpression_begin`.  However now that flow analysis
maintains an explicit stack of what constructs have been begun and not
ended, the check is redundant, because trying to pop from an empty
stack would cause a runtime failure anyway.

Change-Id: I4a56c66169a6de6b4c19d67800d8d0083e7bd59f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-03-15 19:16:42 +00:00
Johnni Winther e86a1140aa [cfe] Implement TypeDeclarationResolver
This implements TypeDeclarationResolver for the CFE. Adds a test to
the macro api test, which includes support for throwing and catching
the ArgumentError required by the api.

Change-Id: I5bb7948064ba5a2c215289915fc10314fd28aa1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237020
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-15 16:35:02 +00:00
Johnni Winther e7d708558f [cfe] Add test for member lookup in ClassIntrospector
This adds tests for `fieldsOf`, `methodsOf` and `constructorsOf` of
the `ClassIntrospector` interface in the macro api test.

Change-Id: I79ef7ce01d00cda2c8277342e4b7c17e91266b5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236884
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-15 15:17:59 +00:00
Johnni Winther 29fc2e7802 [cfe] Support ClassIntrospector.interfacesOf and ClassIntrospector.mixinsOf
This adds support for [interfacesOf] and [mixinsOf] of the
[ClassIntrospector] interface. To support this, the mixed in
[ClassHierarchyNode] is now included in the [ClassHierarchyNode] for
a mixin application.

Change-Id: I30cef4b462b1b2b52acf1bd286d82ebc1c5caa4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236883
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-15 12:42:20 +00:00
Jens Johansen 6969a6edd3 [parser] Don't leak a rewrite when swallowing an error
The old code tries to determine something by using a forwarding listener
without forwarding to anything. It leaked a rewrite though, meaning that
the rewrite stayed, but the error given when rewriting wasn't passed on.

When then parsing it with the real listener, the rewrite was in effect
and there was no error to report. In total no errors were reported.

This fixes the issue by undoing any rewrites in this situation.

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

Change-Id: I5342ae6969f00dea830fb7abb30f21932907b8bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236540
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-10 18:43:46 +00:00
Jens Johansen f40d76d360 [parser] Recover missing () for enum constant with type arguments or dot
Fixes https://github.com/dart-lang/sdk/issues/48380

Change-Id: I4f6fd7311c46ad45ccce5bf6b97b40932a457851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234360
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-09 12:40:35 +00:00
Konstantin Shcheglov 9dc81176ab [parser] Better recovery on empty named argument name
Fixes https://github.com/dart-lang/sdk/issues/48288

Change-Id: I831b4870ba7dc69436f68e1ef84e0cdf258073a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234289
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-03-09 09:55:44 +00:00
Srujan Gaddam f8933dda8d [pkg:js] Disallow all operators in JS classes
Closes https://github.com/dart-lang/sdk/issues/48515

Expands existing checks for index operations to all operators. This
only affects instance members and not extension members.

Change-Id: I8cbb5b12a49539ea502e4396e1b469ffb0e17d5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235980
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-03-09 01:48:24 +00:00
Johnni Winther 2c430537c6 add IdentifierResolver api, which allows you to get identifiers for a
given symbol in a given library

Change-Id: I665b3bd2fa6fe7bb64375873e9ae9343e7922a3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234904
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-03 16:51:50 +00:00
Johnni Winther 767103b1ec [cfe] Remove BuilderImpl as superclas of JumpTarget
This relation was never used/needed.

Change-Id: I3cc976a807278949072491f0969961ca303225b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235084
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-03-03 15:11:50 +00:00
Johnni Winther 345dfd34ac [cfe] Support class member augmentation directly
This adds direct support for class member augmentation, including checks
that the 'augment' modifier is used correctly. Different from the patch
member support, non-augment members added in augment classes are now
part of the interface of the class and can therefore be used outside
the augmentation library.

The CL includes support for using the 'import augment' syntax to import
libraries as augmentation libraries. The enable direct testing of the
augmentation features in expectation tests.

Change-Id: I9961e15862dba827050bec4aceb7dfc45e053d7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234520
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-28 15:07:18 +00:00
Johnni Winther fa05359f2f [cfe] Support augmentation library imports
This adds support for the `import augment <uri>` import syntax when
the 'macros' experiment is enabled.

The CL also include propagation of the augment modifier on class methods
which was missed in a previous CL.

Change-Id: Ic843e7e34559bcac728c810590f34b727b5f7090
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234401
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-28 11:42:34 +00:00
Jens Johansen 514f678199 [parser] Better recovery for extra stuff in enum and using enum as identifier
Fixes https://github.com/dart-lang/sdk/issues/48371

Change-Id: I93331485c884c89c179c2fa332f3f975db9507f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234043
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-02-25 09:35:25 +00:00
Johnni Winther c16d5f01bd [cfe] Use macro_api_test to test ClassIntrospector.superclassOf
Change-Id: I0d74773c27e1fce0d84243c507af7cb2d32a1aa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234160
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-25 07:25:44 +00:00
Konstantin Shcheglov 8bdd16be7a Prepare to publish analyzer 3.3.1 and _fe_analyzer_shared 36.0.0
Change-Id: I703c1de5d055fd0c53ac31f075ca2f2c4bfcbc95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234322
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-24 18:39:43 +00:00
Jake Macdonald fb5503960f Add a map of class name to augmentations in MacroExecutionResults to assist with merging.
There should now only be a single `augment class` declaration (per augmented class) in a given augmentation library.

Change-Id: I32a56baef63a0658df23b3c52e398597c09f8ba2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234106
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-24 17:31:21 +00:00
Johnni Winther e9ba1d0481 [cfe] Apply phase 3 macro results.
This add supports for applying the result of phase 3 macros, so that
function bodies generated by macros are now included in the generated
AST.

Change-Id: I2ae5d00846dbffdfcb06086d1d1741703fae9fc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234047
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-24 09:18:22 +00:00
Konstantin Shcheglov 91d10d3701 Prepare to publish analyzer 3.3.0 and _fe_analyzer_shared 35.0.0
Change-Id: I148044fd8e70789ced1a78c0881c5d78491adcad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234115
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-24 00:38:43 +00:00
Jens Johansen 468f939428 [parser] Better recovery for missing comma in initializer list.
Fixes https://github.com/dart-lang/sdk/issues/48411

Change-Id: I5212b15cf9f8749653dbced1c86d0e3e9c163d98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234041
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-02-23 18:12:32 +00:00
Johnni Winther cd41e43c48 [parser] Support 'augment' as a built-in identifier for augmentation libraries
This changes the way the 'augment' modifier is handled in the parser.
Instead of being special cased for class declarations, it is now a
built-in identifier recognized only when the scanner is configured to
support augmentation libraries.

The change supports the used of the 'augment' modifier on not only
class declarations but also mixin and member declarations, as needed
for supporting macros.

Change-Id: I2679d198dea360900cfc478fae9c1660702a8a02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233887
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-23 16:17:42 +00:00
Chloe Stefantsova c12238d3ac [cfe] Allow typed super parameters
Part of https://github.com/dart-lang/sdk/issues/47525

Closes https://github.com/dart-lang/sdk/issues/47741
Closes https://github.com/dart-lang/sdk/issues/48444
Closes https://github.com/dart-lang/sdk/issues/47951

Change-Id: If9aadd996414df5091fc667a7202aafa9a0213db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233889
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-23 13:10:33 +00:00
Chloe Stefantsova 53cdbfb5f7 [cfe] Preserve correct enum elements to avoid cascading errors
Part of https://github.com/dart-lang/sdk/issues/47453

Change-Id: Ic79a7667e5eb1b4cf27c1d1628312e4d8c052304
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233382
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-21 11:06:10 +00:00
Johnni Winther 931fd976c6 [cfe] Apply phase 2 macro results
Results of Phase 2 macros are now applied. The macro application code
has been refactored to support that Phase 1 can apply all macro
applications within a library in bulk, but Phase 2 can apply each
macro application in sequence.

The later is to prepare for making added member visible to subsequent
macro applications within Phase 2. This functionality has not been
completed yet.

Change-Id: Idaf2702e21bde75aedb1509d88e02f270196af5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233380
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-18 11:00:31 +00:00
Johnni Winther 2435848b13 [parser] Support 'augment' modifier on class declarations
This adds support for the 'augment' modifier on class declarations
needed for the static meta-programming prototype.

Change-Id: Iadd11f766a195076405f2803b2092199caf1ea8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-18 09:39:23 +00:00
Jake Macdonald 621ea99c80 Work around windows test failures
This directory sometimes fails to delete due to files being still "in use".

If we have a better fix than just ignoring it let me know, but its just a temp dir used in a test.

Change-Id: I5c8e76192230cf2b033d9bcb4a86940ddf974517
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233522
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-17 22:27:41 +00:00
Jake Macdonald 7822eb9107 Add a macro executor which spawns and talks to a different process.
This also:

- Adds support to the bootstrap code to handle communicating via sendPort or stdio
- Refactors pretty heavily the isolate executor code such that it can be reused.
- Refactors the isolated executor test into a shared test for all executors
- Removes the mirror based executor entirely - I don't see a path forward with this one.
- Reorganizes all executor based files under macros/executor

Change-Id: I2fc6bb3e6ce56c8b331719f4dc08617b3a521398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-17 20:40:21 +00:00
Chloe Stefantsova deba7fee1d [cfe] Report errors on implementors of 'Enum' declaring 'values'
Part of https://github.com/dart-lang/sdk/issues/47453

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

Change-Id: I87d57407e16916a78864b9ce74b9250afc39958f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233304
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-17 10:29:00 +00:00
Johnni Winther f24c4fa919 [cfe] Add initial support for applying the phase 1 macro results
This adds support for the generating a synthesized augmentation
library for each library in which phase 1 macros were applied.
Current implementation piggybacks on the patch library support. The
intension is that both patches and augmentations are handled through
the same general mechanism. For now, the wording refers to augmentation
libraries as patch libraries where the implementation is shared.

Testing is extended to verify that the generated classes are
included in the resulting AST.

Change-Id: Ie0d4cfdc84b55ca87e0014794f14b38e442f08eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233101
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-16 09:19:49 +00:00
Jake Macdonald e6654814cc Make the serialization mode easily configurable (and required), and some other improvements.
- Support TransferableTypedData in the bootstrap code and IsolatedExecutor.
- Also removed the fake executor and conditional import. Mode will likely be chosen based on factors other than just the availability of `dart:isolate`.
- Run the tests in both serialization modes.

Change-Id: I5c731d192c0d3a8cdc5f7fb900dc07a32f4f4d51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-15 16:16:20 +00:00
Chloe Stefantsova 6c8ad6a723 [cfe] Report errors on declared 'values' member in enums
Part of https://github.com/dart-lang/sdk/issues/47453

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

Change-Id: I8313e3f63122c85c91a9647ddaa53346591d7238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232841
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-15 12:22:19 +00:00
Jake Macdonald 97176be3d4 add the local identifier type for parameters, add isStatic field to class members
Change-Id: I15d85fdc4a6b894e6ecda6716f9931e03a8278ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232961
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-15 11:49:50 +00:00
Alexander Thomas 30beab0f43 [infra] Add OWNERS to the Dart SDK
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.

For additional background information see go/dart-sdk-owners.

TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-02-14 14:06:34 +00:00
Johnni Winther 74a355c544 [cfe] Use buildAugmentationLibrary on phase 1 results
This CL add support for identifier resolution to use the
MacroExecutor.buildAugmentationLibrary for generating the code.

The CL updates the ResolvedIdentifier to have a nullable [uri] in
order to support built in identifiers, such as `void`.

Change-Id: I9436ea77c06cf5618f1977f4c9ac0490ff059587
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232623
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-14 11:31:25 +00:00
Jake Macdonald 49d7f5056f Add a byteData serializer/deserializer implementation
With the optimizations suggested this does now equal or outperform the JSON serializer in all scenarios, the latest numbers from the benchmark are as follows:

Isolate.spawn + SerializationMode.jsonClient: 0:00:00.041666
Isolate.spawnUri + SerializationMode.jsonClient: 0:00:00.069551
Separate process + SerializationMode.jsonClient: 0:00:00.177171
Isolate.spawn + SerializationMode.byteDataClient: 0:00:00.040990
Isolate.spawnUri + SerializationMode.byteDataClient: 0:00:00.059319
Separate process + SerializationMode.byteDataClient: 0:00:00.080008

Change-Id: If5431513c7487d8b7af350381e794cbd61c1be42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232027
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-11 23:35:27 +00:00
Johnni Winther 1a0e9f941d [cfe] Add macro api test
This adds an initial test for implementation of the macro api that
can be shared between implementations.

The test consists of a set of macros and a library of declarations that
apply these macros. When applied the macros work as unittest tests that
check that the macro api give the expected results for the various
declarations.

Change-Id: Id4183e8ac90fa96ef1ebc01b1c9f15cc413b6443
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232383
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-10 16:08:00 +00:00