-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[IRGen] Cond. conformance witness table count isn't needed dynamically. #14973
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
@swift-ci please smoke test |
This changes the code from passing a @rjmccall it looks like you introduced this scheme originally, so maybe you're best positioned to comment on the above? |
You're not talking about changing anything about the actual bits we're passing, right? I don't really care about the exact pointer type we use in the function's IR declaration; if i8*** is convenient, and I agree that it probably is, then let's go with that. |
This is changing the bits, slightly: when I first implemented conditional conformances, it did something like struct WitnessTableSlice {
WitnessTable **requirements;
size_t count;
};
size_t count = ...;
WitnessTable *conditionalRequirements[count] = { ... };
WitnessTableSlice slice = { conditionalRequirements, count };
swift_getGenericWitnessTable(..., (void**)&slice); But now it does WitnessTable *conditionalRequirements[count] = { ... };
swift_getGenericWitnessTable(..., (void**)conditionalRequirements); But, those (currently, at least) just get passed straight through to the instantiation function, which is also controlled by the code that decides the format for that argument, so the exact format of the data doesn't seem like it matters for ABI. |
Well, the runtime should in theory be able to inspect all the witness tables being passed in; consider that we might want to do dynamic partial specialization of the conformance or something. But it also seems to me that, much like getGenericMetadata, the length of that array should be fixed for any given generic witness table, so it doesn't need to be passed in separately. |
Which is to say that I agree that this change is a good one. |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
The count of the number of witness tables was designed to be an assertion/check that we've hooked up all the infrastructure correctly. Everything is now implemented, and the assertion has never triggered, so it can be removed, saving some work. Fixes rdar://problem/38038928.
This is simpler, because the native form of that last argument is: a pointer to a buffer (*) of pointers (*) to witness tables, which is modelled as a buffer of void *s. Thus, void ***.
@swift-ci please smoke test |
@swift-ci please smoke test. |
The count of the number of witness tables was designed to be an
assertion/check that we've hooked up all the infrastructure
correctly. Everything is now implemented, and the assertion has never
triggered, so it can be removed, saving some work.