-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[vm/ffi] Implement ExternalTypedData unwrapping to Pointers in non-leaf calls #54856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
👍 As I've suggested offline, allowing the address-of operator on typed data in leaf & non-leaf calls and make it throw in non-leaf calls if it's not external typed data would be my preferred solution. It avoids flaky behavior where we sometimes copy and sometimes not. It allows it in non-leaf calls. The only requirement is that users have to ensure that their typed data is backed by external memory, which is guaranteed if users e.g. use It does bear the question whether we should have a mechanism to allow users to check whether a typed data is backed by external memory, so users can e.g. write |
I think I'd rather that I don't think the About Maybe have a The last one is a failure case that worries me. If we say that the same |
Thanks @mkustermann and @lrhn!
➕
I don't really like (Naming side note: It should probably be We'll need to come up with some consistent naming strategy involving (a) 'external', (b) 'internal'/'dart', (c) 'possibly internal'/'possibly dart', (d) 'leaf call' and relate all of these concepts in the documentation. Also, if we start supporting |
After #44589, the question becomes what can we do for non-leaf calls.
If the typed-data is an external typed-data, unwrapping it on non-leaf calls is fine.
Possible alternatives for avoiding buffer copies on non-leaf calls.
Pointer
s instead, likely nested in opaque classes that implementFinalizable
.asTypedList
with a finalizer and then views on top of that to ensure there's only a single finalizer runs into the problems again that there's noPointer
on theTypedData
with anExpando
Pointer
cc @mkustermann @craiglabenz @Piinks
The text was updated successfully, but these errors were encountered: