commit | 2f63acea22a2287f127518e0ee149467eeb2c222 | [log] [tgz] |
---|---|---|
author | Tess Strickland <sstrickl@google.com> | Tue Jul 11 10:15:58 2023 +0000 |
committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Tue Jul 11 10:15:58 2023 +0000 |
tree | 4ade4657d1d2eb8a05f823e64f09e38dabd3c678 | |
parent | a0392698bf748ac16cc374ba92c34383c9372b23 [diff] |
[vm] Attempt to avoid allocating non-Ptr fields with Object::null(). There have been multiple cases in the past where using Object::null() as the initializer, even for non-Ptr fields, has caused nondeterministic snapshot creation. In particular, this can happen if a non-Ptr field is only used in some versions of an object but not others, and thus there is no reason to worry about what the value of the field is during runtime. Only when snapshotting can it become relevant that the field value is a portion of the address of Object::null(), which can vary over different runs. Instead of initializing the entirety of allocated objects (outside of a few rare cases) with Object::null(), only initialize the portion of the object corresponding to object pointer fields (in most cases, between from() and to() inclusively) to Object::null() and initialize the rest of the object to 0. With this change, the only special casing in Object::InitializeObject that remains is to skip initialization for TypedData and Arrays when the memory is guaranteed to be zero initialized and to initialize the contents of Instructions objects with the break instruction, not 0. Note that this behavior does not occur in the following cases, which all involve copying an arbitrary object: * Object::Clone(), which zero-initializes the contents of the object in all cases. However, the contents of the original object are then copied over before the thread can reach a safepoint. * Inside the ObjectGraphCopier, which uses the old initialization behavior. This is safe, as any GC-important fields are immediately copied over, and the rest of the contents are eventually copied over before the caller receives the root of the copied object graph. TEST=ci Issue: https://github.com/dart-lang/sdk/issues/52876 Change-Id: Ib09fc562a8b6af97b509b493eb2d64109230ec35 Cq-Include-Trybots: luci.dart.try:vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312900 Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Tess Strickland <sstrickl@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.