-
Notifications
You must be signed in to change notification settings - Fork 517
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
[Rgen] Add the needed code to make the objc_msgSend signatures. #22029
base: main
Are you sure you want to change the base?
Conversation
Add the code that will calculate the signature needed in the objc_msgSend which will be the method that calls the native objc message.
|
|
2a80edc
to
6ad32da
Compare
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.
Copilot reviewed 5 out of 18 changed files in this pull request and generated 6 comments.
Files not reviewed (13)
- src/rgen/Microsoft.Macios.Transformer/Microsoft.Macios.Transformer.csproj: Language not supported
- src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfoComparer.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/Formatters/TypeInfoFormatter.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.Generator.cs: Evaluated as low risk
- tests/rgen/Microsoft.Macios.Generator.Tests/TestDataFactory.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.Dlfcn.cs: Evaluated as low risk
- tests/rgen/Microsoft.Macios.Generator.Tests/DataModel/TypeInfoComparerTests.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/Formatters/ParameterFormatter.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/DataModel/Property.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/DataModel/TypeInfo.cs: Evaluated as low risk
- src/rgen/Microsoft.Macios.Generator/Extensions/SpecialTypeExtensions.cs: Evaluated as low risk
- tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/GetObjCMessageSendMethodNameTests.cs: Evaluated as low risk
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.ObjCRuntime.cs
Outdated
Show resolved
Hide resolved
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.ObjCRuntime.cs
Outdated
Show resolved
Hide resolved
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.ObjCRuntime.cs
Outdated
Show resolved
Hide resolved
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.ObjCRuntime.cs
Outdated
Show resolved
Hide resolved
src/rgen/Microsoft.Macios.Generator/Extensions/EnumExtensions.cs
Outdated
Show resolved
Hide resolved
src/rgen/Microsoft.Macios.Generator/Extensions/EnumExtensions.cs
Outdated
Show resolved
Hide resolved
|
Co-authored-by: Copilot <[email protected]>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commit.NET ( No breaking changes )❗ API diff vs stable (Breaking changes).NET ( ❗ Breaking changes ❗ )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build] Windows Integration Tests passed 💻✅ All Windows Integration Tests passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 2 tests failed, 113 tests passed. Failures❌ generator tests
Html Report (VSDrops) Download ❌ monotouch tests (macOS)
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Add the code that will calculate the signature needed in the objc_msgSend which will be the method that calls the native objc message.
Extra context
When we create a binding for a native type we need to be able to send 'messages' to the objc objects. From a C# developer perspective a message can be considered a method. So for example, the following objc code:
[object foo:bar];
Can be translated to:
We can say this process is similar to reflection and the Invoke method. Our bindings provide methods around objc_msgsend which we use to send the messaged with the arguments needed by the message. For example, a property with a NSString backing fields defined as:
Results in the following generated code:
Our objc_msgSend method signatures are calculated based on the method parameters and live in the runtime. These objc_msgSend calls are generated by https://github.com/xamarin/xamarin-macios/blob/main/runtime/bindings-generator.cs#L20 For example a objc_msgSend signature for a method that takes a string and returns a string would be:
IntPtr_objc_msgSend_IntPtr
But this is a simplifications because there is a diff between sending a message to a super class (prefix super) or if it deals with a structure (stret).
More info can be found in the Apple documentation.