-
Notifications
You must be signed in to change notification settings - Fork 542
[RGen] Generate the aux BlockLiteral pointer variable for the trampolines. #23078
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
We are not yet fully doing the convesions needed for a block callback in the native invoker call. We need the following: ```csharp [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] unsafe global::AudioUnit.AudioUnitStatus Invoke (ref global::AudioUnit.AudioUnitRenderActionFlags actionFlags, ref global::AudioToolbox.AudioTimeStamp timestamp, uint frameCount, nint outputBusNumber, global::AudioToolbox.AudioBuffers outputData, [BlockProxy (typeof (ObjCRuntime.Trampolines.NIDAURenderPullInputBlock))]global::AudioUnit.AURenderPullInputBlock? pullInputBlock) { var outputData__handle__ = outputData.GetHandle (); using var block_pullInputBlock = Trampolines.SDAURenderPullInputBlock.CreateNullableBlock (pullInputBlock); BlockLiteral *block_ptr_pullInputBlock = null; if (pullInputBlock is not null) block_ptr_pullInputBlock = &block_pullInputBlock; var ret = (AudioUnitStatus) invoker (BlockPointer, (AudioUnitRenderActionFlags*) global::System.Runtime.CompilerServices.Unsafe.AsPointer<AudioUnitRenderActionFlags> (ref actionFlags), (global::AudioToolbox.AudioTimeStamp*) global::System.Runtime.CompilerServices.Unsafe.AsPointer<global::AudioToolbox.AudioTimeStamp> (ref timestamp), frameCount, outputBusNumber, outputData__handle__, (IntPtr) block_ptr_pullInputBlock); GC.KeepAlive (outputData); return ret!; } ``` This change adds the declaration of the 'block_pullInputBlock', we will add the assigment in comming PRs to make the reviews easier.
…ines. Generates the creation of a BlockLiteral pointer aux variable that will be used to pass a block callback to the invoker.
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.
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.
Pull Request Overview
This pull request adds functionality to generate an auxiliary BlockLiteral pointer variable for trampolines, enabling the proper handling of block callbacks in the generated code. Key changes include:
- Modifying trampoline test cases to include the BlockLiteral pointer variable.
- Introducing a new test for BlockLiteral auxiliary variable generation in ObjCRuntime.
- Updating generator logic to produce both the nullable block and its corresponding pointer variable.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs | Updates test expecting the new block pointer variable. |
tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryObjCRuntimeTests.cs | Adds a test for the generated BlockLiteral auxiliary variable. |
tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/ExpectedTrampolinePropertyTestsTrampolines.cs | Updates expected declarations to verify pointer variable generation. |
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.Trampoline.cs | Modifies trampoline generation logic to include the BlockLiteral auxiliary variable. |
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.ObjCRuntime.cs | Introduces a helper to generate a BlockLiteral pointer variable with proper documentation. |
SyntaxKind.NullLiteralExpression)))), | ||
PrefixUnaryExpression ( | ||
SyntaxKind.AddressOfExpression, | ||
IdentifierName (blockVariableName!)), |
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.
Avoid using the null-forgiving operator '!' when accessing blockVariableName in this context. Ensure that blockVariableName is non-null before usage or adjust the logic so that the '!' operator is not needed.
IdentifierName (blockVariableName!)), | |
IdentifierName (blockVariableName)), |
Copilot uses AI. Check for mistakes.
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 #c94d900] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [CI Build #817d581] Build passed (Build packages) ✅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.
✅ API diff for current PR / commit.NET ( No breaking changes )✅ API diff vs stable.NET ( No breaking changes )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #817d581] 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.
💻 [CI Build #817d581] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #817d581] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #817d581] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #817d581] 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 #c94d900] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 119 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Failing tests are unrelated to code changes. |
Generates the creation of a BlockLiteral pointer aux variable that will be used to pass a block callback to the invoker.