-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Ensure that BridgedTypeArray is indirectly returned #76433
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
Conversation
On Windows ARM64, how a struct value type is returned is sensitive to conditions including whether a user-defined constructor exists, etc. See https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values That caused a calling convention mismatch between the non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++) side and a crash. Add this constructor so that the calling convention matches. This is a fix for the OnoneSimplification crash in swiftlang#74866 (comment) and is a partial fix for swiftlang#74866 (comment)
@swift-ci please test |
Excellent detective work tracking down this issue. I expect this is going to affect pretty much any C++ class type that we bridge over to Swift, so the risk of regressing here is fairly high. Can we think of any way to make sure that these types are handled uniformly, even if it's just fixing them all and documenting the pattern so we know what to do in the future (and why)? |
Yeah, a very good point! I'm curious why we need to use I also wonder if there is a way to statically force this constraint (struct is indirectly returned as value) using If there are no alternative solution, I'd at least vote for the low-tech approach of "just fixing them all and documenting the pattern so we know what to do in the future (and why)". If that requires a lot of manual editing, I'd be happy to help with that (or I may just end up doing that :) |
@swift-ci please test macOS platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Please feel free to merge. Do we also need this for 6.0?
Thanks. Merged! Yes, I think 6.0 also needs this because SwiftCompilerSources is enabled on 6.0 for all OSes/CPUs including Windows ARM64. Unless the alternative seems better, I'd like to defer cherrypicking this to 6.0 until SwiftCompilerSources becomes fully functional (that is, #74866 is resolved) |
I agree that it makes sense to defer cherry-picking until we have all of the changes needed to make it fully functional |
This is the "PURE" bridging mode. To workaround some problems with C++ interop. See #69039. |
On Windows ARM64, how a struct value type is returned is sensitive to conditions including whether a user-defined constructor exists, etc. See https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values That caused a calling convention mismatch between the non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++) side and a crash. Following swiftlang#76433 add constructors to several bridged C++ struct/class types so that the calling convention matches. This is a partial fix for swiftlang#74866
On Windows ARM64, how a struct value type is returned is sensitive to conditions including whether a user-defined constructor exists, etc. See https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values That caused a calling convention mismatch between the non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++) side and a crash. Following swiftlang#76433 add constructors to several bridged C++ struct/class types so that the calling convention matches. This is a partial fix for swiftlang#74866 Cherrypick swiftlang#76589
On Windows ARM64, how a struct value type is returned is sensitive to conditions including whether a user-defined constructor exists, etc. See https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values That caused a calling convention mismatch between the non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++) side and a crash. Add this constructor so that the calling convention matches. This is a fix for the OnoneSimplification crash in and is a partial fix for Cherrypick swiftlang#76433
On Windows ARM64, how a struct value type is returned is sensitive to conditions including whether a user-defined constructor exists, etc. See https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values That caused a calling convention mismatch between the non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++) side and a crash. Following swiftlang#76433 add constructors to several bridged C++ struct/class types so that the calling convention matches. This is a partial fix for swiftlang#74866 Cherrypick swiftlang#76589
On Windows ARM64, how a struct value type is returned is sensitive to conditions including whether a user-defined constructor exists, etc. See
https://learn.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=msvc-170#return-values
That caused a calling convention mismatch between the non-USED_IN_CPP_SOURCE (Swift) side and the USE_IN_CPP_SOURCE (C++) side and a crash.
Add this constructor so that the calling convention matches.
This is a fix for the OnoneSimplification crash in
#74866 (comment)
and is a partial fix for
#74866 (comment)