| commit | 5a4b252252f6955dd1b418ad85d48af251da6ce9 | [log] [tgz] |
|---|---|---|
| author | Jess Lally <jessicalally@google.com> | Thu Sep 07 09:52:57 2023 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Sep 07 09:52:57 2023 +0000 |
| tree | abadc60e08b0aa314e38deacd89d999fcf85d725 | |
| parent | 2bbf99351e0274643b8ab0c14904efbb650ded8b [diff] |
[dart2wasm] Replace `struct.new_default` with `struct.new` for object allocation. When using the `struct.new_default` instruction for object allocation, fields are always nullable and mutable. By using the `struct.new` instruction instead, class fields can now have the same mutability and nullability in Wasm as declared in Dart. In addition, the class ID and type parameters (which are also stored in an object's struct), can now be immutable and nonnullable as well. To do this, object construction is now split into three functions: (1) Initializer: evaluates initializers for instance fields and constructor initializers (this constructor before super constructor). (2) Constructor body: executes the constructor body (super constructor before this constructor), with `this` pointed to the constructed object. (3) Constructor allocator: which calls (1), allocates the object using `struct.new`, then calls (2). Because fields now have the correct mutability and nullability in Wasm, this removes unnecessary null checks for nonnullable fields, and may allow for better optimisations by Binaryen. Fixes https://github.com/dart-lang/sdk/issues/51492 Change-Id: Ib26046686f772a70509a870301217e9b1c91b77e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315820 Commit-Queue: Jess Lally <jessicalally@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>
Dart is:
Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.
Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.
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.