swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.54k stars 10.35k forks source link

[SR-3722] Lay out of partially-opaque aggregates #46307

Open ec8ba57e-8db4-4a5b-97d9-d3e186c86593 opened 7 years ago

ec8ba57e-8db4-4a5b-97d9-d3e186c86593 commented 7 years ago
Previous ID SR-3722
Radar rdar://problem/31411221
Original Reporter @ematejska
Type Task
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Task, AffectsABI | |Assignee | None | |Priority | Medium | md5: a21fe6ef95bd4b08859b864fa7a24dc9

Issue Description:

This bug is tracking investigating how to most efficiently lay out partially-opaque aggregates before ABI Stability is achieved.

bob-wilson commented 7 years ago

@swift-ci create

atrick commented 7 years ago

The optimizer makes assumptions about layout equivalence. See canUnsafeCastStruct/Tuple/Enum. This code should be centralized in an ABI spec (see SR-3730). But we also need to make sure this code honors resilience boundaries. Currently it just runs over the list of stored properties on the type.

bob-wilson commented 7 years ago

After reviewing this, we have decided not to tackle changes for this in Swift 5. We'll lose some optimization opportunities for fragile generic structs that are published with the old algorithm, but we can still adjust the algorithm for future compiler versions.

bob-wilson commented 7 years ago

By the way, we're tracking any changes to the optimizer's assumptions about layout in rdar://problem/34395744 (to address Andy's comment above).