-
Notifications
You must be signed in to change notification settings - Fork 1.7k
reachabilityFence
and AOT
#49662
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
We might want to revive https://dart-review.googlesource.com/c/sdk/+/229901 in that case. What is the use case where you need the fence? What is the use case in which implementing |
I have an externally allocated, reference-counted block of memory. A Dart object is handling the reference counting in its constructor and finalizer and serves as a handle. The memory contains a persisted data structure that can be navigated without fully reading it, through C functions, which know how to traverse it. I only read the parts that are requested, when they are requested, and I store pointers into the data structure to where I might need to continue reading. Whenever I read from the data structure through the C functions, I use a reachability fence to ensure that the handle stays alive and transitively the block of memory. I implemented this before |
Please let us know if this works for you. We believe |
I agree, and was able to eliminate all fences by using Maybe you could quickly answer this question: All the C functions to decode the mentioned data structure are in a dynamic library. Fully traversing some larger example data is ~8x faster from C as opposed to from Dart. This makes decoding that data into Dart objects about as fast as decoding an equivalent JSON string with |
It's better to open new issues or StackOverflow questions. But since I'm at it.
Right now probably yes, but eventually we'd like to fully unbox
Use |
@dcharkes A while back, I asked whether there is a difference between the two reachability fences below (#48704 (comment)):
At least in AOT, it seems that the argument to
reachabilityFence1
is replaced with a constant, rendering the fence ineffective:It might be a good idea to expose the
reachabilityFence
that is currently internal to the SDK, so that people don't run into this subtle difference.The text was updated successfully, but these errors were encountered: