Commit 25b7c27
authored
[Mono.Android] add "built-in" delegate for _JniMarshal_PPII_L (#8245)
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.1 parent 569b7c0 commit 25b7c27
File tree
2 files changed
+24
-1
lines changed- src/Mono.Android/Android.Runtime
2 files changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
161 | 176 | | |
162 | 177 | | |
163 | 178 | | |
| |||
473 | 488 | | |
474 | 489 | | |
475 | 490 | | |
| 491 | + | |
| 492 | + | |
476 | 493 | | |
477 | 494 | | |
478 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| |||
271 | 277 | | |
272 | 278 | | |
273 | 279 | | |
274 | | - | |
| 280 | + | |
275 | 281 | | |
276 | 282 | | |
277 | 283 | | |
| |||
0 commit comments