<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I made an experimental patch to IRGen to emit a table of type metadata, independent of the protocol conformance table.</div><div class=""><br class=""></div><div class="">The entry format is a subset of a protocol conformance record:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">struct</span> TypeMetadataRecord {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class="">private<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">:</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>// Some description of the type that is resolvable at runtime.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(187, 44, 162);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>union<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> {</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>/// A direct reference to the metadata.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> RelativeIndirectablePointer<Metadata> DirectType;</div><p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> <br class="webkit-block-placeholder"></p><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>/// An indirect reference to the metadata.</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> RelativeIndirectablePointer<<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> ClassMetadata *> IndirectClass;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""> };</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> <span style="color: rgb(0, 132, 0);" class="">/// Flags describing the type metadata record.</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> TypeMetadataRecordFlags Flags;</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div class=""><br class=""></div><div class="">Otherwise the implementation is pretty similar. They are emitted in irgen::emitXXXMetadata. Mappings for generic types are at runtime when swift_getGenericMetadata() is called.</div><div class=""><br class=""></div><div class="">It seems to work OK and removes the limitation that the conformance table approach had, where one could only resolve the names of types with explicit protocol conformances.</div></div><div class=""><br class=""></div><div class="">Haven’t tested on Linux yet.</div><div class=""><br class=""></div>— Luke<div class=""></div></body></html>