mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement dependent layouts for raw types
Update raw_layout.swift Allow for concrete specializations of raw layout Make test platform agnostic
This commit is contained in:
@@ -2905,6 +2905,35 @@ metadata:
|
||||
}
|
||||
}
|
||||
|
||||
/// Initialize the value witness table for a @_rawLayout struct.
|
||||
SWIFT_RUNTIME_EXPORT
|
||||
void swift::swift_initRawStructMetadata(StructMetadata *structType,
|
||||
StructLayoutFlags layoutFlags,
|
||||
const TypeLayout *likeTypeLayout,
|
||||
size_t count) {
|
||||
auto vwtable = getMutableVWTableForInit(structType, layoutFlags);
|
||||
|
||||
// The existing vwt function entries are all fine to preserve, the only thing
|
||||
// we need to initialize is the actual type layout.
|
||||
auto size = likeTypeLayout->size;
|
||||
auto stride = likeTypeLayout->stride;
|
||||
auto alignMask = likeTypeLayout->flags.getAlignmentMask();
|
||||
auto extraInhabitantCount = likeTypeLayout->extraInhabitantCount;
|
||||
|
||||
// If our count is greater than or equal 0, we're dealing an array like layout.
|
||||
if (count >= 0) {
|
||||
stride *= count;
|
||||
size = stride;
|
||||
}
|
||||
|
||||
vwtable->size = size;
|
||||
vwtable->stride = stride;
|
||||
vwtable->flags = ValueWitnessFlags()
|
||||
.withAlignmentMask(alignMask)
|
||||
.withCopyable(false);
|
||||
vwtable->extraInhabitantCount = extraInhabitantCount;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
/*** Classes ***************************************************************/
|
||||
/***************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user