|author||Vyacheslav Egorov <firstname.lastname@example.org>||Sun Mar 06 15:29:22 2022 +0000|
|committer||Commit Bot <email@example.com>||Sun Mar 06 15:29:22 2022 +0000|
[vm/compiler] Fix unwinding issues We used to emit an unwinding rule for caller's SP, however this does not really work as we expected it to work. Instead there is an unwritten rule that caller's SP is equal to the CFA which overwrites our unwinding rule (at least in libunwindstack library used by Android). This leads to unwinding issues on the boundary between C++ and Dart: when we unwind through the InvokeDartCode stub frame we arrive to C++ code with SP equal to callee's CFA, which is set to FP by our unwinding rules. In this case if C++ code does not use FP based frames we will fail to unwind C++ frame property - because SP will be incorrect. This manifest in simpleperf profiles as stacks which abruptly truncate at DartEntry::InvokeCode. This CL rewrites unwinding rules to fix this: instead of using FP as CFA we define CFA to be caller's SP (FP+2*kWordSize). This ensures that unwinding on the boundary between C++ and Dart works correctly: as CFA will always be consistently set to caller's SP. Additionally this CL fixes InvokeDartCode stub to remove a value that this stub pushes above saved return address in PRODUCT mode. This value acts as a profiler marker used by builtin profiler which is only included in non-PRODUCT builds - but the presence of this value interfers with unwinding (caller's SP will be off by 1 due the presence of this value). We could produce custom unwinding information for this stub instead, but just removing this value in PRODUCT builds should solve the problem as we usually only profile Flutter release builds with simpleperf. Fixes b/220804295 TEST=manually profiled a Flutter app and confirmed correct flamegraph. Change-Id: I2094afaab6e54e89625c0b5a89aebc6b9823d67c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235226 Reviewed-by: Martin Kustermann <firstname.lastname@example.org> Commit-Queue: Slava Egorov <email@example.com>
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.
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.