-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IRGen] Emit a pointer from nominal type descriptor to concrete metadata. #79302
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
Conversation
Could another way of implementing this just be to stuff this as an entry to the canonical specialized metadata entries? |
That's pretty much what this is doing, but we're taking advantage of the fact that we know there can only be one when the type is not generic, so we don't have to emit the count, and save four bytes. |
Ha, we are indeed saving 4 bytes (I'm just playing devil's advocate, I don't mind how you implement this). |
Under what situations exactly do we want to emit this link? When the metadata is preallocated but not necessarily statically initialized? |
We want it to be when the metadata is emitted by the compiler and can be used as-is, with no runtime initialization. Basically, if someone writes |
Any further comments, or is this OK to get in? |
It seems fine to me. |
@swift-ci please test |
121a292
to
ae406bd
Compare
Linux tests failed because wasm didn't like the new test. I switched from |
@swift-ci please test |
ae406bd
to
b35f167
Compare
And a test tweak for 32-bit. |
@swift-ci please test |
…ata. This allows external tools to locate the metadata pointer without needing to call the accessor function. This is only useful for non-generic types, so we borrow the HasCanonicalMetadataPrespecializations flag to indicate the presence of this pointer on non-generic types, and it continues to indicate the presence of prespecializations for generic types. Only emit this pointer for internal/private types with no runtime initialization. Public type metadata can be found with the symbol, and it's not useful for types that require runtime initialization.
b35f167
to
270ddf6
Compare
@swift-ci please test |
Windows timed out for what appears to be unrelated reasons. |
@swift-ci please test Windows platform |
This allows external tools to locate the metadata pointer without needing to call the accessor function.
This is only useful for non-generic types, so we borrow the HasCanonicalMetadataPrespecializations flag to indicate the presence of this pointer on non-generic types, and it continues to indicate the presence of prespecializations for generic types.
Only emit this pointer for internal/private types with no runtime initialization. Public type metadata can be found with the symbol, and it's not useful for types that require runtime initialization.
rdar://144640722