Commits

Slava Pestov committed 65dd0e7b930
Protocol conformances can now reference resilient value types Change conformance records to reference NominalTypeDescriptors instead of metadata patterns for resilient or generic types. For a resilient type, we don't know if the metadata is constant or not, so we can't directly reference either constant metadata or the metadata template. Also, whereas previously NominalTypeDescriptors would point to the metadata pattern, they now point to the metadata accessor function. This allows the recently-added logic for instantiating concrete types by name to continue working. In turn, swift_initClassMetadata_UniversalStrategy() would reach into the NominalTypeDescriptor to get the pattern out, so that its bump allocator could be used to allocate ivar tables. Since the pattern is no longer available this way, we have to pass it in as a parameter. In the future, we will split off the read-write metadata cache entry from the pattern; then swift_initClassMetadata_UniversalStrategy() can just take a pointer to that, since it doesn't actually need anything else from the pattern. Since Clang doesn't guarantee alignment for function pointers, I had to kill the cute trick that packed the NominalTypeKind into the low bits of the relative pointer to the pattern; instead the kind is now stored out of line. We could fix this by packing it with some other field, or keep it this way in case we add new flags later. Now that generic metadata is instantiated by calling accessor functions, this change removes the last remaining place that metadata patterns were referenced from outside the module they were defined in. Now, the layout of the metadata pattern and the behavior of swift_getGenericMetadata() is purely an implementation detail of generic metadata accessors. This patch allows two previously-XFAIL'd tests to pass.