c84edaefe9e457e9cc975c050019479b2d94dea2
1205 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5bff7fa6a3 |
[vm/aot] Keep import graph connected when tree-shaking libraries
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_54324.dart Fixes https://github.com/dart-lang/sdk/issues/54324 Change-Id: Ifefb490dfd5f4fea7b94d1841385a9761f258ba8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341783 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> |
||
|
|
dcdfcc2b8d |
Reland "[vm/ffi] Express FFI call closures explicitly in AST"
This reverts commit |
||
|
|
150e61a662 |
[vm/ffi] Support @Native fields
Allow annotating top-level or static fields with `@Native` to create fields backed by native memory. By using the `_addressOf` operator implemented in the VM, these fields can be implemented in the CFE by replacing them with accessors looking up the pointer and then using existing methods to load and store the value. Closes https://github.com/dart-lang/sdk/issues/50551 TEST=tests/ffi/native_assets/asset_*_test.dart TEST=pkg/analyzer/test/src/diagnostics/ffi_native_test.dart CoreLibraryReviewExempt: VM & dart2wasm only feature Change-Id: I61dccc88076723d6a6ba02d7fd848b18e4caf780 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338020 Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> |
||
|
|
efb60eac59 |
[ffi]: Add extension operator methods(+,-) for pointer arithmetic
Closes [#54250](https://github.com/dart-lang/sdk/issues/54250). TEST=test/ffi Change-Id: I2299e019b6c0b0db74662e4f9439feac46bc9b40 CoreLibraryReviewExempt: FFI only Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341420 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com> Auto-Submit: Shikhar <shikharish05@gmail.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> |
||
|
|
1800039c2a |
Revert "[vm/ffi] Express FFI call closures explicitly in AST"
This reverts commit |
||
|
|
fd2e9b9f1a |
[vm/ffi] Express FFI call closures explicitly in AST
Instead of implicitly creating closures for FFI
asFunction/lookupFunction APIs in the VM, now they are explicitly expressed in the kernel AST. That makes it possible to analyze
them in TFA.
FFI calls from Dart code into native are now performed in the following way:
```
block {
Pointer #ffiTarget0 = target;
@pragma('vm:ffi:call-closure', _FfiCall<Int32 Function(Int32)>(isLeaf: false))
#ffiClosure0(int arg1) {
_nativeEffect(arg1);
return _ffiCall<int>(#ffiTarget0);
}
} =>#ffiClosure0;
```
_ffiCall method is recognized by the VM and its call is replaced
directly with FFI calling sequence. _ffiCall uses closure
parameters implicitly. No extra trampolines are generated for FFI calls.
TEST=existing
Fixes https://github.com/dart-lang/sdk/issues/54172
Issue https://github.com/dart-lang/sdk/issues/39692
CoreLibraryReviewExempt: Implementation change only.
Change-Id: I92b3ff7391470686151ad0807e2cdbbf1a69d256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339662
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
|
||
|
|
40094c8cfd |
[vm/ffi] Unwrap typed data in FFI calls
Enables passing inner pointers to typed data in FFI leaf calls. This works for typed data's in the Dart heap, external typed datas (constructed from `Pointer.asTypedList`), and typed data views. Notable implementation details: 1. The Dart signature is used in the Marshaller now. This means it needs to keep track of whether there's a pointer argument in the signature (`asFunction`) or not (`@Native`). 2. Unwrapping is done in `FfiCallInstr::EmitNativeCode` before moving the arguments to their native location. This ensures we can use the assembler logic to load the `TypedDataBase::data` field. 3. The `XXXList` user visible classes don't have predefined cids. So the implementation uses symbols for comparison. 4. The type checking logic takes `isLeaf` as input to reject typed data. This leads to an error message about the type not accepted. Alternatively, we could consider adding an error message that specifically says the function should be leaf. 5. To cover all calling convention variants, tests are generated with up to 20 arguments. TEST=pkg/analyzer/test/src/diagnostics/ffi_unwrap_typed_data_test.dart TEST=tests/ffi/unwrap_typeddata_generated_native_test.dart TEST=tests/ffi/unwrap_typeddata_generated_test.dart TEST=tests/ffi/vmspecific_static_checks_typeddata_test.dart Closes: https://github.com/dart-lang/sdk/issues/44589 Change-Id: Ia78f18bf3238d42ac6882929b441f6dc432fcefe Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338620 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> |
||
|
|
a44a524bb0 |
[vm/ffi]: Add Native.addressOf
This adds the `Native.addressOf` function, which takes a constant tear- off of a method annotated with `@Native` as a parameter and returns a pointer to the underlying C function. The CFE will resolve these calls in two steps: First, the existing transformer for `@Native` methods adds a pragma describing the fully- resolved native annotation (with the asset id inferred from the library if not given explicitly). Then, the FFI use sites transformer rewrites calls to `Native.addressOf` by searching for this pragma on the passed function and passing the `Native` constants to `Native._addressOf`. The latter method is implemented in the VM, which can re-use existing parts already used for `@Native` calls. An alternative implementation strategy would have been to forward `addressOf` calls to `Native.ffi_resolver_function` directly without any special consideration in the VM. However, the chosen approach makes it easier to support static linking in the future, as this requires unresolved symbols in the generated assembly. Closes https://github.com/dart-lang/sdk/issues/50552 TEST=pkg/vm/testcases/transformations/ffi/ffinative.dart TEST=tests/ffi/native_assets/asset_*_test.dart TEST=tests/ffi/vmspecific_static_checks_ffinative_test.dart TEST=pkg/analyzer/test/src/diagnostics/ffi_native_test.dart Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-kernel-precomp-linux-release-x64-try CoreLibraryReviewExempt: VM & dart2wasm only feature Change-Id: Ic8e3a390146dffd44c95578f975a4472db79a0ee Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333920 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> |
||
|
|
0310e41f2c |
[vm/ffi] Verify NativeFunctionPointer.asFunction type arguments
Protect VM compiler code from crashing when incorrect type arguments are passed to FFI _asFunctionInternal. Also, improve front-end FFI checks to reject Function as a Dart type corresponding to a NativeFunction<...> (it should be an actual function type). TEST=tests/ffi/vmspecific_static_checks_test.dart Fixes https://github.com/dart-lang/sdk/issues/52730 Change-Id: I02c012bb76d5c94f551da2c725a476b68c0f9db4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339109 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> |
||
|
|
a805417983 |
[vm/aot/tfa] Fix tracking of unchecked call sites after they became polymorphic
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_54163.dart Fixes https://github.com/dart-lang/sdk/issues/54163 Change-Id: Ie463a2ce4a85944063e5dfd049715904145403b2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338480 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> |
||
|
|
47357d8535 |
Reland "[vm/ffi] Optimize @Native calls"
Original change in patchset 1.
The reland contains a fix for handles. The objects passed in handles
must live on the stack (or in the heap) so that that memory location
can be used as a handle.
This CL introduces a new allocation policy `RequiresRegister` which
forces constants to be spilled to the stack during register
allocation.
Note: Parameters to FfiCall instructions are currently not used in a
way that can make the parameters assigned to registers. So only
constants are treated currently. If we have a way to reproduce params
being assigned to registers, then we can force spilling for
non-consts as well in the register allocator.
Original change's description:
> [vm/ffi] Optimize `@Native` calls
>
> This CL removes static fields for storing the `@Native`'s function
> addresses. Instead, the function addresses are stored in the object
> pool for all archs except for ia32. ia32 has no AOT and no AppJit
> snapshots, so the addresses are directly embedded in the code.
>
> This CL removes the closure wrapping for `@Native`s. Instead of
> `pointer.asFunctionInternal()()` where `asFunction` returns a closure
> which contains the trampoline, the function is compiled to a body
> which contains the trampoline `Native()`. This is possible for
> `@Native`s because the dylib and symbol names are known statically.
>
> Doing the compilation in kernel_to_il instead of a CFE transform
> enables supporting static linking later. (The alternative would have
> been to transform in the cfe to a `@pragma('vm:cachable-idempotent')`
> instead of constructing the IL in kernel_to_il.
>
> To enable running resolution in ia32 in kernel_to_il.cc, the
> resolution function has been made available via
> `runtime/lib/ffi_dynamic_library.h`.
>
> Because the new calls are simply static calls, the TFA can figure
> out const arguments flowing to these calls. This leads to constant
> locations in the parameters to FfiCalls. So, this CL also introduces
> logic to move constants into `NativeLocation`s.
TEST=tests/ffi/vmspecific_ffi_native_handles_test.dart
TEST=tests/ffi/function_*_native_(leaf_)test.dart
TEST=pkg/vm/testcases/transformations/ffi/ffinative_compound_return.dart
Closes: https://github.com/dart-lang/sdk/issues/47625
CoreLibraryReviewExempt: Internal FFI implementation changes
Change-Id: Ia1401b335524dcbf50c663a8770d9a02802923df
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333841
Reviewed-by: Slava Egorov <vegorov@google.com>
|
||
|
|
4bedb142d3 |
Reland "[pkg/vm] Handle switch statements in unreachable code eliminator."
This is a reland of commit |
||
|
|
a3568286ff |
Adding the resource-identifier functionality from the compiler to the
vm. This identifies all calls to static methods annotated with `@ResourceIdentifier`, collects the constant arguments passed to the method, and writes the results into a file. The purpose of this feature is to be able to pass the recorded information to packages in a post-compilation step, allowing them to remove or modify assets based on the actual usage in the code prior to bundling in the final application. Tested: pkg/vm/test/transformations/resource_identifier_test.dart Change-Id: I58cb313b66ee23c1d154dcc242547723a1ced359 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329961 Commit-Queue: Moritz Sümmermann <mosum@google.com> Reviewed-by: Nate Bosch <nbosch@google.com> |
||
|
|
d84c16318c |
[vm/aot/tfa] Approximate interface calls more eagerly
When there is a large number of combinations of argument types, TFA can approximate interface call by dropping actual argument types. This is needed to cap/reduce AOT compilation time in certain edge cases involving auto-generated code, such as package:built_value serialization/deserialization. This change reduces the cap on number of analyzed invocations per selector from 5000 to 1000, in order to avoid 40+ min compilation seen in the wild. The effect of this change on code size and performance is negligible. Issue: https://github.com/flutter/flutter/issues/136529 Change-Id: Ie404f044ef4126fc608b4a0918680504226feaca TEST=ci Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337260 Commit-Queue: Martin Kustermann <kustermann@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Auto-Submit: Alexander Markov <alexmarkov@google.com> |
||
|
|
df4ef72c01 |
[vm/ffi] Remove deprecated FfiNative
TEST=pkg/analyzer/test/ TEST=CI build with class removed from `dart:ffi` Closes: https://github.com/dart-lang/sdk/issues/53923 CoreLibraryReviewExempt: VM & dart2wasm only. Change-Id: I45a39b623754f9f1b65cac55ea9adae390199f5d Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm64c-try,analyzer-analysis-server-linux-try,analyzer-mac-release-try,dart-sdk-linux-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336960 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> |
||
|
|
92e61ea4b7 |
Revert "Reland "[pkg/vm] Handle switch statements in unreachable code eliminator.""
This reverts commit |
||
|
|
262311772b |
Reland "[pkg/vm] Handle switch statements in unreachable code eliminator."
This is a reland of commit
|
||
|
|
31196e1ae0 |
[vm/aot/tfa] Streamline subtype checks
Remove Class -> TFClass lookups when doing subtype checks in TFA and implement subtype checks directly on TFClass instances. TEST=ci Change-Id: Ib992e134ed6a51c125474608b41a1b83e28e33f7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334141 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> |
||
|
|
08e15d7495 |
Revert "[pkg/vm] Handle switch statements in unreachable code eliminator."
This reverts commit
|
||
|
|
b15e1bf19d |
[vm] Rename nullSafety to soundNullSafety in pkg/vm
Also: * Clean up obsolete code for returning null safety from kernel service. * Enable sound null safety in TFA unit tests. TEST=ci Change-Id: I1e008ed661823e9cb8004670d6b66bef35089a19 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334081 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> |
||
|
|
92bf76d9e8 |
[pkg/vm] Handle switch statements in unreachable code eliminator.
Namely, if the tested expression for a switch statement is constant,
then we can remove any constant cases where the constants differ,
and if all but a single case is removed, we can replace the switch
with the case body.
If constant functions are not enabled, then getters annotated with
@pragma("vm:platform-const") are still evaluated with the constant
function evaluation machinery, but only those and no others (including
any functions called within an annotated getter). This way, functions
can be annotated with @pragma("vm:platform-const") without having to
rewrite them to be a single returned expression.
TEST=pkg/vm/test/transformations/unreachable_code_elimination
pkg/vm/test/transformations/vm_constant_evaluator
Issue: https://github.com/dart-lang/sdk/issues/50473
Issue: https://github.com/dart-lang/sdk/issues/31969
Change-Id: Ie290d2f1f469326238d66c3d9631f8e696685ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332760
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
|
||
|
|
e7c8363900 |
[dart2wasm/tfa] Improve inference for binary int operations
Because of the special language rules (int +/-/* int = int), static type for binary int operations can be more precise than inferred result type (in case of dart2wasm, int binary operations are declared as external methods returning num). So, for dart2wasm it is useful to narrow result of a call by its static type, if it is different from return type of the call target. Also, this change fixes an incorrect static type which is created during dart2wasm async* transformation. TEST=pkg/vm/testcases/transformations/type_flow/transformer/int_operations_dart2wasm.dart Fixes https://github.com/dart-lang/sdk/issues/53921 Change-Id: Id6a5a2cffac47918c4e92f996267bf7fae713416 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333580 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Ömer Ağacan <omersa@google.com> |
||
|
|
96921245f9 |
Revert "[vm/ffi] Optimize @Native calls"
This reverts commit
|
||
|
|
e16bb210d2 |
[vm/ffi] Optimize @Native calls
This CL removes static fields for storing the `@Native`'s function
addresses. Instead, the function addresses are stored in the object
pool for all archs except for ia32. ia32 has no AOT and no AppJit
snapshots, so the addresses are directly embedded in the code.
This CL removes the closure wrapping for `@Native`s. Instead of
`pointer.asFunctionInternal()()` where `asFunction` returns a closure
which contains the trampoline, the function is compiled to a body
which contains the trampoline `Native()`. This is possible for
`@Native`s because the dylib and symbol names are known statically.
Doing the compilation in kernel_to_il instead of a CFE transform
enables supporting static linking later. (The alternative would have
been to transform in the cfe to a `@pragma('vm:cachable-idempotent')`
instead of constructing the IL in kernel_to_il.
To enable running resolution in ia32 in kernel_to_il.cc, the
resolution function has been made available via
`runtime/lib/ffi_dynamic_library.h`.
Because the new calls are simply static calls, the TFA can figure
out const arguments flowing to these calls. This leads to constant
locations in the parameters to FfiCalls. So, this CL also introduces
logic to move constants into `NativeLocation`s.
TEST=runtime/vm/compiler/backend/il_test.cc
TEST=tests/ffi/function_*_native_(leaf_)test.dart
TEST=pkg/vm/testcases/transformations/ffi/ffinative_compound_return.dart
Closes: https://github.com/dart-lang/sdk/issues/47625
Closes: https://github.com/dart-lang/sdk/issues/51618
Change-Id: Ic5d017005dedcedea40c455c4d24dbe774f91603
CoreLibraryReviewExempt: Internal FFI implementation changes
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284300
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
|
||
|
|
12c4e22a4d |
[cfe] Handle various cases ExtensionType
Handles ExtensionType in inference of MapLiteral, inference of ObjectPattern, and exhaustiveness. TEST=tests/extension_type/* Change-Id: I3284da2c69d875e192cf3f004ee1156e1aedd98b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333160 Reviewed-by: Ömer Ağacan <omersa@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> |
||
|
|
f54ecbdf31 |
[vm,dart2wasm] Fix tree shaking of extension types used only in type literals
TEST=pkg/vm/testcases/transformations/type_flow/transformer/extension_type.dart TEST=co19/LanguageFeatures/Extension-types/superinterfaces_of_extension_type_A08_t02 Fixes https://github.com/dart-lang/sdk/issues/53812 Issue: https://github.com/dart-lang/sdk/issues/49737 Change-Id: I80237a1240905a52805f5b3e7bd857ed96773609 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332450 Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> |
||
|
|
f5983e4214 |
[ffi] Update some FfiNative docs to Native
The old FfiNatives have been deprecated for a while. TEST=Only comments updated. Change-Id: Ideb6e904841e5162d30df479e83b463b94682afe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332780 Auto-Submit: Daco Harkes <dacoharkes@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> Commit-Queue: Daco Harkes <dacoharkes@google.com> |
||
|
|
ac32223cea |
[vm/compiler] Improve CreateArray compile type
If we have constant type arguments include them into the type. This CL also expands IL tests framework with the capability to match CompileTypes. TEST=vm/dart/regress_53817_il_test Bug: https://github.com/dart-lang/sdk/issues/53817 Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-release-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-obfuscate-linux-release-x64-try Change-Id: I48722b002d9cd436dbc8ca3c9afbefa124f18996 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331900 Commit-Queue: Slava Egorov <vegorov@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com> |
||
|
|
a97f85ef0e |
[tfa] Make kPrintStats runtime configurable
Currently we have to ask users to run TFA from source (which requires a lot of dances with figuring out command line and checking out Dart SDK). However statistics printing does not impose any runtime overhead (as opposed for example to kPrintTimings which tracks timings) so it can be runtime configurable. Inspired by https://github.com/flutter/flutter/issues/136529 TEST=tested manually Change-Id: Ie496d6babb1e8cbbbb9a665b14656ea334a2eeed Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331881 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Slava Egorov <vegorov@google.com> |
||
|
|
e06536af2e |
[cfe] Create combined member signature stub
This create a stub for combined member signatures from multiple inherited non-extension type members and adds these to the extension type declaration. A sealed [TypeDeclaration] superclass is added to [Class] and [ExtensionTypeDeclaration] to support accessing the enclosing type declaration from a [Member]. TEST=existing Change-Id: Ic01535d27a14187d37b00868e7e90fe73558b051 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331181 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> |
||
|
|
d252bb11a3 |
[cfe] Add representation field to ExtensionTypeDeclaration
This adds the representation field of an extension type declaration as an abstract getter in the ExtensionTypeDeclaraiton marking it as a ProcedureStubKind.RepresentationField These are never used as interface targets and are therefore skipped in the type flow analysis. TEST=existing Change-Id: Ie645e63e0995a31895e985a2025dccb1476d16bf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330782 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ömer Ağacan <omersa@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> |
||
|
|
f303110aa1 |
[pkg/vm] Also check -Dtest_runner.configuration for arch-specific tests.
Add RISCV32 to the list of architectures checked for is32BitConfiguration. TEST=vm/dart/pointer_as_typed_list_il_test on android trybots Issue: https://github.com/dart-lang/sdk/issues/53774 Change-Id: I0c8297dc863b6121f9b1eafb99ae273ea2d0b34e Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm_x64-try,vm-aot-android-release-arm64c-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330740 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com> |
||
|
|
c9b28eb882 |
[vm/aot/tfa] Handle references to tree-shaken closures
Sometimes inferred closure value may reference a closure which was eliminated by the tree shaker (as tree-shaker can prune deeper AST). That should not cause a crash and inferred closure value should be disregarded. TEST=pkg/vm/testcases/transformations/type_flow/transformer/eliminated_closure.dart Fixes b/305730721 Change-Id: Ia26e620ebc06f949be1e05c734be65ce1d708b64 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330661 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> |
||
|
|
4d1bdaaca9 |
Reland "[vm/compiler] Change MemoryCopy to also take untagged addresses."
This is a reland of commit
|
||
|
|
5362d9536b |
Revert "[vm/compiler] Change MemoryCopy to also take untagged addresses."
This reverts commit
|
||
|
|
06d7a2352e |
[vm/compiler] Change MemoryCopy to also take untagged addresses.
This CL adds the ability to pass the payload address of the source and destination directly to the MemoryCopy instruction as an untagged value. The new translation of the _TypedListBase._memMoveN methods use the new MemoryCopy constructor, retrieving the untagged value of the data field of both the source and destination. This way, if inlining exposes the allocation of the object from which the data field is being retrieved, then allocation sinking can remove the intermediate allocation if there are no escaping uses of the object. Since Pointer.asTypedList allocates such ExternalTypedData objects, this CL makes that method inlined if at all possible, which removes the intermediate allocation if the only use of the TypedData object is to call setRange for memory copying purposes. This CL also separates unboxed native slots into two groups: those that contain untagged addresses and those that do not. The former group now have the kUntagged representation, which mimics the old use of LoadUntagged for the PointerBase data field and also ensures that any arithmetic operations on untagged addresses must first be explicitly converted to an unboxed integer and then explicitly converted back to untagged before being stored in a slot that contains untagged addresses. When a unboxed native slot that contains untagged addresses is defined, the definition also includes a boolean which represents whether addresses that may be moved by the GC can be stored in this slot or not. The redundancy eliminator uses this to decide whether it is safe to eliminate a duplicate load, replace a load with the value originally stored in the slot, or lift a load out of a loop. In particular, the PointerBase data field may contain GC-moveable addresses, but only for internal TypedData objects and views, not for external TypedData objects or Pointers. To allow load optimizations involving the latter, the LoadField and StoreField instructions now take boolean flags for whether loads or stores from the slot are guaranteed to not be GC-moveable, to override the information from the slot argument. Notable benchmark changes on x64 (similar for other archs unless noted): JIT: * FfiMemory.PointerPointer: 250.7% * FfiStructCopy.Copy1Bytes: -26.73% (only x64) * FfiStructCopy.Copy32Bytes: -25.18% (only x64) * MemoryCopy.64.setRange.Pointer.Uint8: 19.36% * MemoryCopy.64.setRange.Pointer.Double: 18.96% * MemoryCopy.8.setRange.Pointer.Double: 17.59% * MemoryCopy.8.setRange.Pointer.Uint8: 19.46% AOT: * FfiMemory.PointerPointer: 323.5% * FfiStruct.FieldLoadStore: 483.3% * FileIO_readwrite_64kb: 15.39% * FileIO_readwrite_512kb (Intel Xeon): 46.22% * MemoryCopy.512.setRange.Pointer.Uint8: 35.20% * MemoryCopy.64.setRange.Pointer.Uint8: 55.40% * MemoryCopy.512.setRange.Pointer.Double: 29.45% * MemoryCopy.64.setRange.Pointer.Double: 60.37% * MemoryCopy.8.setRange.Pointer.Double: 59.54% * MemoryCopy.8.setRange.Pointer.Uint8: 55.40% * FfiStructCopy.Copy32Bytes: 398.3% * FfiStructCopy.Copy1Bytes: 1233% TEST=vm/dart/address_local_pointer, vm/dart/pointer_as_typed_list Issue: https://github.com/dart-lang/sdk/issues/42072 Fixes: https://github.com/dart-lang/sdk/issues/53124 Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try,vm-eager-optimization-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try Change-Id: I563e0bfac5b1ac6cf1111649934067c12891b631 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324820 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> |
||
|
|
ed00c27c77 |
[vm/aot/tfa] Refactor hash codes in TFA
This change removes code duplication around hash code calculations in TFA. TFA cannot use Object.hash from core library as it is not guaranteed to be stable across different runs but compiler should be deterministic. TEST=ci Change-Id: Id1b35974e89e82218d82957495c27b6aad099c86 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330046 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> |
||
|
|
f87142fdc2 |
[kernel] Add ExtensionTypeDeclaration.procedures
This adds a list of `Procedure`s to `ExtensionTypeDeclaration`. This is meant to model representation fields and combined member signatures computed from inherited non-extension type members. These are not meant to be handled by the backends. The combined member signature can be the interface target of an `InstanceInvocation` expression but will always have a `.memberSignatureOrigin` value from one of the original class members. TEST=existing Change-Id: I87768ed75a3c7126b0a30f8ccf06e46678c56db6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330301 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> |
||
|
|
293cc6475a |
[vm/aot/tfa] Whole-program propagation of closure values
This change adds propagation of closure values to TFA. For now, inferred closure values are used only when they are constant (tear-off of a static method or a constructor). Arbitrary closures can now be referenced from unrelated members via closure-id metadata. In addition, this change fixes an incorrect stack trace when an implicit closure (tear-off) was propagated and its call was inlined. Inlining interval was not recorded because of the missing source position of a call to a target method within implicit closure. TEST=pkg/vm/testcases/transformations/type_flow/transformer/closures.dart Issue: https://github.com/dart-lang/sdk/issues/39692 Change-Id: I3590da91b6057e0b55a8614382dba1bbcc267b39 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325447 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Slava Egorov <vegorov@google.com> |
||
|
|
73466729f3 |
[vm] Pass offset and script uri for expression compilation
This CL passes the offset and uri of the file (here called a script uri as opposed to a library uri, the two will be different if we're in a part) when doing expression compilation. This CL only passes the data, but doesn't actually use it. Future CL(s) will use this data to calculate the static type of available variables which is needed for an upcomming feature. TEST=Existing tests. CoreLibraryReviewExempt: Not changing SDK APIs. Change-Id: I67ead461ab4bb9341424e693946f3e4afe35ce92 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329322 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> |
||
|
|
9a4c9100ae |
[kernel] Add DartType.extensionTypeErasure
This renames ExtensionType.typeErasure and adds it to DartType. This also fixes the extension type erasure for when extension types are used in the arguments of an extension type. DartType.extensionTypeErasure can be used by backends to easily access the type without extension types for any type. TEST=pkg/kernel/test/extension_type_erasure_test.dart Change-Id: Ia49d273ed85111e3ae822720860a3e0be5ea0252 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329960 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> |
||
|
|
481f2b39fc |
[vm] Fix noSuchMethod forwarding stubs in mixin applications
TEST=pkg/front_end/testcases/no_such_method_forwarders/regress_* Fixes https://github.com/dart-lang/sdk/issues/53677 Fixes https://github.com/dart-lang/sdk/issues/53676 Fixes https://github.com/dart-lang/sdk/issues/53656 Fixes https://github.com/dart-lang/sdk/issues/53640 Change-Id: I282a57a6aa4d3d55235ff0fb2c1d9b8470c49c93 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329565 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> |
||
|
|
e2fe203adc |
[deps] roll package:lints to the latest
Change-Id: I582f956cd4b712203c2f6dd630b4e1384040446d Tested: analysis clean (this is a lint only related change) Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329400 Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Commit-Queue: Devon Carew <devoncarew@google.com> |
||
|
|
80c79a3d84 |
[vm/test] Support declaring multiple instruction attributes.
Using the preprocessor string literal operator # on __VA_ARGS__ in a variadic macro does not separately stringize each argument, but instead creates a single string of the expanded arguments. Thus, rename DECLARE_ATTRIBUTES to DECLARE_ATTRIBUTE and have it take a single expression. For multiple attributes, DECLARE_ATTRIBUTES_NAMED must be used instead. Also, use a comma fold expression in AttributesSerializer::WriteTuple to separately call WriteAttribute with each element of the tuple in turn, instead of calling WriteAttribute once with all the tuple contents as arguments. Move the demangling of attribute names that are directly stringized from expressions from the JSON consumer to the JSON producer. To illustrate how to add multiple attributes to an instruction, this CL adds two attributes to the StoreField instruction: slot and is_initialization. When printing an instruction in the IL matcher, if the instruction has any boolean attributes, don't print the attribute if the value is false and only print the name if the attribute is true to reduce clutter. TEST=ci Change-Id: Ie541364374171c3dcbee4b609942d415a1c464e8 Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327864 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com> |
||
|
|
4352985e11 |
[vm/compiler] Perform inlining of _TypedList._getX in AOT.
This is a partial reland of
|
||
|
|
cb39b9ff07 |
Revert "[vm/compiler] Perform inlining of _TypedList._getX in AOT."
This reverts commit
|
||
|
|
6673f84d59 |
[vm/compiler] Perform inlining of _TypedList._getX in AOT.
Before, the inliner only replaced calls to the _TypedList._getX methods with specialized IL if speculation was allowed. This means that the inlining would not happen in AOT mode, even though the generated IL does not require speculation. In addition, this CL replaces the native functions used for the base definition of _TypedList._getX and _TypedList._setX with versions built in the FlowGraphBuilder. With this, the VM avoids the overhead of going to the runtime for a native call when these methods are not inlined, which should also reduce the impact of a failure to inline. TEST=vm/dart/inline_TypedList_getUint32 Issue: https://github.com/dart-lang/sdk/issues/53513 Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-linux-release-x64-try,vm-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try Change-Id: I66b6b8634b2b9b413fb745f02433eb58f2ff913e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325703 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> |
||
|
|
de302d7f3b |
[cfe] Introduce StructuralParameters
This CL introduces StructuralParameter and StructuralParameterType classes. They are intended to replace TypeParameter and TypeParameterType respectively where those were used as type parameters defined by FunctionTypes. Previously, type parameters of FunctionTypes were represented by TypeParameter objects with the ‘parent’ field set to null. By introducing StructuralParameter and StructuralParameterType this CL unambiguously separates the two notions of type parameters. TEST=existing Change-Id: Ida3feb7ad96a7b2acef55840eacba9e36bf2a3e7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312264 Reviewed-by: Johnni Winther <johnniwinther@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> |
||
|
|
20a7d7199f |
[vm/aot/tfa] Remove convariant parameter type checks when type argument is an extension type
This change improves handling of extension types when they are used in the generic types involved in parameter type checks. Instead of treating extension types as unknown opaque types, TFA now uses their type erasures. TEST=pkg/vm/testcases/transformations/type_flow/transformer/extension_type.dart Fixes https://github.com/dart-lang/sdk/issues/53542 Issue https://github.com/dart-lang/sdk/issues/49737 Change-Id: I04bb8f1940c0983b6c09403df577b89f5de4a81d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326681 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> |
||
|
|
15b4758745 |
[cfe] Make Statement, Expression, Initializer, Constant and DartType sealed
Adds Auxiliary* nodes to support extending the AST from outside package:kernel TEST=existing Change-Id: I350718a1b02c188f212b3390050b60484f9f4b3b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326305 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com> |