-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SILVerifier] UnmanagedToRef and RefToUnmanaged must be loadable #16279
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
[SILVerifier] UnmanagedToRef and RefToUnmanaged must be loadable #16279
Conversation
@swift-ci please test |
Build failed |
0ab281d
to
72639be
Compare
@swift-ci please test |
Build failed |
Build failed |
Hey @rjmccall – Here is an example build failure when SIL verifies Unmanaged loadability:
|
That's because the I think we're talking past each other. |
Hi @rjmccall – Thanks. I agree that we're talking past each other. I just don't feel like I fully appreciate what "loadable" means in this context, and I don't appreciate why the referent being native or not would change load-ability. Does "loadable" refer to reading the reference pointer from memory? If so, then why does the referent nativeness matter? It clearly doesn't matter for Does this have anything to do with magic ObjC pointers that aren't actually pointers (inline object storage, the non-ponter ISA, etc)? |
"Loadable" means, essentially, that it's semantically okay to load a value of the type into registers — i.e. that it's not tied to being in memory and can safely be moved around with things like
|
Would "isMovable" or "isCopyable" be a better name then? It feels confusing to have |
No, because those types are still movable and copyable; they just can't be moved with memcpy. Also, "loadable" is a pretty inextricable term of art in the compiler at this point. |
Thanks for the feedback John. I think I get it now. I'll have to think about how to add this extra dimension of complexity to #16237. |
In #16237, @rjmccall wrote: "Unmanaged is never not loadable. It's possible that we're messing that up somewhere."
Let's add a SIL verifier and sort this out.