mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 18:49:37 +00:00
1cebdcb2da
Previously, the FFI used unboxed integers as a native representation for pointers in FFI code, as the compiler only handled very specific uses of untagged pointers flowing between instructions. Since then, this restriction has been removed for untagged pointers that do not point to memory managed by the GC, like FFI pointers, so now they can have a more precise representation. By being precise about when untagged (untagged pointers to freshly allocated Handles and the contents of Pointer data fields) and tagged (TypedData objects constructed to hold the byte representation of compound data) values are expected, we can remove the need to have untagged pointers to GC-movable objects and/or having untagged pointers escape as unboxed integers in the generated IL. This CL also renames kUnboxedFfiIntPtr -> kUnboxedAddress and limits its uses specifically to where the unboxed integer represents the numeric representation of an untagged pointer. This CL changes CCall to take Representations for the arguments and return value instead of what looks like an arbitrary NativeCallingConvention. However, the serializer and deserializers for CCall, used in IL tests, originally assumed that the argument and return representations were kUnboxedFfiIntPtr, so providing an arbitrary NativeCallingConvention which didn't match that assumption would cause failures during IL tests. That assumption came from the fact that the only creator of CCall instructions was in kernel_to_il.cc, and there that was the case. Now CCall builds the native calling convention during construction and deserialization from the argument and return representations and stores both the representations and built native calling convention internally. In the future, if we want to create CCall instructions with more arbitrary native calling conventions, then we'll need to handle serialization/deserialization of arbitrary native calling conventions, and also add consistency checks that the provided representations appropriately match the native calling convention. TEST=ffi vm/dart/regress_306327173_il vm/dart/address_local_pointer_il Issue: https://github.com/dart-lang/sdk/issues/54710 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-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-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-release-ia32-try Change-Id: I34effe8fbdc80288b703e0152d5ba67ce2343400 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/353101 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com> |
||
---|---|---|
.. | ||
co19 | ||
corelib | ||
dartdevc | ||
ffi | ||
hot_reload | ||
language | ||
lib | ||
macro_build | ||
modular | ||
standalone | ||
web | ||
legacy_status_dart2js.csv | ||
OWNERS | ||
README.md |
This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/wiki/Testing.