Generate table of protocols and their corresponding wrapper type in the static
registrar, so that we don't have to look for this information using the
dynamic registrar at runtime.
Fix warning about ignored optimizations to include 'register-protocols', since
it has conditions not in other optimizations (both the static registrar and
the linker must be enabled).
Make the generated static registrar code implement protocols from [Adopts]
attributes, so that we can just query the ObjC runtime to see if a type
implements a protocol instead of keeping this information around ourselves.
There's only one static registrar now, so there's no need for code to select
which one, just create the one and only.
Also unify this code between mtouch and mmp.
Bindings trying to override members with that attribute would produce a
```
error BI1055: bgen: Internal error: failed to convert type 'ObjCRuntime.RequiresSuperAttribute, Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'. Please file a bug report (https://bugzilla.xamarin.com) with a test case.
```
Fixes https://github.com/xamarin/maccore/issues/632
This reverts commit 95d1968856.
Unfortunately with this commit our build fails with
```
[5:06:58] GEN XamMac.CFNetwork.xml
[5:06:58] install: ../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.xml: No such file or directory
[5:06:58] install: ../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.CFNetwork.xml: No such file or directory
[5:06:58] make[6]: *** [../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.xml] Error 71
[5:06:58] make[6]: *** Waiting for unfinished jobs....
[5:06:58] make[6]: *** [../../../../xamarin-macios/external/macios-binaries/docs/macOS/classic/XamMac.CFNetwork.xml] Error 71
```
* [ObjCRuntime] Add support for getting the native ObjC class for a given System.Type without using the dynamic registrar.
* The static registrar now generates a table of any types that skipped
registration (which is currently used for generic types, such as
`NSArray<T>`), that allows us to look up the corresponding native type.
* In Runtime.Class now look in the tables generated by the static registrar to
find the native ObjC class for any given System.Type.
* Store the results in a dictionary so that the lookup isn't slower than
before (in fact it's ~4x faster now).
* [registrar] Elevate debug spew into a proper error.
* [registrar] Don't process 64bit-only skipped types on 32-bits.
This also requires fixing the registrar's parsing of the new [iOS] and [Mac]
availability attributes
Those were missed because xtro did not scan ObjC categories for
`objc_requires_super` attributes.
Fixing the naming mapping (to consider inlined categories) also
uncovered a few API with extraneous [DesignatedInitializer] attributes
Those were deprecated (API) and moved into categories so xtro missed
the designated initializer was removed.
All your `base`, well `super` in ObjC, now belong to us :)
https://github.com/xamarin/xamarin-macios/issues/3253
* [tests][xammac] Fix a few path calculations to not be hardcoded.
* [xharness] Clone XM projects.
Cloning projects before building them will also clone project references,
which will make it possible to build multiple projects in parallel, when those
projects have common project references.
Fixes https://github.com/xamarin/maccore/issues/624.
* [xharness] Fix XM project cloning
* Don't clone Classic projects (they're solutions, and xharness doesn't understand them).
* Clonee projects properly when cloning execution tasks.
* [xharness] GuiUnit needs specialized cloning.
The GuiUnit project uses relative paths to write to files outside the project
directory, which means that multiple GuiUnit project files may write to the
same location.
So special-case GuiUnit cloning to make those paths subdirectories of the
project's directory instead.
* [xharness] Process imported targets when cloning projects.
Also make the msbuild-mac's custom targets file independent of the location of
the project file by making all paths relative to the custom targets file.
Two constants with `__IPHONE_NA` were changed to `__IPHONE_11_3`.
Also decorate with [TV] and [Watch] attributes since they are implicit,
i.e. not in the headers but available in tvOS 11.3+ and WatchOS 4.3+
and, without our attributes, would seems to have been available much
earlier
Now that we don't use pmcs anymore, VSfM can actually understand our source code.
So in order to make the editing experience in VSfM better:
* Include all the source files in the csprojs.
* Make sure to not build into the same directories as the normal build
process, since the csproj don't build the official version of the
assemblies.
* Misc other fixes to make it all build.
* [linker] Optimize calls to BlockLiteral.SetupBlock to inject the block signature.
Optimize calls to BlockLiteral.SetupBlock[Unsafe] to calculate the block
signature at build time, and inject it into the call site.
This makes block invocations 10-15x faster (I've added tests that asserts at
least an 8x increase).
It's also required in order to be able to remove the dynamic registrar code in
the future (since calculating the block signature at runtime requires the
dynamic registrar).
* [mtouch/mmp] Add support for reporting errors/warnings that point to the code line causing the error/warning.
Add support for reporting errors/warnings that point to the code line causing
the error/warning by adding ErrorHelper overloads that take the exact
instruction to report (previously we defaulted to the first line/instruction
in a method).
* [tests] Add support for asserting filename/linenumber in warning messages.
* Make all methods that manually create BlockLiterals optimizable.
* [tests] Create a BaseOptimizeGeneratedCodeTest test that's included in both XI's and XM's link all test.
* [tests] Add link all test (for both XI and XM) to test the BlockLiteral.SetupBlock optimization.
* [tests] Add mtouch/mmp tests for the BlockLiteral.SetupBlock optimization.
* [tests][linker] Make the base test class abstract, so tests in the base class aren't executed twice.
* [tests][linker] Don't execute linkall-only tests in linksdk.
The optimization tests only apply when the test assembly is linked, and that
only happens in linkall, so exclude those tests in linksdk.
* [tests][mmptest] Update test according to mmp changes.
Fixes these test failures:
1) Failed : Xamarin.MMP.Tests.MMPTests.MM0132("inline-runtime-arch")
The warning 'MM0132: Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.' was not found in the output:
Message #1 did not match:
actual: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
expected: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
Message #2 did not match:
actual: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
expected: 'Unknown optimization: 'inline-runtime-arch'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
2) Failed : Xamarin.MMP.Tests.MMPTests.MM0132("foo")
The warning 'MM0132: Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.' was not found in the output:
Message #1 did not match:
actual: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
expected: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
Message #2 did not match:
actual: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size, blockliteral-setupblock.'
expected: 'Unknown optimization: 'foo'. Valid optimizations are: remove-uithread-checks, dead-code-elimination, inline-isdirectbinding, inline-intptr-size.'
* [tests][linker] Fix typo.
Fixes this test failure:
1) SetupBlock_CustomDelegate (Linker.Shared.BaseOptimizeGeneratedCodeTest.SetupBlock_CustomDelegate)
Counter
Expected: 1
But was: 2
* [registrar] Minor adjustment to error message to match previous (and better) behavior.
Fixes this test failure:
1) Failed : Xamarin.Registrar.GenericType_WithInvalidParameterTypes
The error 'MT4136: The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<U>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)'' was not found in the output:
Message #1 did not match:
actual: 'The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<Foundation.NSObject>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)''
expected: 'The registrar cannot marshal the parameter type 'System.Collections.Generic.List`1<U>' of the parameter 'arg' in the method 'Open`1.Bar(System.Collections.Generic.List`1<U>)''
* [docs] mmp shows MM errors/warnings.
* [docs] Improve according to reviews.
* [tests] Fix merge failure causing test duplication.