Commits

Slava Pestov committed 3624b1fc6b6
Runtime: Support for resiliently adding protocol requirements with default implementations This is the first patch in a series that will allow new protocol requirements to be added resiliently, with the runtime filling in default implementations in witness tables. First, this adds a new flag to the protocol descriptor indicating that the protocol is resilient. In this case, there are two additional fields, MinimumWitnessTableSizeInWords and DefaultWitnessTableSizeInWords, followed by tail-allocated default witnesses. The swift_getGenericWitnessTable() entry point now fills in the default witnesses from the protocol if the given witness table template is smaller than the expected witness table size. This also changes the layout of instantiated witness tables to move the address point to the end of private data. Previously the private data came after the requirements, but this meant that adding new requirements would require sliding the private data at runtime and accessing it indirectly. It is much simpler to access it from negative offsets instead. I updated IRGen to emit the new metadata, but currently all protocols are flagged as not resilient, and default witnesses are not emitted; this will come in a subsequent patch once some more plumbing is in place. To avoid generating GOT entries for references to protocols defined in the current module, I had to add some hacks to the existing hack for this. I'll hopefully clean this up in a principled manner later.