-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Introduce CallConvSwift and special register types to represent the Swift ABI calling convention #95065
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
Introduce CallConvSwift and special register types to represent the Swift ABI calling convention #95065
Conversation
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
|
Tagging subscribers to this area: @dotnet/interop-contrib Issue DetailsDescriptionBased on the design doc, this PR introduces types to represent each of the special registers. The Swift programming language has a different ABI, runtime environment, and object model. According to the calling convention, the self context has dedicated registers, and it is always passed through them since it's heavily used. Methods calling other methods on the same object can share the self context. Errors are also handled through registers, so the caller needs to check for errors and throw if necessary. Implementing P/Invoke thunks should simplify registers juggling by using predefined set of registers in these scenarios. We need approval for the #64215 before merging this PR.
|
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CallingConventions.cs
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CallingConventions.cs
Show resolved
Hide resolved
…erServices/CallingConventions.cs Co-authored-by: Aaron Robinson <[email protected]>
…erServices/CallingConventions.cs Co-authored-by: Aaron Robinson <[email protected]>
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Swift/SwiftTypes.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Swift/SwiftTypes.cs
Outdated
Show resolved
Hide resolved
…pServices/Swift/SwiftTypes.cs Co-authored-by: Aaron Robinson <[email protected]>
…pServices/Swift/SwiftTypes.cs Co-authored-by: Aaron Robinson <[email protected]>
|
@AaronRobinsonMSFT please sign off on this from the Interop side. |
|
@kotlarmilos Note that unless @jkoritzinsky specifically asks for my sign-off, his review is sufficient for any interop related PRs. I do appreciate your dilligence in getting all the stakeholders involved though. Thanks! |
…wift ABI calling convention (dotnet#95065) * Add CallConvSwift attribute and introduce types to represent each of the special registers --------- Co-authored-by: Aaron Robinson <[email protected]>
Description
Based on the design doc, this PR introduces types to represent each of the special registers.
The Swift programming language has a different ABI, runtime environment, and object model. According to the calling convention, the self context has dedicated registers, and it is always passed through them since it's heavily used. Methods calling other methods on the same object can share the self context. Errors are also handled through registers, so the caller needs to check for errors and throw if necessary. Implementing P/Invoke thunks should simplify registers juggling by using predefined set of registers in these scenarios.
The Mono runtime currently does not compile native wrappers with the LLVM backend. However, support for LLVM is essential for handling scenarios involving
UnmanagedCallersOnly, where Swift code calls into C#. The implementation of LLVM support will be addressed in a subsequent PRs.We need approval for the #64215 before merging this PR.
Fixes #64215