Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,6 @@ stages:

- template: yaml-templates/apk-instrumentation.yaml
parameters:
# TODO: disable LLVM test, see: https://github.com/dotnet/runtime/issues/68914
condition: false
configuration: $(XA.Build.Configuration)
testName: Mono.Android.NET_Tests-AotLlvm
project: tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj
Expand Down
2 changes: 2 additions & 0 deletions src/Mono.Android/Android.App/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
namespace Android.App {

partial class Application {
// NOTE: an explicit .cctor solves startup ordering with JNIEnv.Initialize()
static Application () { }

static Context? _context;
public static Context Context {
Expand Down
4 changes: 4 additions & 0 deletions src/Xamarin.Android.Build.Tasks/Tasks/GetAotAssemblies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public override Task RunTaskAsync ()
} else {
assembly.SetMetadata ("AotArguments", $"asmwriter,temp-path={temp}{aotProfiles}");
}
// NOTE: always disable simd when using LLVM
if (EnableLLVM) {
assembly.SetMetadata ("ProcessArguments", "-O=-simd");
}
}

return Task.CompletedTask;
Expand Down
9 changes: 9 additions & 0 deletions src/profiled-aot/CommonMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
// int.Parse(), int.ToString()
// Culture-aware string comparisons
// ResourceManager
// System.Reflection
// System.Threading.Tasks.Task
// System.Net.Http.HttpClient

// Opt out of this warning, because we actually *want* culture-aware string behavior in the AOT profile
#pragma warning disable CA1310

using System.Reflection;

static class CommonMethods
{
// Returns '200 OK' if the caller wants to set that on the UI
Expand All @@ -26,6 +29,10 @@ public static async Task<string> Invoke()

string someString = AndroidProfiledAot.Resources.Strings.SomeString;

var type = typeof (CommonMethods);
var method = type.GetMethod (nameof (FromReflection), BindingFlags.NonPublic | BindingFlags.Static);
method!.Invoke (null, null);

using var client = new HttpClient();
var send = client.SendAsync (new HttpRequestMessage (HttpMethod.Get, url));
var getstring = client.GetStringAsync (url);
Expand All @@ -34,6 +41,8 @@ public static async Task<string> Invoke()

return text;
}

static void FromReflection () { }
}

#pragma warning restore CA1310
6 changes: 3 additions & 3 deletions src/profiled-aot/android/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ namespace android;
[Activity(Label = "@string/app_name", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle? savedInstanceState)
protected async override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);

_ = CommonMethods.Invoke();

// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);

await CommonMethods.Invoke();
}
}
Binary file modified src/profiled-aot/dotnet.aotprofile
Binary file not shown.
403 changes: 309 additions & 94 deletions src/profiled-aot/dotnet.aotprofile.txt

Large diffs are not rendered by default.