Skip to content

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Aug 13, 2025

Explanation: Fix a compiler crash when emitting outlined value functions for InlineArray<_, Tuple>.

When an InlineArray is handled indirectly (e.g. it has a dynamic layout--via generics, resilient types, or an integer generic size--or it's passed as an argument and is "large") and is copied, destroyed, or released, an outlined value function is emitted for that operation. That function needs access to the types used in the element type of the InlineArray to perform its work. The metadata for such types that can't be discovered within the function (e.g. T) are passed as arguments.

Previously, it happened to get access to them some of the time, but not always, which resulted in compiler crashes when performing value operations on indirect InlineArray<_, Tuple>s. Here, this is fixed by ensuring the metadata required for the element type is passed to the outlined value functions.
Scope: Affects InlineArray.
Issue: rdar://155668963
Original PR: #83683
Risk: Low, just adds a missing override in IRGen's representation of InlineArray. The implementation results in more types being passed to the outline value functions. If the implementation is wrong, it will either be because 1. not all the types required for the function are passed in which case the same style of crash as already happens will occur or 2. more types than are necessary are passed to the function in which case there will be a small code-size cost.
Testing: Added a test.
Reviewer: Dario Rexin ( @drexin )

The metadata of the element type is required for outlining.

rdar://158083136
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review August 14, 2025 00:50
@nate-chandler nate-chandler requested a review from a team as a code owner August 14, 2025 00:50
@nate-chandler nate-chandler merged commit c89bc61 into swiftlang:release/6.2 Aug 27, 2025
5 checks passed
@nate-chandler nate-chandler deleted the cherrypick/release/6.2/rdar158083136 branch August 27, 2025 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants