Commit Graph

16 Commits

Author SHA1 Message Date
Paul Berry 0fcd1a6fa1 Bump _fe_analyzer_shared to SDK 3.7 and reformat
Change-Id: I70157caf90c0955c2eb8426f5721ba4ed527eb76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427900
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-05-10 15:32:50 -07:00
Konstantin Shcheglov 36c0788137 add package:_macros (SDK vendored) and package:macros (pub published)
add sdk_packages.yaml file (describes SDK vendored package locations)

delete old macro code in _fe_analyzer_shared, move tests/benchmarks

adds a top level `pkg` directory to the Dart SDK, which is where vendored packages live

BUG: https://github.com/dart-lang/sdk/issues/54976
Change-Id: Ib3503a27fb5644fa8a39ab5a3e5b568df330cfd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359040
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2024-03-26 18:40:00 +00:00
Jake Macdonald d1ecf01f71 Cache remote objects by ID, only send IDs for already sent objects
This is done through a synchronized cache between the server and client. When serializing a remote instance, if the server has already serialized that object then it will only send the ID in the future.

These caches currently only live as long as a single macro application in a given phase, but could live longer in the future. They do need to get reliably cleared out to avoid memory leaks though, and the shorter lifetime is easier to manage consistently.

This also allowed me to remove the specialized server/client modes (clients would always only send back IDs previously).

Change-Id: I4e8a102403153829d66b0ac379636f5a95a70cea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311420
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-06-26 22:36:37 +00:00
Jake Macdonald 922f611d7f Use a BytesBuilder to group length and message, enable tcpNoDelay.
This makes the socket benchmark (and real world code also), about 100x faster.

Change-Id: Iaa130b7bf69e4c89d3c3a221680e5b62ffe10583
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296641
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-04-20 23:35:51 +00:00
Jake Macdonald b55b46bcd6 update the serialization bbenchmark to capture the difference between sockets and stdin, and use message grouper
Change-Id: I5736ba0f9687e9dce4e1bf4ad27dd0cb9d9b75ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296100
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-04-18 23:30:39 +00:00
Johnni Winther 9d557edcd8 [_fe_analyzer_shared] Rename fields to properties
Change-Id: I2458867b6dbc770335f12f3d52a0eb4fb67516be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292721
Reviewed-by: Paul Berry <paulberry@google.com>
2023-04-03 12:16:43 +00:00
Johnni Winther a7205526c4 [_fe_analyzer_shared] Add benchmark for exponential exhaustiveness
The tests in the benchmark show some pitfalls of the exhaustiveness
checking algorithm where the witness canodidate count is exponential
in the size of the user code.

Change-Id: I310c42513bf76c88fed7ffdb5a60c165c089dfa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291800
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-29 21:48:23 +00:00
Johnni Winther 2d1f2abe0b [_fe_analyzer_shared] Add support for Object members on non-interface types
Change-Id: I0fb6cba760e6f0b2023a829b8e518e50b41451d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-15 17:33:38 +00:00
Johnni Winther 9698e72c8f [_fe_analyzer_shared] Split exhaustiveness implementation into smaller files
Change-Id: I08e098b978480fe72a3273ac3331bef9745a0bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287761
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-03-14 18:30:43 +00:00
Johnni Winther 12ea77b96e [_fe_analyzer_shared] Remove old Space model
This remove the [Space] class from the old algorithm and instead
encodes the patterns into the new model. The [Pattern] and
[Patterns] classes of the new model have been renamed to
[SingleSpace] and [Space], respectively, and a [Path] class is
added to track the path property used in the model of the new
algorithm.

Change-Id: I0c86c738807030be2f9b59f3aefb5bfcf5bbaeee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-06 16:57:16 +00:00
Johnni Winther 84a0424afd [_fe_analyzer_shared] Remove old exhaustiveness checking algorithm
This removes the old algorithm for exhaustiveness checking and
ports the relevant tests to use the new algorithm.

Change-Id: I7aee3c991e2735299ab4ddc743848b4845fb9250
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284882
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-23 15:21:24 +00:00
Johnni Winther 6c8faaca03 [_fe_analyzer_shared] Add TestEnvironment for exhaustiveness testing
This replaces the StaticTypeImpl with an implementation of the shared
exhaustiveness classes for a test type system.

This will ensure that the unittests test the shared part of the code
and make it easier to handle for instance fields on Object and
non-interface types.

Change-Id: I101cdd41cf86b2847bd5959c15d4138640e34679
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282882
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-02-14 21:04:41 +00:00
Johnni Winther cc35b9bcda [patterns] Handle nullability in StaticType for top/nullType
This updates the exhaustiveness implementation to have specific static
built-in types for nullableObject (the top) and its underlying nonNullableObject,
nullType and its underlying neverType. In the previous encoding, the top
wasn't nullable (if you queried the isNullable property) but was still
assumed to contain `Null` in other parts of the code.

With this change, the top space is now an ExtractSpace based on
StaticType.nullableObject, the empty space is an ExtractSpace based on
StaticType.neverType and record spaces are based on
StaticType.nonNullableObject.

The StaticType is now split into a StaticType interface and a
StaticTypeImpl implementation class for the non-built-in types. This
prepares for integrating the exhaustiveness checking with the analyzer
and CFE where the properties of the sub/supertype relation and fields of
the StaticType needs to be computed lazily.

Change-Id: I5a6919d7cba356f9bc8ac3f69fd3ac2b41319e9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274020
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-14 09:21:27 +00:00
Paul Berry d9152974ed Import exhaustiveness checker prototype into _fe_analyzer_shared.
This was developed by rynstrom@google.com as part of the patterns
feature proposal.  Moving it into _fe_analyzer_shared will allow us to
evolve it into the final implementation.

Change-Id: I31bd88fd21e1de60205363c7e6f4c405b8e6c2ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244761
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2022-05-17 17:46:39 +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
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