Hello everyone!
I've been exploring class metadata to extract generic types, and I've noticed something interesting: the TrailingGenericContextObjects
structure has been receiving new objects before the FollowingTrailingObjects
.
This causes a shift in the position of TargetResilientSuperclass
(and other objects), which is needed to calculate the immediateMembersOffset
.
┌───────────────────────────────────────────────────┐
│ Fixed-size portion of ClassDescriptor │
├───────────────────────────────────────────────────┤
│ TrailingGenericContextObjects: │
│ │
│ TargetGenericContextHeaderType │
│ GenericParamDescriptor[] │
│ TargetGenericRequirementDescriptor[] │
│ GenericPackShapeHeader │ <- since 5.9
│ GenericPackShapeDescriptor[] │ <- since 5.9
│ ConditionalInvertibleProtocolSet │ <- since 6.0
│ ConditionalInvertibleProtocolsRequirementCount[] │ <- since 6.0
│ TargetConditionalInvertibleProtocolRequirement[] │ <- since 6.0
│ GenericValueHeader │ <- since 6.1
│ GenericValueDescriptor[] │ <- since 6.1
├───────────────────────────────────────────────────┤
│ Class-specific trailing objects: │
│ │
│ TargetResilientSuperclass │
│ ... │
└───────────────────────────────────────────────────┘
From the perspective of someone working with these structures outside the runtime and compiler, it would be really helpful if the beginning of the descriptor structure remained consistent across versions.
I'm wondering if there might be any interest in stabilizing the layout here by placing new objects at the end of the structure instead?