-
Notifications
You must be signed in to change notification settings - Fork 1.7k
FFI: Support hardfp calling conventions on Linux ARM #36309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Adds micro benchmarks to measure low level (1) C memory reads and writes from Dart and (2) calls from Dart into C. This CL also adds a macro benchmark to measure overall performance using BoringSSL to digest data. The shared libraries are precompiled for Linux and live in cipd packages. The benchmarks run on all hardware architectures (with the exception of Linux'es hardfp on Arm32: #36309). Issue: #36247 Change-Id: I8dfb30cc66a26a2942bb09194c5eb0da0b6ca1b5 Cq-Include-Trybots: luci.dart.try:benchmark-linux-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108724 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Jonas Termansen <[email protected]> Auto-Submit: Daco Harkes <[email protected]>
To implement:
Float in s0, double in d0.
Floats in s-registers, doubles in d-registers.
Source: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ihi0042f/index.html |
Let's try to target to have this ready by D27, so our configuration space is completed and |
In order to implement this we need refactor our logic in the FFI to compute the location of where arguments should be. We currently use the (Side note: supporting structs-by-value (#36730) requires the same refactoring. That introduces even more locations that are not used in the Dart ABI. Arbitrary size stack locations, allocated memory with a pointer in a register, etc.) Let's see if it's feasible to get that done by D27. |
That's far fetched. |
To address the comment about tests from https://dart-review.googlesource.com/c/sdk/+/124136/3/runtime/bin/ffi_test/ffi_test_functions.cc Issue: #36309 Change-Id: Ib6b56db22d44603d31006f3f099ab25a8a9c6d55 Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132843 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
Introduces NativeRepresentation and NativeLocation for the compilation of FFI. NativeRepresentations are able to express all representations (or types) of the native ABIs we bind to with FFI, this is more representations that than that are used in Dart itself. NativeLocations are able to express all locations of the native ABIs we bind to with FFI, this is more types of locations than that are used for the Dart calling convention. See the documentation in the respective files. These NativeLocations and NativeRepresentations are computed by the NativeCallingConvention and consumed by the Marshaller and Assemblers. This reenginering is required for go/dart-ffi-by-value, hardfp (Arm S and D fpu registers), and iOS 64 bit (non-word-aligned stack arguments). In addition, by using the NativeRepresentations we also get slightly reduced code size: * The tracking of sizes is improved, so less sign/zero-extension operations are required. * UnboxedWidthExtenderInstr is fully removed, the size extension is done inside the native moves, coalescing moves and size extension when possible. * BitCastInstr is only used when really needed. This reduces code-size on arm32 softfp. This fixes the iOS arm64 calling convention, manually tested with flutter/flutter#46078 and https://dart-review.googlesource.com/c/sdk/+/131074. Fixes: #39637 Issue: #36309 Issue: #36730 Change-Id: I8878bc0f314277bab4ca22f417c6295ecc017720 Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129081 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]> Reviewed-by: Alexander Markov <[email protected]>
Introduces NativeRepresentation and NativeLocation for the compilation of FFI. NativeRepresentations are able to express all representations (or types) of the native ABIs we bind to with FFI, this is more representations that than that are used in Dart itself. NativeLocations are able to express all locations of the native ABIs we bind to with FFI, this is more types of locations than that are used for the Dart calling convention. See the documentation in the respective files. These NativeLocations and NativeRepresentations are computed by the NativeCallingConvention and consumed by the Marshaller and Assemblers. This reenginering is required for go/dart-ffi-by-value, hardfp (Arm S and D fpu registers), and iOS 64 bit (non-word-aligned stack arguments). In addition, by using the NativeRepresentations we also get slightly reduced code size: * The tracking of sizes is improved, so less sign/zero-extension operations are required. * UnboxedWidthExtenderInstr is fully removed, the size extension is done inside the native moves, coalescing moves and size extension when possible. * BitCastInstr is only used when really needed. This reduces code-size on arm32 softfp. This fixes the iOS arm64 calling convention, manually tested with flutter/flutter#46078 and https://dart-review.googlesource.com/c/sdk/+/131074. Fixes: dart-lang#39637 Issue: dart-lang#36309 Issue: dart-lang#36730 Change-Id: I8878bc0f314277bab4ca22f417c6295ecc017720 Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/129081 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]> Reviewed-by: Alexander Markov <[email protected]>
Implement the hardfp calling convention. Tested QEMU locally as the bots are not online yet. tools/test.py -m debug -a arm -c dartkp --use-qemu ffi_2 ; tools/test.py -m debug -a arm -c dartk --use-qemu ffi_2 Test configuration: custom configuration(architecture: arm, compiler: dartkp, mode: debug, runtime: dart_precompiled, system: linux, use-qemu) Suites tested: ffi_2 [00:45 | 100% | + 189 | - 0] Test configuration: custom configuration(architecture: arm, compiler: dartk, mode: debug, runtime: vm, system: linux, use-qemu) Suites tested: ffi_2 [09:52 | 100% | + 189 | - 0] Fixes: dart-lang#36309 Change-Id: Ic34175bdf9b9f359f1126aeb157362e76443921a Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124136 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
We have only implemented the softfp calling convention, which is used by Android and iOS (regardless of whether hardfp support is available).
Linux ("gnueabi") uses the hardfp calling convention, we which must implement to support FFI on Linux ARM.
The text was updated successfully, but these errors were encountered: