-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Remote Mirror] Pass spare bit data for multi-payload enums from compiler #34990
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
557a353
to
1da80cc
Compare
a60d106
to
9cd8f1b
Compare
9cd8f1b
to
03c6314
Compare
03c6314
to
9c3e9b8
Compare
This code rearchitects and simplifies the projectEnumValue support by introducing a new `TypeInfo` subclass for each kind of enum, including trivial, no-payload, single-payload, and three different classes for multi-payload enums: * "UnsupportedEnum" that we don't understand. This will allow us to return correct "don't know" answers in cases where the runtime lacks enough information to accurately handle a particular enum. * MP Enums that only use a separate tag value. This includes generic enums and other dynamic layouts, as well as enums whose payloads have no spare bits. * MP Enums that use spare bits, possibly in addition to a separate tag. This logic can only be used, of course, if we can in fact compute a spare bit mask that agrees with the compiler. The final challenge is to choose one of the above three handlings for every MPE. The current code that computes the spare bit mask for the third type above has some flaws that need to be understood. Next step: Figure out spare bit mask computation. Any cases we can compute correctly based on the information available at runtime can be handled by one of the above three TI classes. For the remaining cases, we'll probably have to divert to "Unsupported" until we can arrange for the compiler to provide us with augmented data.
…depended on it The experimental spare bits calculation helped to validate the structure of this code and the handling of various multi-payload enum details, but it cannot be done here in a way that will always agree with the compiler. So I've backed that out: The result can still handle certain multi-payload enums (those with dynamic layouts that can never utilize spare bits) but the remainder will require some additional work for the compiler to expose the real spare bit data for use in the runtime.
…ng that depended on it" This reverts commit 2ad9bec.
Fortunately, I don't actually want a "size" type here. Otherwise, I would have to figure out why any use of `size_t` or `typename Runtime::SizeType` causes massive metadata failures at runtime, even when the trailing object isn't actually present.
The previous logic had hardcoded determinations to compute the trailing objects for a particular class of descriptors. As more descriptors gain more diverse trailing objects, this gets harder to maintain. This instead repeatedly estimates the full size and incrementally fetches more data until the trailing object logic says we have everything. It rests on a new trailing object method `totalSizeOfPartialObject` that takes the size of a (possibly partial) TrailingObjects type and returns either a smaller size (indicating that the original data is sufficient) or a larger size (indicating that the original data is insufficient). Note that in the latter case, the returned size is necessarily an estimate; because trailing objects can vary depending on the contents of earlier trailing objects, we can't be entirely certain of the exact size until we have everything.
I finally worked out the template recursion needed to make this actually compile. I still need to test it and use it to support the general decriptor copying I've been working on.
9c3e9b8
to
b925063
Compare
Closed: #73624 is expanding the runtime's ability to compute the mask directly, which should eliminate the need to have the compiler provide this information. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates the compiler to include "spare bits" data in the metadata record for fixed-layout multi-payload enums, and modifies RemoteMirror to use that data for correct introspection. The logic for actually using spare bit data is already there and has had some testing; this PR just plumbs through the data itself.
Resolves rdar://61158214