[vm/ffi] Optimize ffi calls with multiple Dart_Handle arguments #42341
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
type-enhancement
A request for a change that isn't a bug
type-performance
Issue relates to performance or code size
FfiCall.Handlex01(RunTime): 347.8671304347826 us.
FfiCall.Handlex02(RunTime): 384.86376755820663 us.
FfiCall.Handlex04(RunTime): 492.896007885658 us.
FfiCall.Handlex10(RunTime): 846.1214043993232 us.
FfiCall.Handlex20(RunTime): 1193.412291169451 us.
We currently call into C for every handle with
sdk/runtime/vm/compiler/frontend/kernel_to_il.cc
Lines 2750 to 2764 in 755686e
sdk/runtime/vm/runtime_entry.cc
Lines 3559 to 3570 in 755686e
Instead, we can extend the EnterHandleScope with an int how many handles we want, and do some integer arithmetic in IL to compute the addresses of those handles. (Up to the number of handles that fit into one single block.)
sdk/runtime/vm/compiler/frontend/kernel_to_il.cc
Lines 2731 to 2736 in 755686e
The text was updated successfully, but these errors were encountered: