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

53 Коммитов

Автор SHA1 Сообщение Дата
Manuel de la Pena af196f1c72
[Runtime] Enable the -Wsign-conversion on trampolines.m files. (#7447)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-15 10:39:38 -05:00
Manuel de la Pena 63ab48e679
[Runtime] Enable the -Wsign-conversion warnings flag and fix some of the warnings. (#7405)
The flag adds a lot (A LOT) of warnings. The diff would be huge and
dangerous to review. We enable the flag and fix file by file.
2019-11-12 15:10:16 -05:00
Manuel de la Pena 2e5b64893f
[Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings. (#7353)
* [Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings.

We want to enable the -Wconversion but that will raise too many warning
for a single commit. We are enabiling one by one the flags included in
-Wconversion so that we have smaller diffs.

-Wshorten-64-to-32 adds warnings when there is a implicit conversion that
loses integer precision. We are moving all the 32 to 64 conversions to
use 64. Expecially since most of the code changed is related with sizes,
legths and params counts that are never going to be negative.


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-11-05 11:00:14 -05:00
Sebastien Pouliot 8f92c3dcdd
[runtime] Merge two identical code paths (#7351) 2019-11-04 08:55:02 -05:00
Sebastien Pouliot e736477377
[runtime] Remove some classic (pre-unified) code that is not used anymore. (#7341) 2019-10-30 20:54:30 -04:00
Manuel de la Pena 8b45260ee4
[Runtime] Ensure that all comparisons between signed and unsigned values are fixed. (#7339)
Enable the -Wsign-compare which will raise issues when a comparison
between signed and unsigned values could produce an incorrect result
and fix all the raised warnings.
2019-10-30 15:58:13 -04:00
Bernhard Urban 04a4c3f2ce
[coop runtime] add a GC transition and relax some GC related assertions (#7036)
* [coop] add missing gc_unsafe transition

    frame #3: 0x02a39fd4 monotouchtest`log_callback(log_domain=0x00000000, log_level="error", message="../../../../../mono/metadata/object.c:1905: Expected GC Unsafe mode but was in STATE_BLOCKING state", fatal=4, user_data=0x00000000) at runtime.m:1251:3
    frame #4: 0x02a03f78 monotouchtest`monoeg_g_logv_nofree(log_domain=0x00000000, log_level=G_LOG_LEVEL_ERROR, format=<unavailable>, args=<unavailable>) at goutput.c:149:2 [opt]
    frame #5: 0x02a03f14 monotouchtest`monoeg_g_logv(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>, args=<unavailable>) at goutput.c:156:10 [opt]
    frame #6: 0x02a03fa8 monotouchtest`monoeg_g_log(log_domain=<unavailable>, log_level=<unavailable>, format=<unavailable>) at goutput.c:165:2 [opt]
    frame #7: 0x029e54f8 monotouchtest`assert_gc_unsafe_mode(file="../../../../../mono/metadata/object.c", lineno=1905) at checked-build.c:396:3 [opt]
    frame #8: 0x0294ef98 monotouchtest`mono_class_vtable_checked(domain=0x16d87b70, klass=0x17bfab98, error=0x19498a08) at object.c:1905:2 [opt]
    frame #9: 0x0298f0dc monotouchtest`get_current_thread_ptr_for_domain(domain=0x16d87b70, thread=0x03f645d0) at threads.c:635:2 [opt]
    frame #10: 0x0298d9dc monotouchtest`mono_thread_current at threads.c:2026:23 [opt]
    frame #11: 0x02992a80 monotouchtest`mono_runtime_set_pending_exception(exc=0x0357e4a0, overwrite=0) at threads.c:5176:23 [opt]
    frame #12: 0x02a3c650 monotouchtest`::xamarin_process_nsexception_using_mode(ns_exception=name: "System.ApplicationException" - reason: "3,14", throwManagedAsDefault=false) at runtime.m:2369:4
    frame #13: 0x02a3c478 monotouchtest`::xamarin_process_nsexception(ns_exception=name: "System.ApplicationException" - reason: "3,14") at runtime.m:2336:2
    frame #14: 0x0270b488 monotouchtest`::xamarin_pinvoke_wrapper_objc_msgSendSuper18(__p__0=0x0357d0f0, __p__1=0x02ad1ef2) at pinvokes.m:5732:4
    frame #15: 0x02a64764 monotouchtest`do_icall(frame=<unavailable>, sig=0x17d70bf0, op=<unavailable>, sp=0x19498fa0, ptr=<unavailable>, save_last_error=0) at interp.c:1947:3 [opt]
    frame #16: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x194991b0, sig=0x17d70bf0, op=547, sp=0x19498fb0, ptr=0x0270b408, save_last_error=0) at interp.c:2037:7 [opt]
    Messaging::void_objc_msgSendSuper @ 396160394 "calli.nat.fast" || frame #17: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x194991b0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    ObjCExceptionTest::InvokeManagedExceptionThrower @ 396160296 "vcall" || frame #18: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499370, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    ExceptionsTest::ManagedExceptionPassthrough @ 396150902 "vcallvirt.fast" || frame #19: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x194994d0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]
    Object::runtime_invoke_direct_void__this__ @ 401347822 "vcall" || frame #20: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x19499588, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    frame #21: 0x02a506f8 monotouchtest`interp_runtime_invoke(method=<unavailable>, obj=0x0357c4f0, params=0x00000000, exc=0x1949965c, error=0x194998b8) at interp.c:1766:2 [opt]
    frame #22: 0x028a739c monotouchtest`mono_jit_runtime_invoke(method=0x17534858, obj=<unavailable>, params=0x00000000, exc=<unavailable>, error=0x194998b8) at mini-runtime.c:3170:12 [opt]
    frame #23: 0x02951cfc monotouchtest`do_runtime_invoke(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:3017:11 [opt]
    frame #24: 0x0294e6d4 monotouchtest`mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, params=<unavailable>, error=<unavailable>) at class-getters.h:24:1 [opt] [artificial]
    frame #25: 0x02955408 monotouchtest`mono_runtime_try_invoke_array(method=0x17534858, obj=0x0357c4f0, params=0x00000000, exc=0x00000000, error=0x194998b8) at object.c:5564:10 [opt]
    frame #26: 0x02905fac monotouchtest`ves_icall_InternalInvoke(method=<unavailable>, this_arg=<unavailable>, params=0x00000000, exc=0x19499f0c) at icall.c:3753:8 [opt]
    frame #27: 0x02a64788 monotouchtest`do_icall(frame=<unavailable>, sig=0x17496978, op=<unavailable>, sp=0x19499d88, ptr=<unavailable>, save_last_error=0) at interp.c:1982:20 [opt]
    frame #28: 0x02a632b8 monotouchtest`do_icall_wrapper(frame=0x19499fb0, sig=0x17496978, op=552, sp=0x19499da0, ptr=0x02905bec, save_last_error=0) at interp.c:2037:7 [opt]
    RuntimeMethodInfo::InternalInvoke @ 400702536 "calli.nat.fast" || frame #29: 0x02a51d5c monotouchtest`interp_exec_method_full(frame=0x19499fb0, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3229:9 [opt]
    RuntimeMethodInfo::Invoke @ 400701852 "call" || frame #30: 0x02a524e8 monotouchtest`interp_exec_method_full(frame=0x1949a110, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3400:4 [opt]
    MethodBase::Invoke @ 400700872 "callvirt.fast" || frame #31: 0x02a521cc monotouchtest`interp_exec_method_full(frame=0x1949a280, context=<unavailable>, clause_args=<unavailable>, error=<unavailable>) at interp.c:3325:4 [opt]

* [coop] relax a couple GC state assertions

* [coop] update doc for enabling GC assertions

* [coop] relax a GC assertion in release trampoline
2019-09-23 22:08:25 +02:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Rolf Bjarne Kvinge 010ae1d2c9
[runtime] Fix usage of objc_msgSend[Super] according to modified headers. (#6865)
It's now required to cast objc_msgSend[Super] to a function of the correct
signature, so let's do that.

Also remove the define that allowed us to use the previous behavior.
2019-08-28 08:05:38 -07:00
Rolf Bjarne Kvinge a073c81c45
[AppKit] Implement [NSView sortSubviewsUsingFunction:context:] (#6485)
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/941421.
2019-07-04 07:30:44 +02:00
Rolf Bjarne Kvinge 801b11c60b [runtime] Implement a different fix for #6258. Fixes #6302.
It turns out 'object_getClass' and '[obj class]' does not return exactly the
same. It seems this would have gone unnoticed (the difference would not be
important), except that it made us run into yet another Objective-C runtime
bug...

So return to the previous behavior (call 'object_getClass'), and instead call
'[obj class]' as well just before to make sure the Class instance we get back
from 'object_getClass' is initialized properly.

Now you may wonder why the return value from '[obj class]' has an effect on
the different return value from 'object_getClass', and the answer is that I
have no idea whatsoever. It works, and that makes me happy.

Fixes https://github.com/xamarin/xamarin-macios/issues/6302.
2019-06-14 19:59:02 +02:00
Rolf Bjarne Kvinge 70844a81df
[runtime] Use '[obj class]' instead of 'object_getClass' to work around an Objective-C runtime bug. Fixes #6258 and #6255. (#6293)
Xcode 11 introduces a bug in the Objective-C runtime that makes the runtime
surface uninitialized Class instances. Using these instances may lead to
crashes. Work around this issue by using a different API to get Class
instances for Objective-C objects, hoping that we won't see uninitialized
Class instances.

Ref: https://trello.com/c/2g7qtnGO/143-fb6153904-classcopyprotocollist-crashes-in-ios-13

Fixes https://github.com/xamarin/xamarin-macios/issues/6258.
Fixes https://github.com/xamarin/xamarin-macios/issues/6255.
2019-06-14 16:33:03 +02:00
Rolf Bjarne Kvinge c97d267faf
[runtime] Implement support for an arm64 dynamic registrar. (#6005)
This is required in order to execute downloaded assemblies (or any other
assembly not known at compile time) on device.
2019-05-07 07:35:39 +02:00
Rolf Bjarne Kvinge 82f288a135
[runtime] Refactor a bit to share code between files. (#6000) 2019-05-06 16:19:56 +02:00
Rolf Bjarne Kvinge 4be637aa8e
[registrar] Fix marshalling of structs with a single member. (#5986) 2019-05-06 07:26:54 +02:00
Rolf Bjarne Kvinge 84b99d85e5 [registrar] Reuse some more array conversion code from the static registrar. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 8fee355aa5 [runtime] Add support for value types to xamarin_convert_managed_to_nsarray_with_func/xamarin_convert_nsarray_to_managed_with_func. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 045945817b [registrar] Extract code to create a managed array from an NSArray to a separate method. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 2cb20de784 [registrar] Extract code to create an NSArray from a managed array to a separate method. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge d9c0d5e93a [runtime] Report which element failed to convert when marshalling an array between Objective-C and managed code. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 8b0f3c80d8 [registrar] Create a xamarin_string_to_nsstring function to avoid code duplication. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 10d7d1c26f [runtime] Use a 'void*' for the context in conversion functions instead of 'guint32'.
No function changes, just a refactoring to allow for pointers as context.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 1f7cdecd3d [registrar] Reuse some more array conversion code from the static registrar. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 4a82341c91 [runtime] Add support for value types to xamarin_convert_managed_to_nsarray_with_func/xamarin_convert_nsarray_to_managed_with_func. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 7a9cb8372a [registrar] Extract code to create a managed array from an NSArray to a separate method. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 4f3b6115fc [registrar] Extract code to create an NSArray from a managed array to a separate method. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge f83df952de [runtime] Report which element failed to convert when marshalling an array between Objective-C and managed code. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 2b5229fe46 [registrar] Create a xamarin_string_to_nsstring function to avoid code duplication. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge fc6b2c0a0d [runtime] Use a 'void*' for the context in conversion functions instead of 'guint32'.
No function changes, just a refactoring to allow for pointers as context.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge c8ed014af7
[runtime] Improve exception creation. (#5944)
* [runtime] Add an inner exception parameter to Runtime.CreateProductException.

This allows us to simplify code by using inner (and outer) exceptions as
a means to provide information instead of passing extra information
around in order to create decent exceptions.

One example is how we pass the selector and method name to the method
that converts from a native id to a managed NSObject instance: passing
this information is not necessary anymore if we can use two exceptions,
one for the failure to convert from an id to a NSObject instance,
wrapped in a second that tells which method/selector call ran into this
conversion problem.

* [runtime] Throw better exceptions when the dynamic registrar can't marshal something.

* [runtime] Throw a better exception when something goes wrong when trying to marshal a return value.

* [runtime] Use inner exceptions to convey failure information instead of trying to create a single exception with all we know.

* Fix merge problem.
2019-04-26 11:16:23 +02:00
Chris Hamons 3119129ab7 Remove references to bugzilla and replace with github (#4920)
https://github.com/xamarin/xamarin-macios/issues/3647
2018-10-04 09:43:55 -04:00
Rolf Bjarne Kvinge bd32b74347
Add support for delegates as return values in protocol members. Fixes #4102. (#4758)
* Add support for delegates as return values in protocol members. Fixes #4102.

This required a few changes:

* The generator now emits the DelegateProxy attribute for property getters in
  protocol interfaces.
* The generator now emits the DelegateProxy attribute in ProtocolMember
  attributes (and the ProtocolMember attribute has been extended with
  additional properties for this purpose).
* The generator now emits the BlockProxy attribute for the parameter in
  property setters.
* The generator now emits the BlockProxy attribute in ProtocolMember
  attributes for property setters.
* The static registrar now emits the metadata token for the
  DelegateProxy.DelegateType property into the generated code so that the
  DelegateProxy attribute itself isn't needed at runtime. This is required
  when the dynamic registrar has been optimized away.

Fixes https://github.com/xamarin/xamarin-macios/issues/4102.

* [tests] Update MX4105 test to expect new warnings.
2018-09-06 16:20:23 +02:00
Rolf Bjarne Kvinge e110612118
[registrar] Improve error message when failing to create a managed wrapper for a native handle. (#4360)
* Convert it into a MM8027/MT8027 error (with documentation).
* Add information about the selector and managed method that triggered the error.

Now the problem reported in issue #4254 shows up as:

> ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x7f8080412810 (type: UIView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'UIKit.UIView&' does not have a constructor that takes one IntPtr argument).
> Additional information:
> 	Selector: popoverController:willRepositionPopoverToRect:inView:
> 	Method: UIKit.UIPopoverController+_UIPopoverControllerDelegate.WillReposition(UIKit.UIPopoverController, CoreGraphics.CGRect ByRef, UIKit.UIView ByRef)

instead of just:

> ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x7f8080412810 (type: UIView). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'UIKit.UIView&' does not have a constructor that takes one IntPtr argument).

which makes it much easier to understand, track down, and fix/work around,
both for customers and ourselves.
2018-06-29 14:38:28 +02:00
Rolf Bjarne Kvinge 06834b2a14
[runtime] Avoid using a static library initializer. (#4106)
Avoid using a static library initializer by using a constant recursive mutex
initializer.

Static initializers are bad because there's a significant overhead to executing them.
2018-05-22 08:53:19 -04: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 5319266503
[static registrar] Compute the conversion methods for smart enums and embed those as token references in the generated code. (#3385)
Converting to and from smart enums and their corresponding native value
requires knowing the conversion function, since each smart enum has its own
conversion function.

The dynamic registrar can do this at runtime, but it's something that can be
computed in the static registrar at build time, so do that. The static
registrar will now embed the metadata token (as a token reference) in the
generated code, which can be used at runtime to find the conversion method,
without requiring anything from dynamic registrar.

This requires some refactoring in the conversion methods to allow passing more
information around (the `context` parameter in the conversion functions, which
the smart enum conversion methods now use for the token reference).

It turns out this is a massive improvement (although the scenarios where this
is relevant are rare): a simple test case [1] is 300x faster (from ~30s to
0.1s).

[1]: https://gist.github.com/rolfbjarne/961af28d1c2727b256fbcdfd6aa65e98
2018-02-05 07:54:13 +01:00
Rolf Bjarne Kvinge 369271d7b8
[runtime] Remove specialized function for getting the Selector/Class handle of a managed Selector/Class instance. (#3227)
* [runtime] Remove specialized function for getting the Selector/Class handle of a managed Selector/Class instance.

The existing function to get the handle of an INativeObject works just as fine.

* [runtime] Store and use a prebuilt XamMacLauncher.

Some changes in the runtime needs corresponding changes in XamMac.dll, but
since we're not changing XamMac.dll anymore, we can't change the runtime
either.

This means that we must add XamMacLauncher to the list of binaries we copy.

* [runtime] Store and use a prebuilt libxammac*.a as well.
2018-01-22 21:16:41 +01:00
Rolf Bjarne Kvinge b38c114fbe Add support for NSDirectionalEdgeInsets NSValues to the BindAs attribute. 2017-09-25 16:06:50 +02:00
Rolf Bjarne Kvinge e08490eccd [runtime] Ask clang to be quiet about using new API for our conversion methods. 2017-09-25 13:20:32 +02:00
Rolf Bjarne Kvinge 993407e5b3 [runtime] Optimize code that doesn't need an alloc/free pair. 2017-07-11 09:48:56 +02:00
Rolf Bjarne Kvinge ac1c33255d [registrar] Add support for BindAs conversion between NSNumber and enums. 2017-07-06 20:27:14 +02:00
Rolf Bjarne Kvinge 4b597841ed [runtime] Use the native equivalent of Type.GetTypeCode to do fewer string comparisons. 2017-07-06 20:27:12 +02:00
Rolf Bjarne Kvinge fb463ed921 [registrar] Don't require private mono symbols for BindAs support.
The two functions mono_class_is_nullable and mono_class_get_nullable_param are
private mono symbols, which means we can't call them when using Xamarin.Mac
with libmono from a dynamic library.

Implement a fallback for this case, where we call a managed method when these
functions are not available (and restrict this workaround to Xamarin.Mac only,
since it's not needed for Xamarin.iOS).
2017-07-04 18:33:32 +02:00
Rolf Bjarne Kvinge 7ecbc7abee [registrar] Add support for the BindAs attribute. 2017-07-04 07:35:29 +02:00
Rolf Bjarne Kvinge 1d9e377adf [runtime] Fix potential memory leak in error conditions. (#1723)
This was found by clang's static analyzer:

    trampolines.m:94:16: warning: Potential leak of memory pointed to by 'buf'
                                                             return NULL;
                                                                    ^~~~
2017-02-20 19:35:40 +01:00
Rolf Bjarne Kvinge a4d2998e5b [runtime] Allocate memory correctly to make clang's static analyzer happy. (#1724)
trampolines.m:75:22: warning: Result of 'malloc' is converted to a pointer of type 'id', which is incompatible with sizeof operand type 'void *'
                                    id *buf = (id *) malloc (sizeof (void *) * length);
                                    ~~~~             ^~~~~~  ~~~~~~~~~~~~~~~
2017-02-20 19:29:13 +01:00
Rolf Bjarne Kvinge cfb84f6e17 [runtime] Use printf on watchOS, NSLog doesn't shown up (by default) (#772)
* [runtime] Use printf on watchOS, NSLog doesn't shown up (by default).

* [runtime] Use a wrapper function for logging.

So that we can chose between printf and NSLog at runtime,
depending on where we're running.
2016-09-06 16:55:23 -04: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 4a5ce42b48 [runtime] Add a MONO_ASSERT_GC_SAFE_OR_DETACHED.
Since MONO_ASSERT_GC_SAFE asserts when executed on a detached thread,
and yet it's clearly safe for the GC to run when a thread is detached.
2016-05-26 17:47:10 +02:00
Rolf Bjarne Kvinge af0d01c93a Initial review pass for COOP for watchOS. 2016-05-26 17:47:10 +02:00