[swift-dev] Reconsidering the global uniqueness of type metadata and protocol conformance instances
jgroff at apple.com
Fri Jul 28 18:37:48 CDT 2017
> On Jul 28, 2017, at 4:27 PM, Jonathan Hull <jhull at gbis.com> wrote:
> Is there a way to split the difference?
> You would still have a repository of canonical metadata, but you could have another non-unique structure which can be used for most cases without having to go get the canonical version. You could use the non-unique structure to lookup the canonical version when desired, and the structure would contain enough information to create a canonical version lazily the first time it is needed.
> That way, you could just use the non-unique structures… but they could be exchanged for a unique/canonical version (or one can be created) when that really is needed.
> I am a bit out of my depth here, so hopefully this makes at least a little sense...
We could. This is similar to what we already have to do for type metadata from types that got imported from C. Since there's no canonical place for a C type's metadata to live, each binary that needs the type's metadata emits a candidate with the type name, and the runtime chooses one (currently, the first one that asks) to be the canonical type. We could do something similar with some or all metadata.
More information about the swift-dev