Skip to content

Conversation

kavon
Copy link
Member

@kavon kavon commented Oct 15, 2025

The AvailableValueStore maintains stable spans of SILValues, one span (effectively a MutableArrayRef) per basic block, that is preallocated for performance.

This patch fixes an issue where a pointer to a span is vended from AvailableValueStore::get and that pointer is into storage within a DenseMap, which can reallocate and invalidate all such pointers.

There's no reason to be returning a pointer to a MutableArrayRef, aka AvailableValues, so I've simply stripped off that indirection to fix this issue.

resolves rdar://162440304

The AvailableValueStore maintains stable spans of SILValues,
one span (effectively a MutableArrayRef) per basic block, that
is preallocated for performance.

This patch fixes an issue where _a pointer_ to a span is vended from
`AvailableValueStore::get` and that pointer is into storage within
a DenseMap, which can reallocate and invalidate all such pointers.

There's no reason to be returning a pointer to a MutableArrayRef,
aka AvailableValues, so I've simply stripped off that indirection to
fix this issue.

resolves rdar://162440304
@kavon
Copy link
Member Author

kavon commented Oct 15, 2025

@swift-ci smoke test

@kavon kavon enabled auto-merge October 15, 2025 22:42
@kavon kavon merged commit fe9e01c into swiftlang:main Oct 16, 2025
3 checks passed
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