Uh oh!
There was an error while loading. Please reload this page.
[nativeaot] introduce Microsoft.Android.Runtime.NativeAOT.dll - #9760
Conversation
Uh oh!
There was an error while loading. Please reload this page.
6532402 to
cc63af6CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cc63af6 to
4edc889CompareUh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
4edc889 to
de37e06Comparejonathanpeppers
commented
Feb 7, 2025
jonathanpeppers
commented
Feb 10, 2025
There are some APK test failures, but look network-related: |
Uh oh!
There was an error while loading. Please reload this page.
| public NativeAotTypeManager () | ||
| { | ||
| AndroidLog.Print (AndroidLogLevel.Info, "NativeAotTypeManager", $"# jonp: NativeAotTypeManager()"); | ||
| InitializeTypeMappings (); |
There was a problem hiding this comment.
This likewise should be in the static constructor.
Alternatively, TypeMappings should be an instance field.
There was a problem hiding this comment.
I made it an instance field, as I think it makes more sense for the instance of the *TypeManager to hold its typemap.
Uh oh!
There was an error while loading. Please reload this page.
Draft commit message: This moves:
* C# code from `samples/NativeAOT` to a new assembly,
`Microsoft.Android.Runtime.NativeAOT.dll`.
* Java code from `samples/NativeAOT` to
`Xamarin.Android.Build.Tasks`, to be generated at build time.
* C# code from `Java.Interop.Environment.csproj` has been trimmed
down, copied into `Microsoft.Android.Runtime.NativeAOT.dll`.
* Minimum Viable Product™ "typemap" implementation.
* Change namespace to `Microsoft.Android.Runtime`## Minimum Viable Product™ typemaps
A quick-and-dirty -- and totally unoptimized -- typemap implementation
has been added as a new `TypeMappingStep` into
`Microsoft.Android.Sdk.ILLink`.
Given this initial starting point within `NativeAotTypeManager`:
partial class NativeAotTypeManager { IDictionary<string, Type> TypeMappings = new Dictionary<string, Type>(StringComparer.Ordinal); NativeAotTypeManager () { InitializeTypeMappings (); } void InitializeTypeMappings () { throw new InvalidOperationException ("Should be replaced at build time!"); }}
then at build time `TypeMappingStep` will *replace* the body of
`NativeAotTypeManager.InitializeTypeMappings()` with repeated
`IDictionary<string, Type>.Add()` calls for each type which survived
linking:
// Cecil-generated code, C# equivalentvoid InitializeTypeMappings (){ TypeMappings.Add ("java/lang/Object", typeof (Java.Lang.Object)); TypeMappings.Add ("android/app/Application", typeof (Android.App.Application)); // …} |
This moves: * C# code from `samples/NativeAOT` to a new assembly, `Microsoft.Android.Runtime.NativeAOT.dll`. * Java code from `samples/NativeAOT` to `Xamarin.Android.Build.Tasks`, to be generated at build time. * C# code from `Java.Interop.Environment.csproj` has been trimmed down and moved to `Microsoft.Android.Runtime.NativeAOT.dll` as well.
Remove some unused code as well
00edfbd to
d989734Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Requires `Ldarg_0` on stack, then `Ldfld` instead of `Ldsfld`.
This will be of interest if/when we start investigating alternate typemap initialization ideas.

This moves:
C# code from
samples/NativeAOTto a new assembly,Microsoft.Android.Runtime.NativeAOT.dll.Java code from
samples/NativeAOTtoXamarin.Android.Build.Tasks, to be generated at build time.C# code from
Java.Interop.Environment.csprojhas been trimmed down and moved toMicrosoft.Android.Runtime.NativeAOT.dllas well.A new
TypeMappingStepimplements the simplest MVP for a "typemap", replacing theNativeAotTypeManager.InitializeTypeMappings()method.