-
Notifications
You must be signed in to change notification settings - Fork 540
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
[Xamarin.Android.Build.Tasks] make "managed typemap" runtime agnostic #9911
base: main
Are you sure you want to change the base?
Conversation
79061b4
to
32a898f
Compare
if (TypemapImplementation != "llvm-ir") { | ||
Log.LogDebugMessage ($"TypemapImplementation='{TypemapImplementation}' will write an empty native typemap."); | ||
state = new NativeCodeGenState (state.TargetArch, new TypeDefinitionCache (), state.Resolver, [], [], state.Classifier); | ||
} |
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.
Instead of returning early, I made this write the native assembly with a typemap of 0 entries, this prevents the crash at runtime:
03-12 12:36:53.682 29155 29155 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "java_type_count" referenced by "/data/app/~~sPVK03Ot__92Sd7QEgoNXw==/com.companyname.helloandroid-EN9cYvEYQtDuCTIXF_jW0Q==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libmonodroid.so"...
a4a2896
to
5468780
Compare
For NativeAOT, we implemented a "managed" typemap that is trimmer-safe. In order to test its performance characteristics, we can make this typemap useable for Mono and CoreCLR as well: * Move `NativeAotTypeManager`, `NativeAotValueManager`, and `TypeMapping` types to `Mono.Android.dll` * Rename `NativeAot*` to `Managed*` * Add a new private `$(_AndroidTypeMapImplementation)` MSBuild property that can be set to `llvm-ir` or `managed`. * Add a new trimmer feature flag `Android.Runtime.RuntimeFeature.ManagedTypeMap` that when `true` uses the managed typemap on any runtime. I added a test that verifies `dotnet run` succeeds for all typemap implementations. Note that NativeAOT will *only* support the managed typemap.
827ff6b
to
ffef891
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.
Looks ok , what are the benefits of being able to use the managed typemap over the other one?
We want to be able to test the performance of the managed typemap vs the native one. Ideally, we'd do this using the same runtime, so either Mono or CoreCLR. |
For NativeAOT, we implemented a "managed" typemap that is trimmer-safe.
In order to test its performance characteristics, we can make this typemap useable for Mono and CoreCLR as well:
Move
NativeAotTypeManager
,NativeAotValueManager
, andTypeMapping
types toMono.Android.dll
Rename
NativeAot*
toManaged*
Add a new private
$(_AndroidTypeMapImplementation)
MSBuild property that can be set tollvm-ir
ormanaged
.Add a new trimmer feature flag
Microsoft.Android.Runtime.RuntimeFeature.ManagedTypeMap
that whentrue
uses the managed typemap on any runtime.I added a test that verifies
dotnet run
succeeds for all typemap implementations.Note that NativeAOT will only support the managed typemap.