Граф коммитов

15793 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 3a8b988563
Apply suggestions from code review
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Ivan Povazan <55002338+ivanpovazan@users.noreply.github.com>
2023-05-15 15:16:39 +02:00
Rolf Bjarne Kvinge 00de70eb8f
[ServiceManagement] Bind this framework. Fixes #18084. (#18263)
Fixes https://github.com/xamarin/xamarin-macios/issues/18084.
2023-05-12 15:40:36 +02:00
Rolf Bjarne Kvinge 8a4d868cbe
[monotouch-test] Adjust the CGEventTest to handle successful tap creation. (#18266)
My mac can tap just fine!
2023-05-12 10:16:30 +02:00
Rolf Bjarne Kvinge dd2252f365 Merge remote-tracking branch 'origin/main' into msr 2023-05-12 08:45:15 +02:00
Rolf Bjarne Kvinge f32c9e149f [tools] Simplify code a little bit. 2023-05-12 08:45:04 +02:00
Rolf Bjarne Kvinge 3da08098fa [dotnet-linker] Don't prefix the exported entry point from an UnmanagedCallersOnly method with an underscore in .NET 8+. 2023-05-12 08:45:04 +02:00
Rolf Bjarne Kvinge b4ea025382 [src] Remove extraneous tab. 2023-05-12 08:45:04 +02:00
Rolf Bjarne Kvinge feebcfaa07
[src] Use NSLog instead of Console.WriteLine in tracing statements. (#18258)
Use NSLog instead of Console.WriteLine for tracing, because this makes it easier to trace what happens during a test run:

* NUnit will capture anything written to Console.Out/Console.Error during a
  test run.
* Nothing will be printed if the process crashes during a test run.
* NSLog statements will be printed as they are executed, which makes it much
  better for figuring out what happened just before a crash when running unit
  tests.
2023-05-12 08:16:48 +02:00
Rolf Bjarne Kvinge 5693250429
Update docs/managed-static-registrar.md
Co-authored-by: Haritha Mohan <harithamohan@microsoft.com>
2023-05-12 08:05:11 +02:00
Rolf Bjarne Kvinge dd64974d6a
Update docs/managed-static-registrar.md
Co-authored-by: Haritha Mohan <harithamohan@microsoft.com>
2023-05-12 08:05:03 +02:00
Rolf Bjarne Kvinge eb526a098e
[bgen] Fix a few nullability warnings. (#18264)
Also make nullability warnings errors, so we don't add any more nullability issues.

Fixes:

	src/bgen/Filters.cs(215,9): warning CS8602: Dereference of a possibly null reference.
	src/bgen/Filters.cs(242,23): warning CS8604: Possible null reference argument for parameter 'str' in 'string StringExtensions.Capitalize(string str)'.
	src/bgen/BindingTouch.cs(528,29): warning CS8604: Possible null reference argument for parameter 'item' in 'bool List<string>.Contains(string item)'.
2023-05-12 07:41:49 +02:00
Rolf Bjarne Kvinge 1cb598e624
[monotouch-test] Adjust ImageCaptioningTest.GetCaption to don't care if we get an error or not. (#18267)
This check is passing a remote url to an API that wants a url to a local file
(file:// url), and this is supposed to fail (it's not a network hiccup if it
fails).

However, sometimes it doesn't fail... for unknown reasons. So instead change
the test's expectations so that it passes whether using a remote url fails
with an error or not.
2023-05-12 07:41:17 +02:00
Rolf Bjarne Kvinge d06209a917
[Foundation] Bind two overloads to create NSUrl instances from file paths. (#18265) 2023-05-12 07:37:36 +02:00
Manuel de la Pena 3bc4dfde9f
[CI] Do not set statuses for artefacts not longer generated or signed. (#18257) 2023-05-11 13:23:28 -04:00
Rolf Bjarne Kvinge 00a822818f [linker] Don't optimize calls to BlockLiteral.SetupBlock in BlockLiteral.CreateBlockForDelegate. 2023-05-11 13:10:31 +02:00
Rolf Bjarne Kvinge 17b2d37227 [tests] Adjust to cope with slightly different errors reported when using the managed static registrar. 2023-05-11 13:10:31 +02:00
Rolf Bjarne Kvinge 4f5fa5e202 [monotouch-test] Use MidiThruConnectionEndpoint instead of MidiCIDeviceIdentification in exported methods.
MidiCIDeviceIdentification isn't blittable ((yet)[1]), so exporting it makes
the AOT compiler complain. Use a different (but blittable) type instead in the
test.

[1]: 03f0a35012
2023-05-11 13:10:31 +02:00
Rolf Bjarne Kvinge eb629644af [tests] Update to work with the managed static registrar 2023-05-11 13:10:31 +02:00
Rolf Bjarne Kvinge 1deba2cf61 [tests] Add a check for the managed static registrar 2023-05-11 13:10:31 +02:00
Rolf Bjarne Kvinge a2f5e16fad [tests] Improve the current registrar detection in the tests 2023-05-11 13:10:31 +02:00
Rolf Bjarne Kvinge ed4eb42498 [src] Track selector and method better to provide more helpful error messages.
This commit introduces a few new GetNSObject/GetINativeObject overloads that will
be used by the managed static registrar.
2023-05-11 13:10:31 +02:00
Git History Editor 8f55662002 [registrar] We might link the [Protocol] attribute away, so store it for later reference by the static registrar 2023-05-11 13:10:31 +02:00
Git History Editor b8ccbad871 [src] Add helper methods for the managed static registrar 2023-05-11 13:10:30 +02:00
Git History Editor 9bcc96e171 [static registrar] Implement support for calling the generated UnmanagedCallersOnly method from the managed static registrar 2023-05-11 13:10:30 +02:00
Git History Editor 382ebae8d5 [tools] Add a managed static registrar. Fixes #17324.
This adds a managed static registrar, which is a variation of the static registrar
that takes advantage of a few new features in C# and the runtime, as well as avoiding
metadata tokens, which NativeAOT doesn't support.

This registrar will generate most of the trampoline/interop code as managed code
using Cecil, and the Objective-C part is as small as possible.

Fixes https://github.com/xamarin/xamarin-macios/issues/17324.
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge fb6ed7b770 [runtime] Add an API to look up the native symbol for an [UnmanagedCallersOnly] method.
Add an API to look up the native symbol for an [UnmanagedCallersOnly] method from native code.
2023-05-11 13:10:30 +02:00
Git History Editor cbfc59111b [src] Refactor Class.ResolveToken to take the assembly as a parameter.
This is to make the Class.ResolveToken usable from the managed static registrar.
2023-05-11 13:10:30 +02:00
Git History Editor 4bd045e491 [static registrar] Refactor code to make it easier to reuse code later on. 2023-05-11 13:10:30 +02:00
Git History Editor 4ab321d54c [dotnet-linker] Remove trimmed API from the registered types before generating native code when using the managed static registrar.
When using the managed static registrar, we register types with the static registrar
before the linker does its work, so we need to follow-up after the linker has figured
out what will be trimmed away to remove any such types from the list of registered types.
2023-05-11 13:10:30 +02:00
Git History Editor 72c654e4db [registrar] Refactor code to determine if a method is a property accessor to make it easier to reuse. 2023-05-11 13:10:30 +02:00
Git History Editor 2a40824cad [dotnet-linker] Add a helper class for keeping track of methods and types when emitting IL code with Cecil. 2023-05-11 13:10:30 +02:00
Git History Editor 47eddc568c [dotnet-linker] Add extension methods for making IL emission easier with Cecil. 2023-05-11 13:10:30 +02:00
Git History Editor dc56054d2a [registrar] Add an HasCustomAttribute overload that returns the found attribute (if any) 2023-05-11 13:10:30 +02:00
Git History Editor 53d7bc523e [tools] Move code to compute block signatures to the static registrar.
This makes it easier to use this code from the managed static registrar.
2023-05-11 13:10:30 +02:00
Git History Editor 70a39a70d5 [static registrar] Move token reference creation a little bit later.
It's not needed until later anyway.

This way we can add code for the managed static registrar (which does not need the
token reference, in fact creating a token reference for a method won't be possible
with the managed static registra) in the correct location in the code.
2023-05-11 13:10:30 +02:00
Git History Editor 8f1fb220cb [static registrar] Add support for generating block syntax in Objective-C method signatures.
This is required when generating a cast of a function pointer to an Objective-C method
signature (which the managed static registrar does).
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge 43b88af10a [src] Fix comparison between signed and unsigned int.
Comparing -1 to 0xFFFFFFFF doesn't get the right result otherwise.
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge a1e0e305e5 [registrar] Make some API from the registrar public so that the managed static registrar step can access them.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge e39c6fb1b2 [dotnet-linker] Rearrange registration and generation in the static registrar
The managed static registrar will add code to the processed assemblies, which means
it must run before the trimmer sweeps unused code.

This means we have to split the current registrar logic in two:

1. First we process all the assemblies.
2. Then we write out the results.

When not using the managed static registrar, these two steps happens right after
oneanother (like they do now), while when using the managed static registrar, the
processing is done before the trimmer sweeps (where we'll also generate all the new
IL code), and then the generated native code will be done at the end of the build
process (like for the old-school static registrar).
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge 57d40d9cf1 [dotnet-linker] Don't do anything in ManagedRegistrarStep unless the current registrar mode is 'ManagedStatic'. 2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge bf639a99d7 [dotnet-linker] Add the scaffolding for a ManagedRegistrarStep and a ManagedRegistrarLookupTablesStep. 2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 34264cd98f [dotnet] Add an 'IsManagedStaticRegistrar' feature to the linker.
This way we can ask the linker to inline the Runtime.IsManagedStaticRegistrar property, and remove any dead code paths.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge cfb248ecac [tools] Add a ManagedStatic registrar mode.
This new mode is still considered a 'Static' registrar mode, it's just a variation of it.
2023-05-11 12:21:53 +02:00
Git History Editor a1410ac7fa [static registrar] Refactor code to make it easier to reuse code later on.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge e66f82d5fc [static registrar] Refactor code to make it easier to reuse code later on.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 872af5d9e1 [static registrar] Refactor code to make it easier to reuse code later on.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 3ac9b8fc76 [xharness] Add new variations using the managed static registrar for monotouch-test. 2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 4351674beb [dotnet-linker] Add a way for ConfigurationAwareStep subclasses to return exceptions.
Without having to throw them.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge eb01507dd6 [dotnet-linker] Unify exception handling to go through the LinkerConfiguration.Report method.
Since LinkerConfiguration.Report uses the trimmer's API to report warnings and errors.
2023-05-11 12:16:48 +02:00
Rolf Bjarne Kvinge 9e112978fd [dotnet-linker] Don't fail trimming if all the exceptions we collect are warnings. 2023-05-11 12:16:48 +02:00