@@ -214,6 +214,66 @@ swift::swift_initEnumMetadataMultiPayload(EnumMetadata *enumType,
214214 vwtable->publishLayout (layout);
215215}
216216
217+ // void
218+ // swift::swift_initEnumMetadataMultiPayloadWithLayoutString(EnumMetadata *enumType,
219+ // EnumLayoutFlags layoutFlags,
220+ // unsigned numPayloads,
221+ // const TypeLayout * const *payloadLayouts) {
222+ // // Accumulate the layout requirements of the payloads.
223+ // size_t payloadSize = 0, alignMask = 0;
224+ // bool isPOD = true, isBT = true;
225+ // for (unsigned i = 0; i < numPayloads; ++i) {
226+ // const TypeLayout *payloadLayout = payloadLayouts[i];
227+ // payloadSize
228+ // = std::max(payloadSize, (size_t)payloadLayout->size);
229+ // alignMask |= payloadLayout->flags.getAlignmentMask();
230+ // isPOD &= payloadLayout->flags.isPOD();
231+ // isBT &= payloadLayout->flags.isBitwiseTakable();
232+ // }
233+
234+ // // Store the max payload size in the metadata.
235+ // assignUnlessEqual(enumType->getPayloadSize(), payloadSize);
236+
237+ // // The total size includes space for the tag.
238+ // auto tagCounts = getEnumTagCounts(payloadSize,
239+ // enumType->getDescription()->getNumEmptyCases(),
240+ // numPayloads);
241+ // unsigned totalSize = payloadSize + tagCounts.numTagBytes;
242+
243+ // // See whether there are extra inhabitants in the tag.
244+ // unsigned numExtraInhabitants = tagCounts.numTagBytes == 4
245+ // ? INT_MAX
246+ // : (1 << (tagCounts.numTagBytes * 8)) - tagCounts.numTags;
247+ // numExtraInhabitants = std::min(numExtraInhabitants,
248+ // unsigned(ValueWitnessFlags::MaxNumExtraInhabitants));
249+
250+ // auto vwtable = getMutableVWTableForInit(enumType, layoutFlags);
251+
252+ // // Set up the layout info in the vwtable.
253+ // auto rawStride = (totalSize + alignMask) & ~alignMask;
254+ // TypeLayout layout{totalSize,
255+ // rawStride == 0 ? 1 : rawStride,
256+ // ValueWitnessFlags()
257+ // .withAlignmentMask(alignMask)
258+ // .withPOD(isPOD)
259+ // .withBitwiseTakable(isBT)
260+ // .withEnumWitnesses(true)
261+ // .withInlineStorage(ValueWitnessTable::isValueInline(
262+ // isBT, totalSize, alignMask + 1)),
263+ // numExtraInhabitants};
264+
265+ // installCommonValueWitnesses(layout, vwtable);
266+
267+ // // Unconditionally overwrite the enum-tag witnesses.
268+ // // The compiler does not generate meaningful enum-tag witnesses for
269+ // // enums in this state.
270+ // vwtable->getEnumTagSinglePayload = swift_getMultiPayloadEnumTagSinglePayload;
271+ // vwtable->storeEnumTagSinglePayload =
272+ // swift_storeMultiPayloadEnumTagSinglePayload;
273+
274+ // vwtable->publishLayout(layout);
275+ // }
276+
217277namespace {
218278struct MultiPayloadLayout {
219279 size_t payloadSize;
0 commit comments