Skip to content

[embedded] Avoid use of a metatype in array implementation for embedded Swift #68614

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

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

kubamracek
Copy link
Contributor

No description provided.

@kubamracek
Copy link
Contributor Author

@swift-ci please test

@kubamracek kubamracek added the embedded Embedded Swift label Sep 19, 2023
@kubamracek
Copy link
Contributor Author

@swift-ci please test macOS platform

@@ -41,9 +41,14 @@ func _allocateUninitializedArray<Element>(_ builtinCount: Builtin.Word)
if count > 0 {
// Doing the actual buffer allocation outside of the array.uninitialized
// semantics function enables stack propagation of the buffer.
let storageType: _ContiguousArrayStorage<Element>.Type
#if !$Embedded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work to sink this down to getContiguousArrayStorageType()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that originally, but the function call that returns a metatype is a problem in embedded Swift. I think we could improve the MandatoryPerfOptimizations to handle that case, but I think I'd like leave that option as a possible follow-up improvement.

@kubamracek kubamracek merged commit d6a8845 into swiftlang:main Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedded Embedded Swift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants