Files
sdk/runtime/vm
Clement Skau 4258a59789 [vm][ffi] Passes FFI handles on stack.
Passing handles in FFI calls has significant overhead due to
how each handle requires a runtime entry to allocate in the
handle scope.

This change removes that runtime entry by relying on the
register allocator to allocate all handle arguments on the stack,
so that we don't need to allocate them separately.
To pass the stack handles to the native call we then pass a pointer
to the stack slot as the native argument.

Testing:
- We already have comprehensive tests for correctness in the form
  of the FFI tests. These make calls with various combinations of
  Handle and non-handle arguments.
- Correct GC behaviour is likewise covered in
  `vmspecific_handle_test.dart` which makes calls with handles
  arguments and triggers GC in-flight.
  In case we do not correctly pass the handles on the stack, the
  GC will trash them during the call.

TEST=Existing.
Bug: https://github.com/dart-lang/sdk/issues/47624
Change-Id: Ic837bad5484daaa5534b7c2e8707ac2c5dfa480f
Cq-Include-Trybots: luci.dart.try:vm-kernel-gcc-linux-try,vm-kernel-linux-debug-simriscv64-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-precomp-android-release-arm64c-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-linux-debug-simriscv64-try,vm-precomp-ffi-qemu-linux-release-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243320
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2022-05-11 06:43:14 +00:00
..
2021-07-13 01:55:45 +00:00
2021-07-13 01:55:45 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-03-25 10:29:30 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2021-07-09 13:48:25 +00:00
2021-11-16 16:23:36 +00:00
2022-04-18 22:30:36 +00:00
2022-01-21 21:24:20 +00:00
2022-01-21 21:24:20 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-03-25 10:29:30 +00:00
2022-03-25 10:29:30 +00:00
2022-03-26 09:41:21 +00:00
2022-01-20 00:57:57 +00:00
2020-05-04 21:15:27 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-01-20 00:57:57 +00:00
2022-04-25 23:12:53 +00:00
2021-06-14 20:45:18 +00:00
2021-06-14 20:45:18 +00:00
2022-01-20 00:57:57 +00:00
2020-05-04 21:15:27 +00:00
2022-01-20 00:57:57 +00:00
2020-08-06 19:55:12 +00:00
2021-10-14 00:10:12 +00:00