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

607 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge ddf1645748
[runtime] Remove unnecessary cast (#10875) 2021-03-16 15:23:58 +01:00
Rolf Bjarne Kvinge 3087174202
[runtime] Use xamarin_gchandle_free instead of mono_gchandle_free. (#10874)
Our own functions support pointer-sized GCHandles, so this is one less place
to fix for CoreCLR.
2021-03-16 14:00:35 +01:00
Rolf Bjarne Kvinge bc340502fe
[runtime] Move parts of NSObject creation from native to managed. (#10869)
Move the creation of an uninitialized NSObject from native to managed, which:

* Removes the need for the mono_object_new Embedding API.
* Removes one location where we write to managed memory from native code (to
  write the handle + flags in the uninitialized NSObject).
* Makes things easier for CoreCLR.
2021-03-16 07:40:19 +01:00
Rolf Bjarne Kvinge a5f970069a
[runtime] Make xamarin_release_managed_ref a normal P/Invoke. (#10864)
* We already switch to GC Safe mode anyway, so there were no benefits from
  entering native code in a GC unsafe mode. In fact we used to switch to GC
  Safe mode for every statement in xamarin_release_managed_ref, and now we can
  execute everything in GC Safe mode without switching back and forth. This
  also means there should be no difference in behavior.

* All parameters are blittable, so there's no extra marshalling cost.

* Easier for CoreCLR.
2021-03-15 08:02:59 +01:00
Rolf Bjarne Kvinge 52aa993bba
[runtime] Move setting the NSObject flags in xamarin_create_managed_ref from native to managed code. (#10858)
* Less poking into managed memory from native code.
* Makes things easier for CoreCLR support.
2021-03-12 23:19:07 +01:00
Rolf Bjarne Kvinge 1003c987f2
[runtime] Move the call to Runtime.UnregisterNSObject from native to managed code. (#10857)
* Avoids a native->managed transition
* Avoids creating/destroying a GCHandle.
* Makes it possible to remove an argument from the call to
  xamarin_release_managed_ref.
* Makes things easier for CoreCLR.
2021-03-12 23:14:10 +01:00
Rolf Bjarne Kvinge 4e0978e46c
[runtime] Link the CoreCLR version of libxamarin with CoreCLR instead of Mono. (#10853)
* [runtime] Link the coreclr version of libxamarin with CoreCLR instead of Mono.

The diff might look a bit weird, because there's no changes specific to CoreCLR -
the difference is that we're in fact removing a special-case to link with Mono: we
used the DOTNET_$(rid)_LIBDIR variable to specify the directory where to find libcoreclr,
we now use DOTNET_CORECLR_$(rid)_LIBDIR when building for CoreCLR, but that's handled
by the default case, so no need to add any special casing. We still override DOTNET_osx-<arch>_LIBDIR
for MonoVM (no change needed for that).

* [runtime] Generate stubs for the mono embedding API when building for CoreCLR.

This makes libxamarin link successfully when building for CoreCLR.
2021-03-12 18:40:48 +01:00
Rolf Bjarne Kvinge e6247e0c6f
[runtime] Port the is_user_type function from native to managed code. (#10841)
* [runtime] Port the is_user_type function from native to managed code.

* This is a straight forward port of native code to managed code, and
  shouldn't have any significant side effects.

* Makes it possible to move more code from native to managed for
  xamarin_create_managed_ref and xamarin_release_managed_ref in the future.

* Update xtro.
2021-03-12 07:38:27 +01:00
Rolf Bjarne Kvinge e53176383e
[builds] Remove the code to optionally inject an x64 slice into our binaries. (#10846)
It's been disabled for a while, which indicates that Apple has fixed the issue
on their side, and we don't need this code anymore.
2021-03-12 07:38:07 +01:00
Rolf Bjarne Kvinge a392035fa7
[runtime] Move a few mono function declaration to the generated logic for mono function declarations instead of doing it manually. (#10849)
This makes things a little bit easier to when starting work with CoreCLR.
2021-03-12 07:37:27 +01:00
Rolf Bjarne Kvinge 4cfa6928ae
[runtime] Simplify the various print_all_exceptions methods a bit. (#10847)
Unify them into a single one (xamarin_print_all_exceptions), which takes the
GCHandle of the exception to create an NSString representation of.
2021-03-12 07:37:13 +01:00
Rolf Bjarne Kvinge 37723f600c
[runtime] Speed up make (#10848)
Make variables can have dashes, which means we don't have to convert dashes in
rids to underscores to be able to compose variable names.

This speeds up make because now we don't have to execute hundreds of
subprocesses when parsing the makefile.

Before:

    $ make -j16 > /dev/null && /usr/bin/time make && /usr/bin/time make && /usr/bin/time make
        2.11 real         0.57 user         1.26 sys
        2.15 real         0.57 user         1.28 sys
        2.17 real         0.58 user         1.30 sys

After:

    $ make -j16 > /dev/null && /usr/bin/time make && /usr/bin/time make && /usr/bin/time make
        0.52 real         0.18 user         0.25 sys
        0.52 real         0.18 user         0.25 sys
        0.52 real         0.18 user         0.26 sys

So now it's ~4x faster (1.6s) for make to figure out there's nothing to do.
2021-03-12 07:36:41 +01:00
Rolf Bjarne Kvinge 3af399e21f
[runtime] Remove unused mono functions. (#10825) 2021-03-11 08:48:17 +01:00
Rolf Bjarne Kvinge 4854d7b4da
[runtime] Simplify calls to xamarin_create_managed_ref. (#10826)
I don't see why we should avoid calling xamarin_create_managed_ref from
NSObject's managed code, and then immediately call xamarin_create_managed_ref
upon return from NSObject's managed code.

This code is old ([1]), and from my reading of it, there's no specific reason
it was done this way.

Simplify the logic to call xamarin_create_managed_ref from a single place
(NSObject's managed code).

[1]: e59c45d3f9
2021-03-11 08:47:36 +01:00
Rolf Bjarne Kvinge a8b3d9c296
[runtime] Call into managed code to call GC.Collect instead of using embedding API. (#10828)
Any performance difference will be neglible compared to running the GC, so
there's no compelling reason to use the embedding API.

This makes things a bit easier with CoreCLR, since the new code works there too.

This also required a few changes in delegates.t4 to make code generation for
functions without arguments work correctly.
2021-03-11 07:37:45 +01:00
Rolf Bjarne Kvinge 0e79b58fa8
[registrar] Remove redundant call to xamarin_register_nsobject from the dynamic registrar. (#10817)
The ctor we just called called it already.

Also, the static registrar doesn't have this call, so the dynamic registrar
shouldn't need it either.
2021-03-10 16:49:11 +01:00
Rolf Bjarne Kvinge bff4c7b1c2
[runtime] Move some code from native to managed for xamarin_release_managed_ref. (#10814)
* Avoids one usage of xamarin_set_nsobject_flags (which pokes into managed
  memory from native code, which won't be possible with CoreCLR).

* Makes it possible to move more code from native to managed for
  xamarin_release_managed_ref in the future.

* Since the code order is exactly the same, it shouldn't have any other side
  effects.
2021-03-09 14:57:50 +01:00
Rolf Bjarne Kvinge b22e0c3a6f
[runtime] Reduce code duplication a little bit. (#10807) 2021-03-09 07:43:51 +01:00
Rolf Bjarne Kvinge bccef33d3f
[runtime] Build a new version of libxamarin specifically for CoreCLR. (#10798)
We're currently only building for macOS, but we'll eventually build for Mac
Catalyst as well.
2021-03-08 07:57:55 +01:00
Rolf Bjarne Kvinge 80ed9d81bc
Add configure option to disable building for legacy Xamarin. (#10773)
* Add configure option to disable building for legacy Xamarin.

This can greatly speed up the debug-edit-build cycle when doing .NET
development, since it cuts down the build time in half more or less.

* Bump maccore.

New commits in xamarin/maccore:

* xamarin/maccore@548fa45432 [mlaunch] Disable building mlaunch when not including the legacy Xamarin build. (#2403)

Diff: 0562e08b12..548fa45432
2021-03-04 09:07:44 +01:00
Rolf Bjarne Kvinge 363f4611db
Use our [OBJC_]CFLAGS when compiling code for macOS. (#10771)
This required fixing a couple of compiler warnings in code that's now compiled
with more warnings + warnings-as-errors enabled:

    launcher.m:188:48: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
            argv = (char **) malloc (sizeof (char *) * (n + 1));
                                                     ~  ~~^~~
    launcher.m:609:67: error: implicit conversion changes signedness: 'int' to 'unsigned long' [-Werror,-Wsign-conversion]
                    char **new_argv = (char **) malloc (sizeof (char *) * (new_argc + 1 /* null terminated */));
                                                                        ~  ~~~~~~~~~^~~
2021-03-03 21:41:39 +01:00
Rolf Bjarne Kvinge 871e7b1cd0
[runtime] Build our runtime for Mac Catalyst/ARM64 for .NET. (#10739)
* [runtime] Build our runtime for Mac Catalyst/ARM64 for .NET.

* [ObjCRuntime] There's no need for the StartWWAN implementation on Mac Catalyst.

This also fixes a build error:

    error MT5214: Native linking failed, undefined symbol: _xamarin_start_wwan. This symbol was referenced by the managed member ObjCRuntime.Runtime.xamarin_start_wwan.

* Only exclude xamarin_start_wwan in the .NET version of Mac Catalyst.

* [tests] Update to not run the StartWWAN test on Mac Catalyst.

* Update conditional logic.

* Fix build with newer make versions.
2021-03-03 07:48:07 +01:00
Rolf Bjarne Kvinge ff619c2d21
[runtime] Fix a compiler warning. (#10755)
Fix this compiler warning:

    monotouch-debug.m:524:12: warning: unused variable 'monotouch_debug_enabled' [-Wunused-variable]
             NSString *monotouch_debug_enabled;
2021-03-03 07:41:35 +01:00
Rolf Bjarne Kvinge e0163bfb23
[runtime] Always enable debugging in .NET/macOS and .NET/Mac Catalyst in debug versions of libxamarin. (#10751)
This makes it so that it's possible to attach to the debugger by setting the
__XAMARIN_DEBUG_HOSTS__/__XAMARIN_DEBUG_PORT__ environment variables, without
the need for enabling a setting somewhere else (like in
Settings.bundle/Root.plist on mobile devices).
2021-03-02 15:33:44 +01:00
Rolf Bjarne Kvinge 7ab7e25138
[runtime] Build a .NET-specific libxamarin-dotnet[-debug].[a|dylib]. (#10723)
This also means linking with the runtime packs from .NET instead of the mono archive
(thus we have one less reliance on the mono archive).

We're also using the Xamarin.iOS code for our macOS launch sequence now, since
(at least at first) we're only going to support self-contained .NET macOS apps
(so no need to support a system-installed runtime, which simplifies things a
bit).
2021-02-26 14:42:30 +01:00
Rolf Bjarne Kvinge f4ac99efc0
[dotnet] Build & publish MacCatalyst packs. (#10624)
* [dotnet] Build & publish MacCatalyst packs.

* Add runtime support.
2021-02-12 07:38:43 +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 90676df846 [src] Build Xamarin.MacCatalyst.dll 2020-12-03 10:43:19 +01:00
Rolf Bjarne Kvinge 30f8d217ea [runtime] Build our native runtime bits for catalyst. 2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 874df65210 [runtime] Split the make template to create native libraries in two templates
Split the make template 'PlatformTemplate' in two templates, now there's a 'FrameworkTemplate'
that's in charge of building Xamarin[-debug].framework, and the existing 'PlatformTemplate'
will be in charge of the rest of the native libraries.
2020-12-03 10:42:27 +01:00
Rolf Bjarne Kvinge 38eca9806a [runtime] Look for files in the Contents/MonoBundle directory for catalyst apps. 2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 9327af6960 [runtime] Put MonoTouchDebugConfiguration.txt in the app resources directory.
This is required for Catalyst apps, since no custom files can be in the root directory
for apps on macOS.
2020-12-03 10:42:25 +01:00
Rolf Bjarne Kvinge adb566e408
[runtime] Simplify code for custom mono bundle name a bit by using a default value for the 'xamarin_custom_bundle_name' variable. (#10130) 2020-11-23 08:30:08 +01:00
Alex Soto 72c7b1ffcc
[main][watchOS] Add x86_64 simulator support (#10059)
* [watchOS] Add x86_64 simulator support

* Build runtime/registrar x86_64 slices
* Produce a 64 bit version of Xamarin.WatchOS.dll
* Allow building x86_64 for watch simulators in mtouch
* Let xharness know about x86_64

* [tests] Add x86_64 arch to test-libraries

* Make dotnet package aware of x64

* [ObjCRuntime] Fix computing if we're calling a stret function or not in a 64-bit watchOS simulator.

* [xharness] Re-enable some watchOS tests.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-11-20 09:27:46 -05:00
Filip Navara d602cf76cf
[dotnet] Fix install name for libxamarin[-debug].dylib on macOS (#9821)
* [dotnet] Fix install name for libxamarin[-debug].dylib on macOS

* When using DYNAMIC_MONO_RUNTIME pass down the bundle directory in MONO_PATH to the relaunched process. Also fix support for custom bundle names in the surrounding code.

* Fix pattern matching
2020-10-09 14:55:00 +02:00
Filip Navara 59db084141
Respect xamarin_executable_name on macOS if specified (#9803) 2020-10-08 18:23:39 +02:00
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Manuel de la Pena eb9b690fe0 Merge xcode12 into d16-8. 2020-09-18 17:51:52 -04:00
Rolf Bjarne Kvinge 5a85c17e6d
[runtime] Give a better error message if we can't load ObjCRuntime.Runtime.Initialize () (#9514)
* [runtime] Give a better error message if we can't load ObjCRuntime.Runtime.Initialize ()

Otherwise we'll get a SIGSEGV due to dereferencing NULL.

* Rework strings a bit to have fewer unique strings.
2020-08-27 13:29:12 +02:00
Manuel de la Pena 5fae175cf6
[ARKit] Add support for Xcode 12 beta 1. (#9002)
PInvoke that is missing is due to a dependency with Visio which is not
yet updated.



Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-07 09:37:16 -04:00
Sebastien Pouliot f427b5e91d
[xcode12] Bump for beta 1 (#8935)
Known issues https://github.com/xamarin/xamarin-macios/issues/8943
2020-06-26 14:02:44 -04:00
Sebastien Pouliot 4a23951829
[runtime] Fix warning in launcher.m (#8891)
```
launcher.m:136:9: warning: unused variable 'size' [-Wunused-variable]
        size_t size;
               ^
1 warning generated.
```

missed in https://github.com/xamarin/xamarin-macios/pull/8853
2020-06-19 09:40:01 -04:00
Sebastien Pouliot 96eb54dcb2
[runtime] Use `strnlen` instead of `strlen` (#8893)
`strlen` is part of the list of C API banned by Microsoft.

Also rename a local variable in `Runtime.cs` so grepping the source
files won't show `strlen` outside the `tests` subdirectories.
2020-06-19 09:36:02 -04:00
Sebastien Pouliot 577af10467
[runtime] Remove strlen and memcpy usage from runtime/xamarin-support.m (#8879)
* NSString can give us the length of the string
* NSData can copy memory into a supplied buffer

The later is already covered by tests in `tests/linker/ios/link all/InternalsTest.cs`
2020-06-18 08:06:59 -04:00
Sebastien Pouliot 44d3e1b7ba
[runtime] Simplify string code inside launcher by using ObjC (#8859)
This avoids the use of `strcpy`, `memcpy` and `strlen` which can be
misused. We're already using ObjC code inside the file so we can
leverage higher-level API that makes review the code easier.
2020-06-17 10:03:35 -04:00
Sebastien Pouliot f9aa25cefa
[runtime] Replace custom string concatenation inside `mono-runtime.m.t4` (#8865)
by simpler, at least to review, ObjC code.
2020-06-16 13:26:58 -04:00
Sebastien Pouliot 0187a45359
[runtime] Have launcher use https-based URL if mono is missing (#8855) 2020-06-15 14:21:15 -04:00
Sebastien Pouliot 65901a6f29
[runtime] Update launcher to use `strndup` (#8853)
because now we can :)
2020-06-15 13:46:01 -04:00
Rolf Bjarne Kvinge 748612fbc2
[dotnet] Ship libxamarin.dylib and friends. (#8830)
* [dotnet] Ship libxamarin.dylib and friends.

Add libxamarin[-debug].[a|dylib] to the NuGets.

* [dotnet] Create a DOTNET_PLATFORMS variable in Make.config.

Create a DOTNET_PLATFORMS variable in Make.config and use it everywhere
instead of the PLATFORMS variable we were defining in multiple Makefiles.

Also move the creation of the DOTNET_<platform>_RUNTIME_IDENTIFIERS variables
from dotnet/Makefile to Make.config, it'll soon be needed elsewhere as well.

* [runtime] Conditionally include bits.

* Make the contents of the DOTNET_[PLATFORMS|RUNTIME_IDENTIFIERS] variables depend on the INCLUDE_[IOS|TVOS|WATCH] variables.
2020-06-15 17:47:18 +02:00
Sebastien Pouliot 37b62cbaae
[runtime] Only include debug over HTTP for watchOS devices (#8828)
We have better options for watchOS simulator and other platforms.

This only affects `lib*-debug.dylib` and `Xamarin-debug.framework`
as the non-debug binaries don't include debugging support.
2020-06-10 16:27:15 -04:00
monojenkins b492f5a33e
[runtime] Remove Classic code. (#8722)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-02 16:14:17 +02:00
Rolf Bjarne Kvinge 24ed1ddc66
[runtime] Remove Classic code. (#8720) 2020-06-02 08:18:24 +02:00
Rolf Bjarne Kvinge 2926083d20
[runtime/mmp] Put libxammac and xamarin headers for Xamarin.Mac in the same directory as the corresponding files for Xamarin.iOS. (#8542)
That's in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/SDKs/Xamarin.macOS.sdk/[lib|include]

This allows for a bit more code share between mtouch and mmp.
2020-05-08 13:04:32 +02:00
Rolf Bjarne Kvinge ef8a5736a2 [src] Remove ObjectWrapper.
ObjectWrapper is not safe, and in any case incompatible with .NET 5.
2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge ab50886e47 Convert Runtime.GetNullableType to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge fc233a46ad Convert Registrar.WriteUnmanagedDescription to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 872530dfe0 Convert Runtime.CreateDelegateProxy to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge b0974e8317 Convert Runtime.ConvertNSStringToSmartEnum and Runtime.ConvertSmartEnumToNSString to use GCHandle.
These methods were already partially using GCHandles, so convert the parameter
using ObjectWrapper to GCHandle, and port the rest of the existing logic to
use the new helper API.
2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge b360263f2c Convert Runtime.RegisterAssembly to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge dd7278c4ea Convert Runtime.RegisterEntryAssembly to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 605a83215d Convert Runtime.GetHandleForINativeObject to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge aa875592c8 Convert Runtime.UnregisterNSObject to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge c0c35acd40 Convert Runtime.TryGetOrConstructNSObjectWrapped to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 8ac784ccfe Convert Runtime.GetINativeObject_[Dynamic|Static] to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge e31b9db516 Convert Runtime.GetNSObjectWithType to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 5e44aac2d8 Convert Runtime.IsParameter[Out|Transient] to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge cff3617dd2 Convert Runtime.Dispose to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge e2ee5a2710 Convert Runtime.GetSelector to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge ef92c04135 Convert Runtime.GetClass to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge c25403bb21 Convert Runtime.RegisterNSObject to take a GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 632fd10328 Convert Runtime.GetBlockWrapperCreator, Runtime.CreateBlockProxy and Runtime.Get[Generic]MethodFromToken to use GCHandle.
The native methods xamarin_get_[generic_]method_from_token are a bit unusual
in that they return an actual GCHandle. This is for performance reasons, since
in some cases their return value is passed as parameters to other function
calls to managed code, in which case we need the GCHandle. This way we avoid
round-tripping a GCHandle multiple times.
2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge a7d68ddfbc Convert Runtime.GetMethodAndObjectForSelector to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 1bf3ccfb45 Convert Runtime.TypeGetFullName to use GCHandle. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 6663d8d273 [runtime] Use a common cleanup logic in xamarin_get_delegate_for_block_parameter. 2020-05-04 11:31:19 +02:00
Rolf Bjarne Kvinge 54bc2f1dfe [runtime] Add GCHandle pointer-sized API. 2020-05-04 11:31:19 +02: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 95a9fe33fd [runtime] Don't call directly into managed delegates.
Use the wrapper methods instead, so that we get the benefits of using them
(automatic parameter/return type conversions, NULL checks, etc).
2020-05-04 11:08:24 +02:00
Rolf Bjarne Kvinge 793a2a5a57
Use the correct return type for the xamarin_get_delegate_for_block_parameter function. (#8483)
This code is old, and it seems the int* is a left-over from the 32-bit days.
Using the correct type makes us able to avoid a cast.

Ref: 0f83cf16e2
2020-04-30 16:34:08 +02:00
Rolf Bjarne Kvinge bbcab6f70c
[runtime] Remove a few unused functions. (#8482) 2020-04-30 14:40:56 +02:00
Rolf Bjarne Kvinge e4f8460277
[mmp/mtouch] Share more code. (#8394)
* Rearrange files in Xamarin.Mac a bit to ease code sharing between mmp and
  mtouch, by putting mono's static and dynamic libraries in
  /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Sdks/Xamarin.macOS.sdk
  to match how Xamarin.iOS does it.

* Don't use 'usr' as an intermediate directory. This removes another special
  case.

* Share many of the functions and properties that return specific directories,
  and document (as comments) what each function/property is supposed to
  return.
2020-04-16 14:19:45 +02:00
Alexis Christoforides 4b94e3073b
Wrap mono_gc_init_finalizer_thread() call with now-needed coop GC state transition. (#8242)
Starting with https://github.com/mono/mono/pull/16907 , the Mono runtime ends in GC-Safe state (mode) after mono_jit_init_version() is called. The monotouch code did not expect that, and calls mono_gc_init_finalizer_thread() which also tries to enter GC-safe mode.

Should fix https://github.com/mono/mono/issues/19372
2020-03-31 09:28:02 +02:00
Alex Soto 3ff3e07ebe Merge remote-tracking branch 'xamarin/d16-5-xcode11.4' 2020-03-26 19:59:14 -04:00
Rolf Bjarne Kvinge 2c86ec2533
[runtime] Abort if the call to Runtime.Initialize fails. (#8099)
Also print out something to the system log. In theory
xamarin_process_managed_exception should also end up terminating the process
in one way or another, but when something goes wrong it tend to go very, very
wrong, so this makes sure some info is printed somewhere.
2020-03-13 16:11:08 +01:00
Rolf Bjarne Kvinge 1b72c009d2
[runtime] Add asserts that gives a helpful message when a managed delegate callback doesn't exist. (#8057)
This is restricted to debug builds.

Also tell make to not delete delegates.h and delegates.inc. That makes it much
easier to inspect them.

Example before function:

    void
    xamarin_throw_ns_exception (NSException * exc)
    {
    		delegates.throw_ns_exception (exc);
    }

The after version:

    void
    xamarin_throw_ns_exception (NSException * exc)
    {
    #if DEBUG
    	if (delegates.throw_ns_exception == NULL) {
    		NSLog (@PRODUCT ": The managed function throw_ns_exception could not be loaded.");
    		xamarin_assertion_message ("The managed function throw_ns_exception could not be loaded.");
    	}
    #endif
    	delegates.throw_ns_exception (exc);
    }
2020-03-06 16:42:21 +01:00
Alex Soto 709a90599e Merge remote-tracking branch 'xamarin/xcode11.4' into d16-5-xcode11.4-merge 2020-03-03 10:57:24 -05:00
Rolf Bjarne Kvinge 2b733ae79c
[mmp] Set 'disable_omit_fp' by default to provide better native stack traces in certain cases. (#7981)
* [mmp] Set 'disable_omit_fp' by default to provide better native stack traces in certain cases.

This may produce better stack traces when crashes occur, which could be
helpful for tracking down issues like
https://github.com/xamarin/maccore/issues/643.

Also add an mmp option to override the default behavior.

This is unlikely to cause any problems, because Visual Studio for Mac sets
MONO_DEBUG=disable_omit_fp at launch, which means that all processes launched
by VSMac will also have this variable set already.

* Fix lldb attach disabling.
2020-02-26 15:49:55 +01:00
Rolf Bjarne Kvinge c53b17d79b
Make the x86-64 slice we inject into binaries optional. (#7891)
We inject an x86-64 slice into binaries that don't contain one, because
Apple's notarization process fails without such a slice.

But make the slice optional and opt-in, because it seems Apple has started
to fail on binaries with such a slice now...
2020-02-14 14:25:43 +01:00
Sebastien Pouliot 482a63dc56
Update sampletester docs and fix typos (#7822) 2020-02-10 08:10:40 -05:00
monojenkins 01ff50a27c [d16-5] [Makefile] Make csc strict and fix some small errors. (#7671)
Make csc to bee more strict when compiling the projects and mix some
small errors we had in the bindings.

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


Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2020-01-06 16:53:22 -05:00
Manuel de la Pena 8a52fcd812
[Makefile] Make csc strict and fix some small errors. (#7665)
* [Makefile] Make csc strict and fix some small errors.

Make csc to bee more strict when compiling the projects and mix some
small errors we had in the bindings.

Fixes: https://github.com/xamarin/xamarin-macios/issues/5398
2020-01-02 13:57:22 -05:00
Vincent Dondain fd3f86d912 Bump to mono:2019-10 (#7192) (#7547)
* Fixed
`/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs(110,15): error CS0246: The type or namespace name ‘OutputException’ could not be found (are you missing a using directive or an assembly reference?) [/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/mmp.csproj]`
* Changed the name of the method that is used from linker. Because of this commit 6be26771b9
* Added `OutputException.cs` file on `mtouch.csproj`.
* Removing enter_gc_safe and exit_gc_safe because now it's already gc_safe in this part of code, after a mono change.
* Added known exceptions to LLVM exception list.
* Needs `ifdef` because of this https://github.com/mono/mono/pull/17260.
* Bump MIN_MONO_VERSION to 6.8.0.41 and point MIN_MONO_URL to the PR.
* Add ENABLE_IOS=1 and ENABLE_MAC=1.
* Added switch to disable packaged mono build
* [Tests] Ignore tests that fail on 32b.
    Ignore the test on 32b, and filled issue: https://github.com/mono/mono/issues/17752
* [Tests] Ignore a couple of tests causing OOM.
    Hopefully fixes https://github.com/xamarin/maccore/issues/1659 for good.
* Ignore `MM0135` test on Catalina+ because it needs Xcode 9.4.
* [monotouch-test] Add null checks for teardown when test didn't run because of a too early OS version.
* [CFNetwork]: Http 2.0 requires OS X 10.11 or later.
    Check whether `_HTTPVersion2_0` is available and fallback to HTTP 1.1 otherwise.

* #7346
* This bumps Mono to use https://github.com/mono/mono/pull/17645 (which is the 2019-10 backport
of https://github.com/mono/mono/pull/17628).
* The big user-visible change is in regards to certificate validation, everything below are just
some minor adjustments to tests.

CoreFX uses a completely new `HttpClientHandler` implementation called `SocketsHttpHandler`,
which you can find at https://github.com/dotnet/corefx/tree/release/3.0/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler.

Since this is not based on the web stack anymore, it does not use any of the related APIs such
as `ServicePointManager` or `WebException`.

There is a new API called `HttpClientHandler.ServerCertificateCustomValidationCallback`.
- https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.servercertificatecustomvalidationcallback?view=netframework-4.8
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Unix.cs (L154)
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Windows.cs (L383)

The `ServicePointManager.ServerCertificateValidationCallback` is no longer invoked and on
certificate validation failure, `AuthenticationException` (from `System.Security.Authentication`)
is thrown instead of `WebException`.

At the moment, the `NSUrlSessionHandler` still uses it's own validation callback and also still
throws `WebException` on failure; we should probably look into making this consistent with the
other handlers.

* `HttpContent.SerializeToStreamAsync()` is now `protected` (changed from `protected internal`).
  - src/Foundation/NSUrlSessionHandler.cs: changed overload accordingly.
  - src/System.Net.Http/CFContentStream.cs: likewise.

* `HttpHeaders.GetKnownHeaderKind()` is an internal Mono API.
   There is a new internal API called `System.Net.Http.PlatformHelper.IsContentHeader(key)`
   which exists in both the old as well as the new implementation.
   The correct way of doing it with the CoreFX handler is
   `HeaderDescriptor.TryGet (key, out var descriptor) && descriptor.HeaderType == HttpHeaderType.Content`

* `HttpClientHandler.MaxRequestContentBufferSize` is now longer supported, you can set it to
  any non-negative value, the getter will always return 0.
  See c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Core.cs (L18).
  - tests/linker/ios/link sdk/HttpClientHandlerTest.cs: removed assertion from test.

* `HttpMessageInvoker.handler` is a `protected private` field - in the CoreFX handler, it is
  called `_handler` and `private`.  This is accessed via reflection by some of the tests, which are
  now using the new name.
  - tests/mmptest/src/MMPTest.cs: here
  - tests/mtouch/MTouch.cs: here

* tests/monotouch-test/System.Net.Http/MessageHandlers.cs:
  Adjust `RejectSslCertificatesServicePointManager` to reflect the certificate validation
  changes described above.
  - FIXME: There was an `Assert.Ignore()` related to `NSUrlSessionHandler` and macOS 10.10;
    I removed that to reenable the test because the description linked to an old issue in
    the private repo that was referenced by several "Merged" PR's, so it looked to me that
    this might have already been fixed - and I also didn't see why it would fail there.
2019-12-18 11:40:47 -05:00
Manuel de la Pena c44e339d7a
[Runtime] Move some of the changes back to int. (#7529) (#7606)
Some of the fixes done for the warnings have breaking changes. Move back
to int and ensure that we do not have any compilation errors (we are
using -Werror).

Fixes: https://github.com/xamarin/xamarin-macios/issues/7509
2019-12-16 22:06:51 -05:00
monojenkins b0f99834b9 [runtime] Don't zero-terminate after the string buffer. Fixes #7564. (#7585)
Fixes https://github.com/xamarin/xamarin-macios/issues/7564.
2019-12-12 16:31:59 -05:00
monojenkins 3483132065 [runtime] Don't zero-terminate after the string buffer. Fixes #7564. (#7580)
Fixes https://github.com/xamarin/xamarin-macios/issues/7564.
2019-12-12 16:07:31 -05:00
Manuel de la Pena 3f0985ecac
[Runtime] Move some of the changes back to int. (#7529)
Some of the fixes done for the warnings have breaking changes. Move back
to int and ensure that we do not have any compilation errors (we are
using -Werror).

Fixes: https://github.com/xamarin/xamarin-macios/issues/7509
2019-12-11 22:17:29 -05:00
Marius Ungureanu 3c4cdef538 Set LangVersion in order to be able to build from an IDE (#7552) 2019-12-11 17:10:16 -05:00
Rolf Bjarne Kvinge 3f069f4378
[runtime] Don't zero-terminate after the string buffer. Fixes #7564. (#7571)
Fixes https://github.com/xamarin/xamarin-macios/issues/7564.
2019-12-11 19:31:15 +01:00
Jo Shields 5d4ada34c7 Bump to mono:2019-10 (#7192)
## Miscellaneous fixes

* Fixed
`/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/builds/mono-ios-sdk-destdir/ios-sources/external/linker/src/linker/Linker.Steps/OutputStep.cs(110,15): error CS0246: The type or namespace name ‘OutputException’ could not be found (are you missing a using directive or an assembly reference?) [/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mmp/mmp.csproj]`
* Changed the name of the method that is used from linker. Because of this commit 6be26771b9
* Added `OutputException.cs` file on `mtouch.csproj`.
* Removing enter_gc_safe and exit_gc_safe because now it's already gc_safe in this part of code, after a mono change.
* Added known exceptions to LLVM exception list.
* Needs `ifdef` because of this https://github.com/mono/mono/pull/17260.
* Bump MIN_MONO_VERSION to 6.8.0.41 and point MIN_MONO_URL to the PR.
* Add ENABLE_IOS=1 and ENABLE_MAC=1.
* Added switch to disable packaged mono build
* [Tests] Ignore tests that fail on 32b.
    Ignore the test on 32b, and filled issue: https://github.com/mono/mono/issues/17752
* [Tests] Ignore a couple of tests causing OOM.
    Hopefully fixes https://github.com/xamarin/maccore/issues/1659 for good.
* Ignore `MM0135` test on Catalina+ because it needs Xcode 9.4.
* [monotouch-test] Add null checks for teardown when test didn't run because of a too early OS version.
* [CFNetwork]: Http 2.0 requires OS X 10.11 or later.
    Check whether `_HTTPVersion2_0` is available and fallback to HTTP 1.1 otherwise.

## Bring HttpClient from CoreFX

* #7346 
* This bumps Mono to use https://github.com/mono/mono/pull/17645 (which is the 2019-10 backport
of https://github.com/mono/mono/pull/17628).
* The big user-visible change is in regards to certificate validation, everything below are just
some minor adjustments to tests.

### SocketsHttpHandler

CoreFX uses a completely new `HttpClientHandler` implementation called `SocketsHttpHandler`,
which you can find at https://github.com/dotnet/corefx/tree/release/3.0/src/System.Net.Http/src/System/Net/Http/SocketsHttpHandler.

Since this is not based on the web stack anymore, it does not use any of the related APIs such
as `ServicePointManager` or `WebException`.

### Certificate Validation Changes

There is a new API called `HttpClientHandler.ServerCertificateCustomValidationCallback`.
- https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.servercertificatecustomvalidationcallback?view=netframework-4.8
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Unix.cs (L154)
- c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Windows.cs (L383)

The `ServicePointManager.ServerCertificateValidationCallback` is no longer invoked and on
certificate validation failure, `AuthenticationException` (from `System.Security.Authentication`)
is thrown instead of `WebException`.

At the moment, the `NSUrlSessionHandler` still uses it's own validation callback and also still
throws `WebException` on failure; we should probably look into making this consistent with the
other handlers.

### Minor adjustments related to internal Mono APIs

* `HttpContent.SerializeToStreamAsync()` is now `protected` (changed from `protected internal`).
  - src/Foundation/NSUrlSessionHandler.cs: changed overload accordingly.
  - src/System.Net.Http/CFContentStream.cs: likewise.

* `HttpHeaders.GetKnownHeaderKind()` is an internal Mono API.
   There is a new internal API called `System.Net.Http.PlatformHelper.IsContentHeader(key)`
   which exists in both the old as well as the new implementation.
   The correct way of doing it with the CoreFX handler is
   `HeaderDescriptor.TryGet (key, out var descriptor) && descriptor.HeaderType == HttpHeaderType.Content`

### Minor adjustments to tests.

* `HttpClientHandler.MaxRequestContentBufferSize` is now longer supported, you can set it to
  any non-negative value, the getter will always return 0.
  See c1778515a3/src/System.Net.Http/src/System/Net/Http/HttpClientHandler.Core.cs (L18).
  - tests/linker/ios/link sdk/HttpClientHandlerTest.cs: removed assertion from test.

* `HttpMessageInvoker.handler` is a `protected private` field - in the CoreFX handler, it is
  called `_handler` and `private`.  This is accessed via reflection by some of the tests, which are
  now using the new name.
  - tests/mmptest/src/MMPTest.cs: here
  - tests/mtouch/MTouch.cs: here

* tests/monotouch-test/System.Net.Http/MessageHandlers.cs:
  Adjust `RejectSslCertificatesServicePointManager` to reflect the certificate validation
  changes described above.
  - FIXME: There was an `Assert.Ignore()` related to `NSUrlSessionHandler` and macOS 10.10;
    I removed that to reenable the test because the description linked to an old issue in
    the private repo that was referenced by several "Merged" PR's, so it looked to me that
    this might have already been fixed - and I also didn't see why it would fail there.
2019-12-04 15:10:32 -05:00
Sebastien Pouliot 611d6f37fb
[runtime] Comment two special cases that triggers static analysis tools (#7491) 2019-11-26 08:30:05 -05:00
Manuel de la Pena cb815ecd39
[Runtime] Update cflags and fix warnings accordingly. (#7478)
Update flags:

* Add -Werror so that warnings are errors.
* Move to -Wconversion that adds:
  * -Wbitfield-enum-conversion
  * -Wbool-conversion
  * -Wconstant-conversion
  * -Wenum-conversion
  * -Wfloat-conversion
  * -Wimplicit-float-conversion
  * -Wimplicit-int-conversion
  * -Wint-conversion
  * -Wliteral-conversion
  * -Wnon-literal-null-conversion
  * -Wnull-conversion
  * -Wobjc-literal-conversion
  * -Wshorten-64-to-32
  * -Wsign-conversion
  * -Wstring-conversion
Last work related to: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-25 16:00:24 -05:00
Manuel de la Pena 6a702cb7b9
[Runtime] Enable the -Wsign-conversion on runtime.m files. (#7474)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-21 09:42:17 -05:00
Manuel de la Pena 8f6a10f3bd
[Runtime] Enable the -Wsign-conversion on monotouch-debug files. (#7459)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-20 13:42:51 -05:00
Manuel de la Pena 4aa269bbdb
[Runtime] Enable the -Wsign-conversion on monotouch-main.m files. (#7457)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-18 08:36:47 -05:00
Manuel de la Pena 481d5ef9ab
[Runtime] Enable the -Wsign-conversion on trampolines-x86_64.m files. (#7455)
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 14:34:36 -05:00
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 5e2231d533
[Runtime] Enable the -Wsign-conversion on trampolines-varargs files. (#7428)
Enable the flag that was disabled via pragmas.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-14 14:35:27 -05:00
Sebastien Pouliot 387730516f
[runtime] Clarify size in marshal_return_value calls (#7439)
Static analysis (and any manual review) is easily confused by
`sizeof (id)`, `sizeof (self)` and `sizeof (*self)` when another
argument is `self` and can report false positives (or be missed
or misinterpreted by humans).

This simply clarify that `|` is an encoded pointer and will
be the size of the pointer (varying by architectures)
2019-11-14 14:50:34 +01:00
Manuel de la Pena dc0a877fed
[Runtime] Enable the -Wsign-conversion on trampolines-invoke.m (#7429)
Enable the flag that was disabled via pragmas.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-14 05:44:51 -05:00
Sebastien Pouliot 089ca17e5a
[runtime] Catch and log exceptions in ObjC++ destructor (#7421)
`xamarin_notify_dealloc` can throw an exception (depending on the mode
used).

Throwing exception in a destructor is problematic in [Obj]C++ and can
abort the application. That might be fine in some cases but there's
not much point in doing so when we're about to forget everything about
that specific object.
2019-11-14 09:30:48 +01:00
Sebastien Pouliot c46d9857a4
[runtime] Filter isblank input to 8 bits values (#7420)
Help static analyzer by clarifying that only `char` will be given to
`isblank` so it does not look like it could be used to index an array
and gets out of bounds (important since this is user supplied values).

Digging down into `isblank` will get you to
> Using tainted variable _c as an index to array _DefaultRuneLocale.__runetype.
2019-11-13 20:46:20 +01: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
Sebastien Pouliot f0f06c1338
[runtime] Zeroize dummy member of structure in binding-generator (#7411)
This is not exposed so it should never be an issue - but just in
case something else goes wrong then it will only be 0 (and not
random values).
2019-11-12 21:03:56 +01:00
Sebastien Pouliot 0b323ca4cd
[runtime] Clarify redirect_io behaviour (#7409)
Change `redirect_io` to be easier to re-use correctly, i.e. returning the
file descriptor (instead of `0`).

Comment why the file descriptor are never released. It makes sense but
it's not obvious (even less in `redirect_io`) without comments.

Using static fields also makes it easier for static analysis (locals are
easier to process).

Finally reuse, mostly, the same string for the error message, i.e.

```
$ strings runtime//.libs/mac/libxammac.x86_64.dylib | grep "Could not redirect"
Xamarin.Mac: Could not redirect %s to `%s': %s
```
versus
```
$ strings runtime//.libs/mac/libxammac.x86_64.dylib | grep "Could not redirect"
Xamarin.Mac: Could not redirect stdout to `%s': %s
Xamarin.Mac: Could not redirect stderr to `%s': %s
```
2019-11-12 12:34:49 +01:00
Vincent Dondain 44fd06324a Merge master into d16-5 2019-11-08 10:21:12 -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 e55e434213
[runtime] Free `env-argv` in `xamarin-main` (#7352)
`get_mono_env_options` allocate memory so it must [1] be freed.

[1] to be polite since it will be freed when the app exit, which
will free everything anyway
2019-11-04 08:56:59 -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
Sebastien Pouliot c0e5176e9e
[runtime] Simplify Vision dlsym'ed functions (#7307)
* [runtime] Simplify Vision dlsym'ed functions

More code sharing - DRYer :)

It also remove complaints (from static analysis tools) that a `dlclose`
should be present. That's not really an issue here since it's reference
counted and won't be unloaded if you use the code (and such a call is
not added in the PR). It silence the warning since it's not a local
variable anymore.
2019-10-28 09:21:34 -04:00
Sebastien Pouliot 6fca42049d
[runtime] Throw a OutOfMemoryException when processing parameters (#7308)
`calloc` can return `null` and we're writing to the memory location
which would crash the process.

An `OutOfMemoryException` is the correct way to handle this (even if
will likely crash the process anyway).
2019-10-25 15:49:22 -04:00
Sebastien Pouliot 6bada3b20c
[runtime] Simplify `xamarin_switch_gchandle` by removed dead code (#7306)
If `old_gchandle` is not set (0) then the function returns early,
so can't be 0 after the `MONO_THREAD_ATTACH` meaning:

* the `else` branch is never executed;

* the `exception_gchandle` is never set to something other than 0

* ` if (exception_gchandle == 0) {` is always `true` and can be removed (diff looks bigger than it is because of indentation change)

= the call to `xamarin_process_managed_exception_gchandle` is unneeded
2019-10-25 13:27:52 -04:00
Sebastien Pouliot f2c7eb887c
[runtime] Ensure binding-generator full initialize NVector3[d] members (#7298) 2019-10-24 18:04:26 -04:00
William Kent 9be58e4b9c os_log(3) support (#7141)
* Add xamarin_os_log function

See the comment in the function for an explanation
of why this wrapper function is required.

* Add Darwin/OSLog.cs

* Add xamarin_os_log to header

This ensures that the symbol will not be subject
to C++ name mangling, therefore breaking mmp.
With this change applied, OSLog works as expected.

* Resolve stylistic PR feedback

* Move OSLog into CoreFoundation namespace

This is where the NativeObject class lives, and it
also feels like a better fit for a low-level API
that is available on non-Mac platforms than the
macOS-only Darwin namespace.
2019-10-24 17:46:03 -04:00
Marius Ungureanu 775fbf56d0 Optimize a bit of the runtime sorting code by avoiding branches (#7145)
It is the more common and optimized idiom to just substract two integer values rather than do conditional checks. This may yield better performance for the qsort function, improving a bit of the startup time in case of many items

* Use a better, non-overflowing version with bit twiddling hacks.

Credits to @mandel-macaque for the magic
2019-10-24 16:59:36 -04:00
Rolf Bjarne Kvinge 8128976084
[runtime] Split the build differently: build libraries for simulator and device separately. (#7143)
This has a couple of advantages:

* It makes it easier to add a catalyst version of these libraries (because it
  becomes cumbersome to build for catalyst when the build rules assumes we're
  building for both simulator and device).
* It makes it easier to create an xcframework of our libraries, because the
  contents in an xcframework is split like this.
2019-10-03 16:38:44 +02:00
Rolf Bjarne Kvinge 0418008046
[runtime] Use newer atomic functions. (#7119)
Fixes these warnings:

    shared.m:252:6: warning: 'OSAtomicDecrement32Barrier' is deprecated: first deprecated in watchOS 3.0 - Use std::atomic_fetch_sub() from <atomic> instead [-Wdeprecated-declarations]
            if (OSAtomicDecrement32Barrier (&bl->descriptor->ref_count) == 0) {
                ^
    /Applications/Xcode11.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:201:9: note: 'OSAtomicDecrement32Barrier' has been explicitly marked deprecated here
    int32_t OSAtomicDecrement32Barrier( volatile int32_t *__theValue );
            ^
    shared.m:270:2: warning: 'OSAtomicIncrement32' is deprecated: first deprecated in watchOS 3.0 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead [-Wdeprecated-declarations]
            OSAtomicIncrement32 (&source->descriptor->ref_count);
            ^
    /Applications/Xcode11.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:171:9: note: 'OSAtomicIncrement32' has been explicitly marked deprecated here
    int32_t OSAtomicIncrement32( volatile int32_t *__theValue );
            ^
    monotouch-debug.m:309:10: warning: 'OSAtomicIncrement32Barrier' is deprecated: first deprecated in watchOS 3.0 - Use std::atomic_fetch_add() from <atomic> instead [-Wdeprecated-declarations]
            int c = OSAtomicIncrement32Barrier (&http_send_counter);
                    ^
    /Applications/Xcode11.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.0.sdk/usr/include/libkern/OSAtomicDeprecated.h:182:9: note: 'OSAtomicIncrement32Barrier' has been explicitly marked deprecated here
    int32_t OSAtomicIncrement32Barrier( volatile int32_t *__theValue );
            ^
2019-09-27 07:15:59 +02:00
Rolf Bjarne Kvinge 2adecee3d9
Drop the Xcode 9.4 dependency. (#7044)
* Drop the Xcode 9.4 dependency.

Also bump mono to get the removal of the mac32 binaries.

New commits in mono/mono:

* mono/mono@70d6903053 [2019-08] [merp] Use a separate program as the hang supervisor. (#16900)
* mono/mono@4bff2b6370 [offsets-tool] Install clang into the user-specific python directory.
* mono/mono@81894ec8ca Implement WriteCore and ReadCore in DeflateStream
* mono/mono@bfbf823ca1 [ci] Remove more XCODE32_DIR usages (#16964)
* mono/mono@ce01b20a4d Add net_4.8.xml to EXTRA_DIST and bump binary-reference-assemblies again
* mono/mono@7a587d7fa6 Add .NET 4.8 reference assemblies (#16912)
* mono/mono@35e454a8f6 [sdks] Remove the mac32 build. (#16936)
* mono/mono@75eb342f53 [2019-08] [System] Make FileSystemWatcher backend non-static (#16926)
* mono/mono@5881981f79 [2019-08] [mini] Add missing membars when initializing rgctx entries (#16909)
* mono/mono@6290b6cd6e Temporarily disable embedded ppdb data decompression (#16911)
* mono/mono@a0e7f9eaf2 [2019-08] [arm64_32] make "Debug Mode" work on Watch series 4 with --interpreter (#16886)
* mono/mono@6275840a7f Rename bundle identifier for the various Mono.frameworks we create for Xamarin.iOS. Fixes xamarin/xamarin-macios#7005. (#16901)
* mono/mono@25f6093283 [corlib] Fix building nunit-lite twice (#16895)
* mono/mono@7ec17ba1be [2019-08] [android sdk] Add aprofutil tool (#16884)
* mono/mono@f755f3b539 [metadata] Fix leaks when handling a few attributes (#16850)
* mono/mono@5f9a2db39b [2019-08] Fix infrequent hangs in test-runner. (#16854)
* mono/mono@f31f5ea1f1 [2019-08] [threads] do not convert NULL thread name (#16828)
* mono/mono@20308e6f87 [aot] Do not wrap tool_prefix path when calling strip (#16820)
* mono/mono@cecda47c48 [aprofutil] Add -p and -f options
* mono/mono@824cc12ac3 Bump to mono/corefx@e79cf5b
* mono/mono@b77dc06a7e [aprofutil] Install the tool correctly (#16112)
* mono/mono@1848d78d60 [aotprof-tool] Initial import of AOT profiler tool (#15384)
* mono/mono@da0086e304 [2019-08] Add RenamedEvent* to FSW sources from CoreFX (#16756)
* mono/mono@0297b21b03 [msbuild][roslyn] Bump msbuild and roslyn to pull in new versions (#16768)
* mono/mono@40631e3b9e [2019-08] [aot] move method_addresses to data.rel.so section to avoid text relocations (#16751)
* mono/mono@68b77674e2 Vtable [i] can be null so this should be check before use it. Fixes #16712
* mono/mono@4a0b4f41ed [mini] publish global patches after JitInfo has been added
* mono/mono@7a1f63fde6 [debugger][android] It was not initialising seq_points on MonoCompile on Android, so when was compiling dynamic methods, seq_points wasn't created and we got the assert when try to single step.

Diff: 29b1ac19c9..70d6903053

* [tests] Add a fat macOS dylib for testing purposes.

Add a binary version of a fat macOS dylib (because we can't create one when we
need it since we can't create 32-bit slice anymore).

It was created like this (in tests/test-libraries):

	$ cat test.m
	int theUltimateAnswer ()
	{
		return 42;
	}

	$ /Applications/Xcode94.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang test.m -olibtest.i386.dylib -shared -isysroot /Applications/Xcode94.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework Foundation -framework CoreLocation -lz  -arch i386
	$ lipo -create libtest.i386.dylib .libs/macos/libtest.dylib -output libtest-fat.dylib

* [tests] Adjust XM tests to XM not having fat dylibs anymore.

* [tests] Adjust product tests to some libraries not being fat anymore.

* One more test fix.
2019-09-24 13:40:18 +02: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 b8f9dccdcc
Merge pull request #7003 from xamarin/master-xcode11
Merge xcode11 into master.
2019-09-18 07:47:14 -07:00
Rolf Bjarne Kvinge 693dc758ec
[runtime] Build and ship Xamarin[-debug].framework.dSYM. Fixes #7004. (#7014)
Fixes https://github.com/xamarin/xamarin-macios/issues/7004.
2019-09-18 05:19:17 -07:00
Rolf Bjarne Kvinge da2fd8bd22
[runtime] Silence, please. (#7013) 2019-09-18 02:00:44 -07:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Alex Soto a1fba90ecb
[ModelIO] Fix MDLAnimatedQuaternion bindings (#6991)
Quaternion does need our special marshalling.
2019-09-12 10:53:42 -04:00
Rolf Bjarne Kvinge 366f46ba21
[ModelIO] Implement new API introduced with Xcode 11 b1-7. (#6930) 2019-09-09 13:15:07 -07:00
Rolf Bjarne Kvinge 0008c20abf
Implement notarization. (#6928)
* Add a dummy x86_64 slice to all our native libraries that don't have one. (#6848)

Apple's notarization tool has a bug where they incorrectly flag Mach-O
binaries without an x86_64 slice, so make sure all our libraries have one.

* Jenkinsfile notarization (#6869)

* Add in notarization script for xamarin.mac/xamarin.iOS

* Flatten the list to get rid of the braces

* Add in keychain password

* Add login.keychain back in to access codesigning certificates

* Always sign pkgs, upload notarized copies

* Enable ios notarization and make notarized pkgs public

* Make notarization non-fatal

* Publish GH statuses for notarized PKGs

* Don't forget to declare URI variables for notarized pkgs

* report proper package links

* [jenkins] Improve package reporting.

* Use dummy function name which our tests won't complain about.
2019-09-09 00:34:11 -07:00
Rolf Bjarne Kvinge a9abc07cb3
Rename bundle identifier for the frameworks we ship. Fixes #6920. (#6926)
Rename the bundle identifier for the frameworks we ship, because apparently
Apple has added an App Store check to reject apps with multiple frameworks
with the same bundle identifier.

For some reason that includes rejecting frameworks that are both in iOS and
watchOS apps. This feels like a bug on Apple's end, but we can still easily
work around it, so let's do just that.

Strictly speaking it's not necessary to change the bundle identifier for tvOS
frameworks, but it's more consistent that way.

Fixes https://github.com/xamarin/xamarin-macios/issues/6920.
2019-09-06 09:30:49 -07:00
Rolf Bjarne Kvinge 678a422604
[registrar] Ignore method encodings when processing copyback arguments in the dynamic registrar. Fixes #6883. (#6904)
Method encodings do not change anything for us, so skip them when processing
copyback arguments so that they don't confuse the rest of the code.

Fixes https://github.com/xamarin/xamarin-macios/issues/6883.
2019-09-04 07:02:33 -07:00
Sebastien Pouliot 9e193eaca3
[foundation] Add support for NSValue/CGAffineTransform and StoreValueAtAddress overload (#6887)
Support for `NSValue`/`CGAffineTransform` exists in iOS/tvOS/watchOS,
from UIKit, but not for macOS. However this will be required for the
new protocols inside CoreImage.

Also add an overload for `StoreValueAtAddress` since the original
one was deprecated but we did not provide the new alternative to
update the code.
2019-08-30 18:00:04 -04:00
Rolf Bjarne Kvinge ec09193daf
Build native code with -std=c++14. (#6864)
* Build native code with -std=c++14.

Apple's headers now require -std=c++14 to compile their headers in C++ mode.

This fixes a compile error that would occur with the PhotosUI framework when
compiling code for C++.

* [mmp] Use -std=c++14 when compiling.

* Fix command line output.

* [mmp] Add all source files at the end, so they all get the -x clang argument applied.

* Limit when using c++14 in mtouch according to language.
2019-08-29 08:49:06 -07: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 f3fbbd7047
Add a dummy x86_64 slice to all our native libraries that don't have one. (#6848)
Apple's notarization tool has a bug where they incorrectly flag Mach-O
binaries without an x86_64 slice, so make sure all our libraries have one.
2019-08-26 09:51:50 -07:00
Rolf Bjarne Kvinge 80421bd655 [runtime] Fix xamarin_timezone_get_local_name signature. (#6593)
Define the xamarin_timezone_get_local_name function in a header, so that we
don't get C++ mangling. Also make it return a non-const char*, since the
caller is supposed to free the returned value.

Fixes this test:

* Xamarin.Tests.Misc.PublicSymbols(iOS): Failed libraries

    Expected: <empty>
    But was: "/Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.a:
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
        __Z31xamarin_timezone_get_local_namev
2019-07-18 10:36:44 +02:00
Jo Shields a29ae8e6df Bump to mono:2019-06 (#6196)
* Use the commonly used casing for `MSBuildSDKsPath` property

Handle "incorrectly" cased msbuild property names

msbuild property names are case insensitive. While generating the custom
app.config, in `SetToolsetProperty(..)` we try to update the property if
it already exists. But the name lookup was case sensitive, thus causing
the lookup to fail, resulting in two entries for the same property name
differing only in case. Eg. `MSBuildSDKsPath` vs `MSBuildSdksPath`.

* [mtouch] Whitelist new Brotli native symbols in Xamarin.Tests.Misc.PublicSymbols test

* [mtouch] Better assert in NoLLVMFailuresInWatchOS() test

We'd list the "LLVM failed" messages before even though the AOT might've crashed and the list is meaningless. Assert the exit code before that.

* [mtouch] Use new LLVM even for 32bit targets

See https://github.com/mono/mono/issues/14841 and https://github.com/mono/mono/issues/9621

* [mtouch] Work around slow LLVM in "don't link" test

See https://github.com/mono/mono/issues/14843

* Remove useless conditional

* Remove LLVM36 from Makefile

* [watch4] set right min version for arm64_32 based watch devices (#6307)

Fixes the confusion around `libmono-native*` (see for example ce5ba1e41d (commitcomment-33834491) ) when building with `MONO_BUILD_FROM_SOURCE=1`.

* reflect watchos64_32_version_min change from mono sdk

* Move mono hash info to mk/mono.mk so that existing scripts work.

* Add Makefile dependency on mono.mk where necessary

With 3e7bc29ade the Mono hash was moved from Make.config to mono.mk.

We need to add a Makefile dependency on this file wherever Make.config was used to track a Mono dependency.

* [tests] Copy mk/mono.mk to the XM test package.

* [tests] Update minOS version test after consolidating min watchOS versions everywhere.

Fixes this mtouch and mmptest failure:

    1) Failed : Xamarin.Tests.ProductTests.MinOSVersion(watchOS,MinwatchOS,WatchOSSimulator,False)
      Failures
      Expected: <empty>
      But was:  < "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (mono-runtime-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (bindings-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (bindings-generated-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (shared-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (runtime-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-invoke-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (xamarin-support-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (nsstring-localization-debug.arm64_32.o).", "Unexpected minOS version (expected 2.0.0, alternatively 2.0.0, found 5.1.0) in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a (trampolines-varargs-debug.arm64_32.o)."... >

* [mmp] Fix make clean target

It needs an -r to remove directories:

```
rm: bin: is a directory
rm: obj: is a directory
```

* Add new xamarin_timezone_get_local_name() to a few more places
2019-07-16 17:24:00 +02:00
Rolf Bjarne Kvinge a495077533
[xcode11] Stop building/shipping 32-bit Xamarin.Mac bits. Partial fix for #6300. (#6393)
This includes:

* 32-bit version of Xamarin.Mac.dll and OpenTK.dll
* XamMac.dll and XamMac.CFNetwork.dll
* 32-bit versions of the runtime libraries (libxammac.a and friends).
* 32-bit version of the partial static library for Xamarin.Mac.
* Classic support in the generator.

We still ship a few Classic files so that Visual Studio for Mac continue to detect that Xamarin.Mac is installed (otherwise VSfM won't open Classic projects, which makes it impossible to use the migration wizard).

This makes our build slightly faster.

Partial fix for #6300.
2019-07-15 10:19:24 -07:00
Steve Pfister a7cb29a4b7 Ensure Local TimeZone Id is Set For TimeZoneInfo.Local (#6564)
* Mirrors the runtime change found in https://github.com/mono/mono/pull/15667.

The fix here is to return the name of the local time zone so that TimeZoneInfo.Local
can have the correct Id.

* Added nil check on name.  Returns Local as the Id in the case of nil
2019-07-15 00:47:11 -07:00
Vincent Dondain 85c955d0b2 [arkit] Update for Xcode 11 beta 2 and beta 3 (#6460) 2019-07-04 07:33:37 +02: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 ab8817d000
Merge pull request #6294 from rolfbjarne/xcode11-watchsimulator
Fix building and launching watchOS apps. Fixes #6252.
2019-06-14 16:42:13 +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 62043318d7 [runtime] Assume we're in the US if the OS doesn't know.
This fixes a crash when running tests in the watchOS 6.0 simulator.
2019-06-14 02:17:37 +02:00
Manuel de la Pena a0a23a42d6 Add the missing flags to the native templates. 2019-06-04 18:42:46 +02:00
Alexander Köplinger 48b3b82410 Merge remote-tracking branch 'upstream/master' into binary-artifacts
# Conflicts:
#	builds/Makefile
#	external/mono
2019-05-22 20:07:18 +02:00
Bernhard Urban 06fcf59b78 [build/runtime] Add build rules for arm64_32 2019-05-22 08:05:40 +02:00
Alexander Köplinger 247a6bf551 Switch to mono archive and remove submodule 2019-05-21 22:16:02 +02:00
Rolf Bjarne Kvinge 47beab425d Merge remote-tracking branch 'origin/master' into arm64_32-v3 2019-05-16 15:26:15 -07:00
Chris Hamons 155bb924de
Revert "[launcher] Pass --use-map-jit to mono on XM app startup" (#6051)
- This reverts commit 2278512aba.
- This is no longer necessary due to https://github.com/mono/mono/pull/14395
2019-05-16 15:09:02 -07:00
Rolf Bjarne Kvinge f272f69e3a [runtime] Enable the varargs dynamic trampolines for arm64_32.
The varargs dynamic is not even close to correct for arm64_32, but it's still
better than failing to compile the runtime.

A proper dynamic registrar for arm64_32 is much more complicated, in
particular because we can't use assembly code, so it will have to be
implemented later.
2019-05-10 08:28:43 +02:00
Bernhard Urban 4606d37d64 [build/runtime] Add build rules for arm64_32 2019-05-10 08:28:43 +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 37a280d974
[runtime] Put LOGZ directive in a header to not duplicate it everywhere. (#6001) 2019-05-06 19:29:28 +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 83058e339c
[runtime] Fix crash in the x86_64 dynamic registrar. (#5989)
In [this][1] innocuous-looking commit I made the x86_64 dynamic registrar
crash when TRACE is defined. The underlying problem is that CallState's rsi
field is re-used as rax upon exit of the trampoline. This means that the
CallState.sel () function that gets the selector, will instead get the return
value upon exit. When TRACE is defined, we try to print the selector upon
exiting the trampoline, and since the rsi field is now the rax field, we end
up trying to print the return value as if it were a selector, and things go
slightly sideways.

[1]: https://github.com/xamarin/xamarin-macios/commit/464882d14a83
2019-05-06 07:25:49 +02:00
Rolf Bjarne Kvinge 50f573e84e [runtime] Add new functions to the header so that they don't use C++ mangling.
Fixes these test failures:

    2) Failed : Xamarin.Tests.Misc.PublicSymbols(iOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    3) Failed : Xamarin.Tests.Misc.PublicSymbols(tvOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    4) Failed : Xamarin.Tests.Misc.PublicSymbols(watchOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    5) Failed : Xamarin.Tests.Misc.PublicSymbols(macOSMobile)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 868b3ecf44 [registrar] Add support for ref/out arrays. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge e6790b277b [registrar] Fix support for ref string parameters. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge b750056271 [registrar] Fix/implement returning SEL/Class in a ref/out parameter in the registrars. 2019-04-30 14:29:24 +00: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 128fa1815f [registrar] Some more simplification. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 484b9a3c37 [registrar] Don't let a failure to copy back a parameter go unnoticed.
Now that we ignore parameters we're not copying back, we can throw an
exception if we run into a parameter we don't know how to copy back.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge c7a6342900 [registrar] Simplify code a bit and reduce indentation.
Best reviewed by ignoring whitespace.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge a1bf26af90 [registrar] Simplify copyback loop a little bit.
Simplify by having a single loop variable, and remove the usage of the
other ('ofs'), since it's not needed.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 141caaf8dc [registrar] Improve writeback logic for out/ref parameters.
* Keep track of which parameters needs to be written back. This makes sure the
  writeback loop doesn't run into non-writeback-parameters it doesn't know how
  to handle (by skipping them completely).

* Keep track of the (post-marshal) input to the out/ref parameters, so that we
  know whether we need to marshal anything back in the writeback loop.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 4a173ec96f [registrar] Fix multiple ref/out parameters for a single method.
The previous code would break the loop looking for ref/out parameters after finding the first one.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 497bacc6af [registrar] Refactor to reduce indentation a bit.
Best viewed by ignoring whitespace.
2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge ab5698c451 [registrar] Create a xamarin_nsstring_to_string to avoid code duplication. 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 0f9c122800 [runtime] Add new functions to the header so that they don't use C++ mangling.
Fixes these test failures:

    2) Failed : Xamarin.Tests.Misc.PublicSymbols(iOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    3) Failed : Xamarin.Tests.Misc.PublicSymbols(tvOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    4) Failed : Xamarin.Tests.Misc.PublicSymbols(watchOS)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"

    5) Failed : Xamarin.Tests.Misc.PublicSymbols(macOSMobile)
      Failed libraries
      Expected: <empty>
      But was:  "/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system-debug.a:
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_nsobject_to_objectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z26xamarin_object_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_inativeobject_to_nsobjectP10MonoObjectPvPj
    	__Z33xamarin_nsobject_to_inativeobjectP11objc_objectPvP10_MonoClassS1_Pj
    	__Z40xamarin_nsobject_to_inativeobject_staticP11objc_objectPvP10_MonoClassS1_Pj"
2019-04-29 15:04:07 +02:00
Rolf Bjarne Kvinge 6e9afbc605 [registrar] Add support for ref/out arrays. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 87a5b2dac8 [registrar] Fix support for ref string parameters. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge af38ac286c [registrar] Fix/implement returning SEL/Class in a ref/out parameter in the registrars. 2019-04-26 11:20:15 +02: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 ae879324a6 [registrar] Some more simplification. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 02d2dfc60e [registrar] Don't let a failure to copy back a parameter go unnoticed.
Now that we ignore parameters we're not copying back, we can throw an
exception if we run into a parameter we don't know how to copy back.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 5871040bb3 [registrar] Simplify code a bit and reduce indentation.
Best reviewed by ignoring whitespace.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge e80f4d5dca [registrar] Simplify copyback loop a little bit.
Simplify by having a single loop variable, and remove the usage of the
other ('ofs'), since it's not needed.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge a3278ff178 [registrar] Improve writeback logic for out/ref parameters.
* Keep track of which parameters needs to be written back. This makes sure the
  writeback loop doesn't run into non-writeback-parameters it doesn't know how
  to handle (by skipping them completely).

* Keep track of the (post-marshal) input to the out/ref parameters, so that we
  know whether we need to marshal anything back in the writeback loop.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 9b60eebaef [registrar] Fix multiple ref/out parameters for a single method.
The previous code would break the loop looking for ref/out parameters after finding the first one.
2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge ad4cc04af9 [registrar] Refactor to reduce indentation a bit.
Best viewed by ignoring whitespace.
2019-04-26 11:20:15 +02:00