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

421 Коммитов

Автор SHA1 Сообщение Дата
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