[Mono.Android] add "built-in" delegate for _JniMarshal_PPII_L#8245
Merged
jonathanpeppers merged 1 commit intodotnet:mainfrom Aug 7, 2023
Merged
Conversation
I noticed some methods appear when creating a new `.aotprofile` for .NET
MAUI:
void System.Reflection.Emit.RuntimeILGenerator:.ctor (System.Reflection.Module,System.Reflection.Emit.ITokenGenerator,int)
void System.Reflection.Emit.RuntimeILGenerator:BeginCatchBlock (System.Type)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,int)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,System.Reflection.Emit.Label)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,System.Reflection.Emit.LocalBuilder)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode,System.Reflection.MethodInfo)
void System.Reflection.Emit.RuntimeILGenerator:Emit (System.Reflection.Emit.OpCode)
We generally don't want S.R.E to run at application startup. This can
happen when `Android.Runtime.JNINativeWrapper:CreateBuiltInDelegate`
doesn't find a match. We fallback to S.R.E in that case.
Running a `dotnet new maui` app w/ .NET 8 Preview 7 logs the message:
08-07 10:01:51.674 16590 16590 D monodroid-assembly: Falling back to System.Reflection.Emit for delegate type '_JniMarshal_PPII_L': IntPtr n_GetClipPath_II(IntPtr, IntPtr, Int32, Int32)
This may also coincide with `AndroidEnableMarshalMethods` being turned
off by default. We would not have seen this log message when it was on.
After this change, we skip the S.R.E code path:
08-07 10:37:23.089 17661 17661 D Mono : AOT NOT FOUND: (wrapper native-to-managed) Android.Runtime.JNINativeWrapper:Wrap_JniMarshal_PPII_L (intptr,intptr,int,int).
We should update the `.aotprofile` in xamarin-android and dotnet/maui
after this change.
To update `JNINativeWrapper.g.tt`:
dotnet tool install -g dotnet-t4
t4 src\Mono.Android\Android.Runtime\JNINativeWrapper.g.tt -o src\Mono.Android\Android.Runtime\JNINativeWrapper.g.cs
Other changes:
* Fixed code formatting, so we don't have empty tabs in output.
jonathanpeppers
commented
Aug 7, 2023
Comment on lines
-274
to
+280
| <#= info.Return != "void" ? "return default;" : "" #> | ||
| <#= info.Return != "void" ? "\t\t\t\treturn default;" : "" #> |
Member
Author
There was a problem hiding this comment.
Without this, the output file had several lines of tabs:
grendello
approved these changes
Aug 7, 2023
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Aug 8, 2023
* main: Bump com.android.tools:r8 from 8.0.40 to 8.1.56 (dotnet#8240) Bump to dotnet/installer@1289a84a55 8.0.100-rc.1.23404.2 (dotnet#8242) [Mono.Android] add "built-in" delegate for _JniMarshal_PPII_L (dotnet#8245) [Mono.Android] Add `PackageInfoFlagsLong` (dotnet#8182)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed some methods appear when creating a new
.aotprofilefor .NET MAUI:We generally don't want S.R.E to run at application startup. This can happen when
Android.Runtime.JNINativeWrapper:CreateBuiltInDelegatedoesn't find a match. We fallback to S.R.E in that case.Running a
dotnet new mauiapp w/ .NET 8 Preview 7 logs the message:This may also coincide with
AndroidEnableMarshalMethodsbeing turned off by default. We would not have seen this log message when it was on.After this change, we skip the S.R.E code path:
We should update the
.aotprofilein xamarin-android and dotnet/maui after this change.To update
JNINativeWrapper.g.tt:Other changes: