Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7809] Define layout algorithm for structs #50348

Closed
bob-wilson opened this issue May 31, 2018 · 2 comments
Closed

[SR-7809] Define layout algorithm for structs #50348

bob-wilson opened this issue May 31, 2018 · 2 comments
Labels
affects ABI Flag: Affects ABI compiler The Swift compiler in itself task

Comments

@bob-wilson
Copy link

Previous ID SR-7809
Radar None
Original Reporter @bob-wilson
Type Task
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Task, AffectsABI
Assignee None
Priority Medium

md5: 01ccbf61189cd80b51825928aae40872

Sub-Tasks:

  • SR-3723 Determine if the layout algorithm for structs should layout fields in a different order than declared
  • SR-3724 Evaluate a fully declaration-order-agnostic layout algorithm for structs
  • SR-3912 Decide the cap of alignment for struct layout
  • SR-3725 Determine if struct data members are addressable or bit-packed

relates to:

  • SR-2273 Struct fields are not represented in Swift 3.0 DSYM.
  • SR-1134 LFR: Ability to pack Structs with certain named types (like C / C++)

Issue Description:

The Swift ABI Dashboard (https://swift.org/abi-stability)) currently lists 4 separate issues as part of defining the layout algorithm for structs. I am filing this "umbrella" task to summarize the data layout issues for structs so that we can list only one issue on the dashboard.

Here are the 4 tasks that we have been tracking:

https://bugs.swift.org/browse/SR-3723: Determine if the layout algorithm for structs should layout fields in a different order than declared

https://bugs.swift.org/browse/SR-3724: Evaluate a fully declaration-order-agnostic layout algorithm for structs

https://bugs.swift.org/browse/SR-3725: Determine if struct data members are addressable or bit-packed

https://bugs.swift.org/browse/SR-3912: Decide the cap of alignment for struct layout

@bob-wilson
Copy link
Author

Here is the current status:

SR-3723: This proposal was to reorder fields to avoid wasting space due to padding for alignment. We are not planning to attempt this for Swift 5.

SR-3724: This is similar to SR-3723 but for the different purpose of allowing reordering the fields in the source code without breaking binary compatibility. Since it is so closely related, I resolved it as a duplicate of SR-3723.

SR-3725: We are not planning to implement bit packing for Swift 5. I resolved this one as a duplicate of https://bugs.swift.org/browse/SR-5267.

SR-3912: There is work in progress to cap the alignment of all types at 16 bytes.

Note that we may still make some struct layout changes in future versions of Swift in a way that is ABI compatible. Resilient types are accessed indirectly, so we can change their layouts. We may also be able to make layout changes for fragile types if we introduce a scheme for versioned layouts.

@bob-wilson
Copy link
Author

The remaining work for Swift 5.0 (i.e., SR-3912) is now done. We'll track the other future enhancements separately.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects ABI Flag: Affects ABI compiler The Swift compiler in itself task
Projects
None yet
Development

No branches or pull requests

1 participant