mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
2c0484c720
* Add an `targetOS` argument to `pkg/vm`'s `compileToKernel`, that contains the target operating system's name. * Add a new `--target-os` command line argument for all binaries that use `compileToKernel` for clients to provide the target operating system, if known. * Add a new`"vm:platform:const"` annotation to certain field and getters in the Platform class. This annotation is used to annotate static getters and fields with initializers where the getter body or field initializer must evaluate to a constant value if the target operating system is known. This annotation may be used outside the Platform class and in user code. For example, this annotation can be used on a static `String` field that is initialized with one value if `Platform.isWindows` is true and to a different value if `Platform.isWindows` is false. Note: If the const functions experimental flag is disabled, then any annotated static methods can only contain a single expression whose value is returned. If it is enabled, then the static method is evaluated as if it is a const function with the special handling of annotated static fields and getters above. * Create a VM constant evaluator that evaluates uses of static getters and fields marked with the above annotations when a target operating system is provided. * Use the new VM constant evaluator in the unreachable code elimination transformer. TEST=pkg/vm/test/transformations/platform_use_transformer pkg/vm/test/transformations/unreachable_code_elimination Change-Id: Ie381de70486a767fd7b1d515fd9e6bb58c6bf090 Bug: https://github.com/dart-lang/sdk/issues/31969 Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try CoreLibraryReviewExempt: Just adding vm-specific annotations. Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274386 Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> |
||
---|---|---|
.. | ||
dart2native.dart | ||
dart2native_macho.dart | ||
dart2native_pe.dart | ||
generate.dart | ||
macho.dart | ||
macho_utils.dart |