| commit | 276aa297621943a867eba120de6b67baae5060a8 | [log] [tgz] |
|---|---|---|
| author | Nate Biggs <natebiggs@google.com> | Thu Feb 15 21:01:02 2024 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Feb 15 21:01:02 2024 +0000 |
| tree | 825182c5b26ba4f0d002bbbd9cb27a7d097cc51b | |
| parent | 6cfb95ce7cc95fa805a080f5608f3b9dbabc83af [diff] |
[dart2js] Clone call receiver for protobuf replacement placeholder. Adding a reference to node.receiver in the replacement placeholder was modifying its parent pointer eagerly. When running Dart2js with serialization the pointers were reset by the serialization process after the closed world phase. However, when running without serialization the pointer stayed corrupted and lead to a malfomed tree in later phases. This manifested as an error trying to lookup the location (i.e. the kernel Location) of the receiver. This fixes the issue by cloning the receiver of the call for the placeholder. This avoids updating the original receiver's parent pointer. Today the receiver is always a VariableGet referencing a variable defined in a surrounding Let scope (this is how the CFE encodes x..a()..b()). We could cast the receiver but to be a bit more resilient I've opted to clone the node. The cloner in the kernel package fails on free variable (i.e. if the variable is not declared in the cloning scope). But in this case we want to simply use the same declaration reference from the cloned node. I've added a cloner that provides that fallback behavior. I also considered using a closure to lazily create the replacement but closures are expensive and we'd be creating one per field per proto which would be a considerable cost for large programs. There wasn't really a clean way to do the same with a static tearoff. Change-Id: I7ef0e24a9457cfa9f2e116eb3569b0652d321c08 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352563 Commit-Queue: Nate Biggs <natebiggs@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com>
Dart is:
Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.
Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.