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

25 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 98837dbfd0
[ObjCRuntime] Don't double-retain blocks. (#3717) (#3730)
First there was darkness; no blocks were retained.

Then came the light; and all blocks were retained [1]

Forever.

But all that once is, must one day not be,
and thus the light gave way to darkness,
and blocks were only retained as long as need be [2].

But before there was a balance, there was a crossroad.

In some places the light shone forever,
and all blocks were retained.

In other places there was a balance,
and the light shone only as long as needed.

A desire to unify arose.

Alas, it could not be.

It was a bright and sunny day

When a merge failed [3].

And all blocks were retained. Twice.

Once [here][4] and once [there][5].

For many years we could not see.

Until a dark and rainy night,
when an awareness arose.

And the desire to unify the balance could finally be fulfilled.

[1]: 6efca92acb
[2]: a22f877539
[3]: befa0477cf
[4]: 5158a3c001/src/ObjCRuntime/Runtime.cs (L858)
[5]: 5158a3c001/runtime/runtime.m (L2091)
2018-03-13 19:24:44 +01:00
Rolf Bjarne Kvinge 835f65897f
[static registrar] Optimize creation of delegates for blocks. (#3623) (#3644)
* [static registrar] Optimize creation of delegates for blocks.

Optimize creation of delegates for blocks so that it doesn't require the
dynamic registrar.

This is done by getting the metadata token for the Create method that creates
the delegate, and embed that metadata token in the generated code from the
static registrar.

Also add tests, since this scenario was not covered by tests already.

* [mmptest] Fix test after recent changes.

* [test-libraries] Avoid duplicate symbols.

* [tests] Update according to changes.
2018-03-05 07:41:28 +01:00
Rolf Bjarne Kvinge 961878b80b [tests] Update tests to cope with removal of the dynamic registrar. 2018-02-15 10:24:30 +01:00
Rolf Bjarne Kvinge 97230c28e1
Optimize calls to BlockLiteral.SetupBlock to inject the block signature. (#3391)
* [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.
2018-02-06 07:08:15 +01:00
Rolf Bjarne Kvinge 1a260e542b
[tests] Build the native test library for macOS and create a binding project for it. (#3373)
* [tests] Build the native test library for macOS and create a binding project for it.

Also add the new binding project to the xammac and link all XM test projects,
which allows us to stop excluding tests that require the native library and
the corresponding bindings.

* [tests] Include more tests in xammac_tests.

* [tests] Correctly ignore the ObjC exception tests in release mode.
2018-02-02 11:14:44 +01:00
Sebastien Pouliot 05eb96d0a7 Merge branch 'xcode9' into xcode9-master-merge 2017-09-15 11:05:30 -04:00
Rolf Bjarne Kvinge 9fbfd97a8a [AVFoundation] Use Simd-matrix for API that needs it. (#2679)
This also requires implementing the corresponding matrix (NMatrix4x3).

Fixes this xtro issue:

> !unknown-simd-type-in-signature! OpenTK.Matrix3 AVFoundation.AVCameraCalibrationData::get_GetIntrinsicMatrix(): the native signature has a simd type (matrix_float3x3), while the corresponding managed method is using an incorrect (non-simd) type.
2017-09-13 18:46:06 +02:00
Rolf Bjarne Kvinge 7a674ec490 Tweak the Simd-compatible matrices and vectors (#2668)
* Rename them to be OpenTK.NMatrix# (instead of Simd.MatrixFloat#x#).
* Remove the Vector2 and Vector4 variants, we'll use the OpenTK types instead (but we'll keep the NVector3 variant, since it's not identical to the OpenTK version).
* Update the API to match their OpenTK counterparts better:
    * NMatrix2 and NMatrix3 have a 0-based R#C# scheme for their fields.
    * NMatrix4 has a 1-based M## scheme for its fields (i.e. no change).
2017-09-13 11:08:39 -04:00
Rolf Bjarne Kvinge b80cfee33e [tests] Since libtest.a need ModelIO now, the corresponding LinkWith attributes need to state that too. 2017-09-01 11:14:46 +02:00
Rolf Bjarne Kvinge 788cd94355 [ModelIO] Use the new Simd-compatible matrix types, and deprecate the old API. 2017-08-31 14:03:12 +02:00
Rolf Bjarne Kvinge cee1da96d8 [xharness] Fix project cloning to understand how to build test-libraries. (#2417)
Use a 'TestLibrariesDirectory' property in the project files, which is
rewritten correctly when a project is cloned.
2017-08-03 14:29:14 +02:00
Rolf Bjarne Kvinge f2d0a80699 [runtime] Parameters passed on the stack use at least 8 bytes on x86-64. Fixes #58367. (#2393)
* [runtime] Make debug spew compile.

* [tests] Add test case for bug #58367.

https://bugzilla.xamarin.com/show_bug.cgi?id=58367

* [runtime] Parameters passed on the stack use at least 8 bytes on x86-64. Fixes #58367.

https://bugzilla.xamarin.com/show_bug.cgi?id=58367
2017-08-02 08:26:29 +02:00
Jeffrey Stedfast 6351aef095 [msbuild] Don't define __IOS__ for tvOS binding projects (#2274)
* [msbuild] Don't define __IOS__ for tvOS binding projects

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57764

* minor fixups

* Conditional compilation.
2017-06-30 12:35:48 -04:00
Rolf Bjarne Kvinge 9466ae5080 [registrar] Support 'out' parameters from NULL pointers. Fixes #54919. (#2106)
[registrar] Support 'out' parameters from NULL pointers. Fixes #54919.

Native code doesn't have the 'out' and 'ref' distinction C# has, and passes
NULL around left and right.

So make sure the generated code from the static registrar doesn't write to such NULLs.

https://bugzilla.xamarin.com/show_bug.cgi?id=54919
2017-05-19 12:07:12 +02:00
Rolf Bjarne Kvinge d395e8df59 [tests] Generate some trampoline and registrar tests.
Generate trampoline and registrar tests that tests if a return type requires objc_msgSend or objc_msgSend_stret.

Now it's much easier to test new return types (a single line of code), which
avoids a _lot_ of copy-pasting, and makes sure all the different variations
are tested properly.

These new tests found several bugs, which are fixed in subsequent commits.
2016-10-13 15:10:43 +02:00
Rolf Bjarne Kvinge 516f764ec4 [tests] Add support for building device tests for 32-bit or 64-bit. 2016-10-11 19:52:36 +02:00
Rolf Bjarne Kvinge 5fd5b5ae8c [tests] Remove unused/deprecated variables from project files. 2016-10-11 19:52:35 +02:00
Rolf Bjarne Kvinge 432f7af3ed [tests] Set OutputPath according to Configuration instead of hardcoding it.
This makes c&p a little less error-prone.
2016-10-11 19:52:35 +02:00
Rolf Bjarne Kvinge 0863e412b4 Remove XI/Classic support (#926)
* [tests] Remove Classic SDK tests.

* Remove XI/Classic support.

This also means we can remove support for the legacy registrars.

* [monotouch-test] Remove legacy registrar tests.

* [tests/mtouch] Remove Classic tests (and legacy registrar logic).

* [tests/scripted] Fix tests to reference Xamarin.iOS.dll.
2016-09-30 15:02:17 -04:00
Rolf Bjarne Kvinge 9000e48034 [tests] Remove Classic test projects, and make the Unified test projects the master projects. (#858) 2016-09-21 22:55:10 +02:00
Rolf Bjarne Kvinge f2c1e0e15e [tests] Add explicit reference to System.Core. (#513) 2016-08-01 15:57:15 +02:00
Rolf Bjarne Kvinge 4a714f3c43 Make logic not depend on the checkout directory being named 'xamarin-macios'. (#129) 2016-06-06 12:18:52 +02:00
Rolf Bjarne Kvinge db68e69a1d [runtime] Support binding NSObjects as IntPtr. Fixes #41132. (#103)
Support binding NSObjects as IntPtr. This is usually not
a problem, because when we fetch the ObjC signature for a
method, we usually get the signature as exported by us,
(in which case a parameter bound as 'IntPtr' would be treated
as 'void *' in the dynamic registrar) *except* when the
selector corresponds with a protocol the type implements,
in which case we get the signature as defined in the protocol.

https://bugzilla.xamarin.com/show_bug.cgi?id=41132
2016-05-31 11:58:27 +02:00
Rolf Bjarne Kvinge 1f1f6991a3 Implement support for exception marshalling. 2016-05-17 11:23:48 +02:00
Rolf Bjarne Kvinge 73ddab291c [tests] Add bindings-test. 2016-04-26 17:27:37 -04:00