[ffi] NativeCallable.isolateLocal
with top level function tearOff should do static call
#53096
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-ffi
P3
A lower priority bug or feature request
triaged
Issue has been triaged by sub team
type-performance
Issue relates to performance or code size
With the new
NativeCallable.isolateLocal
introduced in #52689 and https://dart-review.googlesource.com/c/sdk/+/317060, all callbacks have closure calls.It might be worth investigating how to turn usages of that API in which tear-offs of toplevel functions are passed in could use static calls. Either through having smart enough machinery in the VM optimizations (not sure if that is feasible), or a CFE transform (definitely feasible, but would mean more machinery).
We could then also consider implementing
Pointer.fromFunction
in terms of the newNativeCallable.isolateLocal
(which just don't have their close method called by users ever).And we should then also consider whether we should deprecate
Pointer.fromFunction
.Unless I'm missing something why we should keep
Pointer.fromFunction
.The text was updated successfully, but these errors were encountered: