-
Notifications
You must be signed in to change notification settings - Fork 537
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
[nativeaot] introduce Microsoft.Android.Runtime.NativeAOT.dll
#9760
Conversation
src/Microsoft.Android.Runtime.NativeAOT/Android.Runtime.NativeAOT/NativeAotTypeManager.cs
Outdated
Show resolved
Hide resolved
6532402
to
cc63af6
Compare
src/Microsoft.Android.Runtime.NativeAOT/Android.Runtime.NativeAOT/JavaInteropRuntime.cs
Outdated
Show resolved
Hide resolved
cc63af6
to
4edc889
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4edc889
to
de37e06
Compare
There are some APK test failures, but look network-related:
|
src/Microsoft.Android.Runtime.NativeAOT/Android.Runtime.NativeAOT/NativeAotTypeManager.cs
Show resolved
Hide resolved
|
||
public NativeAotTypeManager () | ||
{ | ||
AndroidLog.Print (AndroidLogLevel.Info, "NativeAotTypeManager", $"# jonp: NativeAotTypeManager()"); | ||
InitializeTypeMappings (); |
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.
This likewise should be in the static constructor.
Alternatively, TypeMappings
should be an instance field.
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.
I made it an instance field, as I think it makes more sense for the instance of the *TypeManager
to hold its typemap.
src/Microsoft.Android.Runtime.NativeAOT/Java.Interop/JreRuntime.cs
Outdated
Show resolved
Hide resolved
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# equivalent
void 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
d989734
Compare
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/NativeAOT
to a new assembly,Microsoft.Android.Runtime.NativeAOT.dll
.Java code from
samples/NativeAOT
toXamarin.Android.Build.Tasks
, to be generated at build time.C# code from
Java.Interop.Environment.csproj
has been trimmed down and moved toMicrosoft.Android.Runtime.NativeAOT.dll
as well.A new
TypeMappingStep
implements the simplest MVP for a "typemap", replacing theNativeAotTypeManager.InitializeTypeMappings()
method.