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

11 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge b1cd69220f
[runtime] Don't register Runtime.GetGenericMethodFromToken when the managed static registrar is used. (#20144)
It'll never be called from the generated code from the managed static
registrar, so there's no need to register it as a potential callback from
native code.

This makes the linker able to remove the Runtime.GetGenericMethodFromToken
method (and a few other methods as well).

Contributes towards #10405.
2024-02-20 16:47:13 +01:00
Rolf Bjarne Kvinge ae0d5b534e
[perf] [runtime] Optimize startup by using function pointers instead of delegates for our native->managed bridge. (#16702)
Use function pointers to our managed callbacks instead of delegates for the native->managed bridge. This makes execution faster on AOT (because the AOT compiler can just emit the native function address, no need to go through the expensive marshalling machinery).

This involved a few changes to make the managed callbacks only use blittable types in the function signature:

* Use `sbyte` / `int8_t` instead of `bool`.
* Use pointers instead of `out`/`ref` arguments.
* Use `IntPtr` instead of `string` arguments.

The code rarely shows up in timing profiles before the change, and never after. This means that time-wise this doesn't save all that much, because there wasn't much to gain to begin with (but it's still a gain).

Memory-wise, we're now allocation 0,19 MiB less on startup (17,61 MiB vs 17,42 MiB).
2022-11-18 07:59:03 +01:00
Sebastien Pouliot bab6827b8d
[dotnet][linker] Eliminate code that is only required for CoreCLR on iOS and tvOS (#11577)
CoreCLR is being added for macOS only. We can eliminate a lot of recent
code additions (about half a megabyte in the past week) by eliminate code
branches under `if (IsCoreCLR)`.

Unlike handling (non required at runtime) custom attributes the
`ILLink.Substitutions.xml` will vary quite a bit across platforms so we
use a unique file for each platform.
2021-05-18 09:33:41 -04:00
Rolf Bjarne Kvinge 9a643594fb [runtime] Add support for generating managed delegates only for CoreCLR.
However, since our managed code is shared between CoreCLR and MonoVM, the best we
can do is to make these CoreCLR-only delegates .NET-only.
2021-03-25 07:32:32 +01:00
Rolf Bjarne Kvinge 598dbc8ae3
Use pointer-sized GCHandles everywhere. (#10597)
* Convert the GCHandles interface from 32-bit ints to pointer size types

This involves:

* Stop using some bits of the GCHandle to store extra flags, instead add an extra
  field to store those flags.
* Define a INVALID_GCHANDLE constant and use it instead of 0/NULL. This is not
  strictly required, but it makes the code more self-documenting.
* Define a GCHandle type (typedef'ed to void*) and change all variables and parameters
  to use it instead of guint32.
* Use our own xamarin_gchandle_* methods (with pointer-sized types) that wraps
  the mono_gchandle_* embedding API (which uses 32-bit types) everywhere.
* Update managed code (registrars, runtime code, etc) accordingly.

* [runtime] Make debug code compile.

* Fix typo.

* Fix signature of xamarin_create_gchandle.

Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
2021-02-11 08:18:38 +01:00
Rolf Bjarne Kvinge 1c33bff5b3 [runtime] Support automatic GCHandle -> MonoObject* conversion for parameters and return values when calling managed delegates. 2020-05-04 11:22:26 +02:00
Rolf Bjarne Kvinge 44b677599d [runtime] Mark managed callback functions if they're only used in the dynamic registrar.
Mark managed callback functions if they're only used in the dynamic registrar,
and only initialize the corresponding delegate if the dynamic registrar is
available.

This will make it possible for the linker to remove those managed functions if
the dynamic registrar is being removed.
2018-02-15 10:18:32 +01:00
Chris Hamons c0202e0e2b
PMCS Removal (#3197)
You were the preprocessor we wished C# had natively

Removing PMCS requires these changes:
* Remove XamCore from src/
* Remove XamCore from tools/
* Remove XamCore from runtime/
* nint/nuint enum conversion
* _compat_ enum conversion
* NSAction conversion
* Hand fix single API incorrectly converted by PMCS to unbreak compatibility
   - Due to a bug in PMCS, the nuint was incorrectly converted in this API.
   - However, as that ship as sailed, we must "fix" it until XAMCORE_4_0
* Update readme
* Bump macios-binaries
2018-02-05 10:26:29 -05:00
Rolf Bjarne Kvinge 4aea22ef15 [ObjCRuntime] Store a pointer to the initialization options in managed memory. (#1076)
This makes it possible to access the initialization options at a later point
(soon to be used by the registrar).
2016-11-01 12:40:51 +01:00
Rolf Bjarne Kvinge 2d28e24837 [runtime] Handle any exceptions whenever we return from managed code. 2016-06-08 20:05:54 +02:00
Rolf Bjarne Kvinge ac418df815 Build our runtime. 2016-04-24 14:47:24 -04:00