Daco Harkes
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 >
2023-11-02 16:00:53 +00:00
..
2023-11-02 16:00:53 +00:00
2023-07-10 12:23:15 +00:00
2023-10-18 07:47:39 +00:00
2023-04-17 15:58:28 +00:00
2023-09-13 20:26:30 +00:00
2023-10-11 22:22:12 +00:00
2023-04-20 17:42:06 +00:00
2023-06-06 02:07:58 +00:00
2023-04-10 18:15:12 +00:00
2023-05-24 08:42:14 +00:00
2023-07-03 12:29:15 +00:00
2023-10-27 07:55:47 +00:00
2023-08-10 18:53:37 +00:00
2023-09-05 21:47:59 +00:00
2023-04-21 08:06:49 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-07-11 15:13:58 +00:00
2023-04-12 22:18:54 +00:00
2023-03-06 22:06:59 +00:00
2023-03-06 22:06:59 +00:00
2023-05-10 11:38:57 +00:00
2023-10-17 07:41:49 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-09-13 20:26:30 +00:00
2023-02-06 21:49:07 +00:00
2023-08-25 03:35:44 +00:00
2023-07-26 21:14:09 +00:00
2023-06-15 00:34:18 +00:00
2023-06-21 15:24:30 +00:00
2023-04-20 17:42:06 +00:00
2023-07-27 20:17:17 +00:00
2023-06-28 11:48:26 +00:00
2023-06-28 11:48:26 +00:00
2023-04-10 18:15:12 +00:00
2023-10-12 16:16:21 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-01-20 12:37:49 +00:00
2023-04-10 18:15:12 +00:00
2023-10-12 10:22:38 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-06-28 01:00:18 +00:00
2023-08-01 17:01:41 +00:00
2023-07-11 15:13:58 +00:00
2023-06-28 01:00:18 +00:00
2023-09-04 14:38:27 +00:00
2023-09-04 14:38:27 +00:00
2023-06-23 20:35:00 +00:00
2023-02-27 22:26:36 +00:00
2023-09-12 16:22:19 +00:00
2023-09-12 16:22:19 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-04-10 18:15:12 +00:00
2022-11-14 15:42:52 +00:00
2023-05-22 16:43:04 +00:00
2023-04-10 21:38:57 +00:00
2023-04-10 21:38:57 +00:00
2023-04-10 21:38:57 +00:00
2023-07-12 17:14:18 +00:00
2023-04-10 18:15:12 +00:00
2023-10-18 07:47:39 +00:00
2023-10-05 13:24:34 +00:00
2023-04-20 17:42:06 +00:00
2023-07-26 21:53:49 +00:00
2023-07-20 17:06:44 +00:00
2023-06-29 17:29:48 +00:00
2023-07-27 20:17:17 +00:00
2023-08-10 18:53:37 +00:00
2023-06-29 08:04:20 +00:00
2023-04-12 22:18:54 +00:00
2023-10-12 10:22:38 +00:00
2023-09-06 21:46:00 +00:00
2023-08-31 19:52:23 +00:00
2023-08-31 19:52:23 +00:00
2023-09-27 16:23:38 +00:00
2023-04-10 18:15:12 +00:00
2023-10-17 07:41:49 +00:00
2023-09-27 16:23:38 +00:00
2022-09-12 12:33:57 +00:00
2022-09-12 12:33:57 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-10-23 13:54:04 +00:00
2023-05-31 08:06:08 +00:00
2023-06-06 02:07:58 +00:00
2023-08-17 17:38:48 +00:00
2023-04-10 18:15:12 +00:00
2023-09-27 16:23:38 +00:00
2023-09-27 16:23:38 +00:00
2023-10-06 19:00:58 +00:00
2023-10-06 19:00:58 +00:00
2023-08-25 03:35:44 +00:00
2023-11-01 22:38:27 +00:00
2023-08-25 03:35:44 +00:00
2023-04-26 22:18:51 +00:00
2023-07-27 20:17:17 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-08-11 17:56:57 +00:00
2023-04-10 18:15:12 +00:00
2023-09-06 18:10:33 +00:00
2023-10-20 19:45:49 +00:00
2023-07-26 21:53:49 +00:00
2023-10-20 19:45:49 +00:00
2023-02-06 22:19:55 +00:00
2023-04-10 18:15:12 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-06-27 19:42:15 +00:00
2022-12-01 10:15:58 +00:00
2023-10-24 15:04:36 +00:00
2023-05-31 08:06:08 +00:00
2023-07-11 15:13:58 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-13 19:29:47 +00:00
2023-04-12 22:18:54 +00:00
2023-03-06 22:06:59 +00:00
2023-04-12 22:18:54 +00:00
2023-09-06 16:44:58 +00:00
2023-10-19 17:38:10 +00:00
2023-05-10 19:08:23 +00:00
2023-08-09 06:01:55 +00:00
2023-10-18 07:47:39 +00:00
2023-10-18 07:47:39 +00:00
2023-06-09 17:57:12 +00:00
2023-06-09 17:57:12 +00:00
2023-04-17 15:58:28 +00:00
2023-09-27 13:40:06 +00:00
2023-04-17 15:58:28 +00:00
2023-07-14 10:15:06 +00:00
2023-10-30 16:05:27 +00:00
2023-10-12 10:22:38 +00:00
2023-10-12 10:22:38 +00:00
2023-11-02 16:00:53 +00:00
2023-11-02 16:00:53 +00:00
2022-11-11 01:59:28 +00:00
2023-07-14 10:15:06 +00:00
2023-07-14 10:15:06 +00:00
2023-08-08 10:17:36 +00:00
2023-08-29 16:19:40 +00:00
2023-04-10 18:15:12 +00:00
2023-04-20 17:42:06 +00:00
2023-04-10 18:15:12 +00:00
2023-06-29 08:04:20 +00:00
2023-06-29 08:04:20 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-08-09 06:01:55 +00:00
2023-08-08 10:57:47 +00:00
2023-08-08 10:57:47 +00:00
2023-07-11 10:15:58 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-07-26 21:53:49 +00:00
2023-03-29 19:58:33 +00:00
2023-04-10 18:15:12 +00:00
2023-03-29 19:58:33 +00:00
2023-04-10 18:15:12 +00:00
2023-08-09 06:01:55 +00:00
2023-11-02 16:00:53 +00:00
2023-09-20 16:08:51 +00:00
2023-09-20 16:08:51 +00:00
2023-08-08 10:57:47 +00:00
2023-08-08 10:57:47 +00:00
2023-09-05 21:47:59 +00:00
2023-04-12 22:18:54 +00:00
2023-10-18 07:47:39 +00:00
2023-02-23 03:11:08 +00:00
2023-04-10 18:15:12 +00:00
2023-05-10 16:12:28 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-07-26 21:14:09 +00:00
2023-08-15 17:55:39 +00:00
2023-11-02 16:00:53 +00:00
2023-11-02 16:00:53 +00:00
2023-08-30 17:18:53 +00:00
2023-11-02 16:00:53 +00:00
2023-11-02 16:00:53 +00:00
2023-06-12 15:26:29 +00:00
2023-06-12 15:26:29 +00:00
2023-06-14 20:36:48 +00:00
2023-06-12 15:26:29 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-10-12 16:58:27 +00:00
2023-09-28 19:53:33 +00:00
2023-06-12 15:26:29 +00:00
2023-06-12 15:26:29 +00:00
2023-08-24 15:21:51 +00:00
2023-08-04 11:07:46 +00:00
2023-05-15 20:51:38 +00:00
2022-09-27 21:34:05 +00:00
2023-04-12 22:18:54 +00:00
2023-08-09 06:01:55 +00:00
2023-08-09 06:01:55 +00:00
2023-08-09 06:01:55 +00:00
2023-04-10 18:15:12 +00:00
2023-08-17 18:51:19 +00:00
2023-08-17 18:51:19 +00:00
2023-10-02 17:57:33 +00:00
2023-10-02 17:57:33 +00:00
2023-08-17 18:51:19 +00:00
2023-04-19 08:47:31 +00:00
2023-04-10 18:15:12 +00:00
2023-08-01 15:50:11 +00:00
2023-09-06 18:11:58 +00:00
2022-12-01 14:38:44 +00:00
2023-10-18 07:47:39 +00:00
2023-10-18 07:47:39 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-10-17 16:14:29 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-07-06 21:10:28 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2022-12-29 10:18:02 +00:00
2023-04-12 22:18:54 +00:00
2023-08-30 17:18:53 +00:00
2023-08-30 17:18:53 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-09-11 21:25:09 +00:00
2023-10-18 07:47:39 +00:00
2023-06-28 01:00:18 +00:00
2023-04-10 18:15:12 +00:00
2023-08-24 15:21:51 +00:00
2023-10-04 13:18:55 +00:00
2023-08-21 16:46:46 +00:00
2023-06-29 08:04:20 +00:00
2023-04-10 18:15:12 +00:00
2023-08-09 06:01:55 +00:00
2023-10-12 10:22:38 +00:00
2023-09-19 21:53:41 +00:00
2023-09-27 15:11:05 +00:00
2023-06-23 17:01:58 +00:00
2023-01-06 07:48:22 +00:00
2023-09-27 15:11:05 +00:00
2023-07-21 19:06:43 +00:00
2023-07-21 19:06:43 +00:00
2023-07-21 19:06:43 +00:00
2023-07-21 19:06:43 +00:00
2023-07-11 15:13:58 +00:00
2023-04-12 22:18:54 +00:00
2023-07-11 15:13:58 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-10 18:15:12 +00:00
2023-04-12 22:18:54 +00:00
2023-09-19 21:53:41 +00:00
2023-09-19 21:53:41 +00:00
2023-09-19 21:53:41 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-28 23:25:43 +00:00
2023-04-12 22:18:54 +00:00
2023-10-20 19:45:49 +00:00
2023-04-12 22:18:54 +00:00
2023-08-31 11:47:54 +00:00
2023-06-30 14:03:03 +00:00
2023-07-03 10:39:53 +00:00
2023-08-15 14:54:58 +00:00
2023-07-03 10:39:53 +00:00
2023-04-19 08:47:31 +00:00
2023-11-02 16:00:53 +00:00
2023-10-18 07:47:39 +00:00
2023-08-17 18:51:19 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-09-27 15:11:05 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-02-21 19:07:57 +00:00
2023-10-09 17:23:23 +00:00
2023-09-27 15:11:05 +00:00
2023-09-27 15:11:05 +00:00
2023-04-10 18:15:12 +00:00
2023-03-06 22:06:59 +00:00
2023-01-09 15:48:57 +00:00
2023-10-18 07:47:39 +00:00
2023-10-18 07:47:39 +00:00
2023-05-10 19:08:23 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-09-29 10:08:02 +00:00
2023-10-18 07:47:39 +00:00
2023-10-18 07:47:39 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-07-10 20:33:33 +00:00
2023-10-16 14:02:31 +00:00
2023-10-12 16:58:27 +00:00
2023-02-20 14:57:57 +00:00
2023-09-27 16:23:38 +00:00
2023-09-27 16:23:38 +00:00
2023-06-24 12:56:12 +00:00
2023-08-15 14:54:58 +00:00
2023-04-17 16:26:35 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-04-12 22:18:54 +00:00
2023-10-12 10:22:38 +00:00
2023-09-27 18:18:47 +00:00
2023-05-11 03:14:27 +00:00
2023-05-11 03:14:27 +00:00
2023-05-11 03:14:27 +00:00
2023-04-10 18:15:12 +00:00
2023-04-10 18:15:12 +00:00
2023-10-31 19:39:51 +00:00
2023-06-23 20:35:00 +00:00
2023-06-23 20:35:00 +00:00
2023-10-17 20:32:52 +00:00
2023-08-11 21:30:17 +00:00
2023-06-06 02:07:58 +00:00
2023-06-21 11:39:50 +00:00
2023-11-01 22:38:27 +00:00
2023-06-20 19:28:18 +00:00
2022-09-10 15:12:35 +00:00
2023-04-21 22:41:28 +00:00
2023-09-05 21:47:59 +00:00
2023-06-07 19:01:51 +00:00
2023-06-16 11:22:38 +00:00
2023-06-16 11:22:38 +00:00