| commit | ac2533e7059a9a6c7be16d4321ef7867caeb1b95 | [log] [tgz] |
|---|---|---|
| author | Tess Strickland <sstrickl@google.com> | Wed Jul 05 14:24:56 2023 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Jul 05 14:24:56 2023 +0000 |
| tree | 3581fcdfdef231a4da2634e7cd843bd3223d57f3 | |
| parent | 6a4ef6c93fca0870e914760c9e50d84fc75820c0 [diff] |
[pkg/vm] Instantiate the ffi Pointer class to bounds when needed. Previously, the FFI transformer could produce is checks where the type to check against was Pointer<dynamic>. However, given that the Pointer class is defined as: abstract class Pointer<X extends NativeType> ... the instantiated to bounds version of its type is Pointer<NativeType>. Pointer<dynamic> is not a subtype of Pointer<NativeType>, and thus is an invalid instantiation, but the only place this type could occur was as the right hand side of an is check. Before 7cc005ea1, Class::RareType() returned the class instantiated with the null (all-dynamic) type arguments vector. Among other things, this "rare" type was compared to the right-hand side of is checks and, if it matched, performed a simple (cid-only) check of the instance type arguments in unoptimized code. Afterwards, Class::RareType() returns the class instantiated with a type arguments vector where each type parameter is instantiated to bounds, so now the "rare" type check fails and it falls back to the full check of the instance type arguments, which causes a ~25% regression in some unoptimized benchmarks. This CL fixes the generation of those is checks in the FFI transformer to use the instantiated to bounds version of the Pointer type instead. TEST=pkg/front_end/test Issue: https://github.com/dart-lang/sdk/issues/52843 Issue: https://github.com/dart-lang/sdk/issues/52848 Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-riscv64-try,vm-ffi-qemu-linux-release-arm-try,vm-aot-linux-debug-x64-try,vm-linux-debug-x64-try Change-Id: Ic9ac6d75ba2743e233065444fad13ab098094349 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312400 Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Erik Ernst <eernst@google.com> Auto-Submit: Tess Strickland <sstrickl@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.