4258a59789
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>
Dart VM Compilation Pipeline
This folder contains Dart VM compilation pipeline.
Compilation pipeline is mainly responsible for converting AST or Kernel AST into IL flow graphs and then generating native code from IL.
It has the following structure:
| Directory | What goes there |
|---|---|
assembler/ |
Assemblers and disassemblers |
backend/ |
IL based compilation backend: optimization passes and architecture specific code generation rules |
frontend/ |
Frontends responsible for converting AST into IL |
jit/ |
JIT specific passes and compilation pipeline entry points |
aot/ |
AOT specific passes and compilation pipeline entry points |
. |
Shared code or code without clear designation. |
Currently there are no layering restrictions and components from different subfolders can reference each other.