Skip to content
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

[bgen] Improve performance a little bit when calling functions that return retained objects. #21297

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bgen/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2918,7 +2918,7 @@ void GetReturnsWrappers (MethodInfo mi, MemberInformation minfo, Type declaringT
// protocol support means we can return interfaces and, as far as .NET knows, they might not be NSObject
if (IsProtocolInterface (mi.ReturnType)) {
cast_a = " Runtime.GetINativeObject<" + TypeManager.FormatType (minfo?.type ?? mi.DeclaringType, mi.ReturnType) + "> (";
cast_b = ", false)!";
cast_b = $", {(minfo?.is_return_release == true ? "true" : "false")})!";
} else if (minfo is not null && minfo.is_forced) {
cast_a = " Runtime.GetINativeObject<" + TypeManager.FormatType (minfo.type, mi.ReturnType) + "> (";
cast_b = $", true, {minfo.is_forced_owns})!";
Expand Down Expand Up @@ -3686,7 +3686,7 @@ public void GenerateMethodBody (MemberInformation minfo, MethodInfo mi, string s
if (shouldMarshalNativeExceptions)
print ("Runtime.ThrowException (exception_gchandle);");

if (minfo.is_return_release) {
if (minfo.is_return_release && !IsProtocolInterface (mi.ReturnType)) {

// Make sure we generate the required signature in Messaging only if needed
// bool_objc_msgSendSuper_IntPtr: for respondsToSelector:
Expand Down