platform/upstream/dotnet/runtime.git
5 years ago[glib] Use clock_nanosleep if available (mono/mono#15443)
Vlad Brezae [Fri, 19 Jul 2019 07:21:21 +0000 (10:21 +0300)]
[glib] Use clock_nanosleep if available (mono/mono#15443)

According to the manual, it is recommended to use clock_nanosleep instead of nanosleep when the sleep can be repeatedly interrupted by signals and resumed. The remaining sleep interval was greater than the original timespec.

Fixes random timeouts of finalizer-abort.exe

Commit migrated from https://github.com/mono/mono/commit/c449308f8bd1c83131b6613711797533504d0c24

5 years ago[loader] Pass ALC to mono_domain_loaded_internal, and then to domain search hook...
Aleksey Kliger (λgeek) [Fri, 19 Jul 2019 04:01:56 +0000 (00:01 -0400)]
[loader] Pass ALC to mono_domain_loaded_internal, and then to domain search hook (mono/mono#15743)

* Add a temporary mono_domain_ambient_alc function

Just use this to mark places where we need to pass through an ALC

* [runtime] Mark mono_assembly_loaded_full external only.

Runtime should use mono_assembly_loaded_internal.

* [loader] Add mono_install_assembly_search_hook_v2

Use it to install mono_domain_assembly_search and
mono_domain_assembly_postload_search.

The principal difference is that we can pass an assembly load context to the
hook.  But also we cleanup the "requesting assembly" hack for
mono_domain_assembly_postload_search.

* [domain] Comments and mono_assembly_get_alc ()

* [debugger] Comment on suspicious loader lock

Commit migrated from https://github.com/mono/mono/commit/a37ad98b470381950c876bb0928cab57fe8156b2

5 years agoMerge pull request mono/mono#15704 from lewing/bump-msbuild-nuget-5.2
Larry Ewing [Fri, 19 Jul 2019 00:45:02 +0000 (20:45 -0400)]
Merge pull request mono/mono#15704 from lewing/bump-msbuild-nuget-5.2

Bump msbuild to track xplat-master

Commit migrated from https://github.com/mono/mono/commit/34be988e33ecb66d724b2dabdba761e8d836ed05

5 years ago[mini] Runtime check if boxing is needed for DIM constrained calls (mono/mono#15729)
Aleksey Kliger (λgeek) [Thu, 18 Jul 2019 20:46:55 +0000 (16:46 -0400)]
[mini] Runtime check if boxing is needed for DIM constrained calls (mono/mono#15729)

This is to handle the following example.  The issue is that in Check() we have
a constrained call where the called method is IAdder`1<!!U>::PlusPlus() which
is a default interface method, and we need to determine at runtime whether to
box the this argument.

```
using System;

public interface IAdder<T> {
int Add (int x);

int PlusPlus () {
return Add (1);
}
}

interface IGen3<T> { }

struct Adder<T> : IAdder<IGen3<T>> {
int _field;
public int Add (int x) {
_field = x + _field;
return _field;
}
}

public class P {
public static int Check<T, U>(T t) where T : IAdder<U> {
return t.PlusPlus () + t.PlusPlus ();
}

public static void Main () {
var x = new Adder<object> ();
int y = Check<Adder<object>, IGen3<object>> (x);
Console.WriteLine ("expect 2, got {0}", y);
}
}
```

Commit migrated from https://github.com/mono/mono/commit/3f55bfb5cc305c1c416edf84fff5440843784deb

5 years ago[interp] Use correctly-sized writes and reads in Unsafe.AddByteOffset and Unsafe...
imhameed [Thu, 18 Jul 2019 18:16:46 +0000 (11:16 -0700)]
[interp] Use correctly-sized writes and reads in Unsafe.AddByteOffset and Unsafe.ByteOffset (mono/mono#15677)

[interp] Use correctly-sized writes and reads in Unsafe.AddByteOffset and Unsafe.ByteOffset

The truncated store to the top of the stack in`MINT_INTRINS_UNSAFE_BYTE_OFFSET` could cause the upper bytes of the address used as the first argument to `ByteOffset` to linger, yielding inaccurate (and usually excessively large) offsets on systems where `sizeof(void *) > sizeof(guint32)`; this made
`System.Text.Unicode.Utf8Utility.GetPointerToFirstInvalidByte` return nonsense results.

The truncation in `MINT_INTRINS_UNSAFE_ADD_BYTE_OFFSET` hasn't, as far as I know, caused any test failures. But `AddByteOffset` takes an `IntPtr` as its second argument, not an `int`.

Fixes mono/mono#14847.

Commit migrated from https://github.com/mono/mono/commit/561b400baa6322dcb3fb6d2b92bd48513fab79f7

5 years ago[netcore] Clean up rsp-file (mono/mono#15700)
Maxim Lipnin [Thu, 18 Jul 2019 16:34:10 +0000 (19:34 +0300)]
[netcore] Clean up rsp-file (mono/mono#15700)

Commit migrated from https://github.com/mono/mono/commit/ab4eca1785672ae9e2aa4930ea45e61a5743aa11

5 years ago[netcore] Revise items in CoreFX.issues.rsp (mono/mono#15664)
Egor Bogatov [Thu, 18 Jul 2019 16:33:38 +0000 (19:33 +0300)]
[netcore] Revise items in CoreFX.issues.rsp (mono/mono#15664)

Commit migrated from https://github.com/mono/mono/commit/e6d2091a245cd4ecda087a53d1e0c60923323482

5 years ago[loader] Add MonoAssemblyLoadContext; stop sharing MonoImages on netcore (mono/mono...
Aleksey Kliger (λgeek) [Wed, 17 Jul 2019 21:35:15 +0000 (17:35 -0400)]
[loader] Add MonoAssemblyLoadContext; stop sharing MonoImages on netcore (mono/mono#15527)

Implement a couple of things:

1. Add a `MonoAssemblyLoadContext` opaque struct
2. On netcore Mono, use it to keep track of  which `MonoImage`s are loaded.  (Addresses part of mono/mono#13891)

In a bit more detail:

- Add a `MonoLoadedImages` struct to hold the hash tables that we use for checking if a `MonoImage` is already loaded
- Add an opaque `MonoAssemblyLoadContext` typedef
- (Framework Mono) Add a `get_global_loaded_images()` function to get the shared `MonoLoadedImages`
- (netcore Mono) Add a `MonoAssemblyLoadContext` struct that owns a `MonoLoadedImages` and add a `default_alc` member to `MonoDomain
- Pass a `MonoAssemblyLoadContext*` to most `MonoImage`-loading functions - on Framework Mono its usually NULL and we fall back to the global loaded images, on netcore Mono it's usually `domain->default_alc->loaded_images`
- (netcore Mono) Create a default Assembly Load Context when a `MonoDomain` is created
- Add a `MonoAssemblyLoadContext*` field to `MonoAssemblyLoadRequest` and pass an ALC in a few places.

---

Remaining work:

(netcore Mono) There are still places where a `MonoAssemblyLoadRequest` or a `MonoAssemblyOpenRequest` has a `NULL` ALC - those will need to be tracked down and fixed.

(netcore Mono) Eventually `MonoAssemblyLoadContext` should keep track of the loaded `MonoAssembly`s, not just images.  One goal on netcore Mono is to ifdef out `MonoDomain:domain_assemblies`.

---

* [loader] Add a MonoLoadedImages struct to own the MonoImage sharing

   Initially, there's just a single global set of loaded images.

   Once we have AssemblyLoadContext support, each ALC will have a separate set.

   NOTE:
     - Some of the existing Mono API is difficult to support with this design
       since it assumes each MonoImage is loaded at most once.

* [loader] Add a MonoAssemblyLoadContext member to MonoImage for netcore

* [loader] Unregister image from its owner when closing

* [loader] Pass MonoLoadedImages to register_image

* [domain] Add mono_domain_default_alc and mono_alc_get_loaded_images

* [loader] Add an AssemblyLoadContext argument to mono_image_loaded_internal

* [metadata] Add mono_image_get_alc ()

* [loader] Pass MonoAssemblyLoadContext to mono_image_open_from_data_internal

* [loader] Pass MonoAssemblyLoadContext to mono_image_open_from_module_handle

* [loaded] Pass MonoLoadedImages to mono_image_open_a_lot_parameterized

* [loader] Pass MonoAssemblyLoadContext to mono_image_open_a_lot

* [runtime] Mark mono_image_open_full external only

   Runtime should use mono_image_open_a_lot.

* [runtime] Mark mono_image_loaded_by_guid external only

   Also mark mono_image_loaded_by_guid_full external only

   Runtime will need some (as yet unwritten) mechanism that takes a MonoAssemblyLoadContext as an argument.

* [domain] Create a default ALC for each MonoDomain

* [netcore] Pass default ALC in mono_core_preload_hook

   If the assembly name matches a trusted platform assembly, open it in the default ALC of the root domain

* [mini] Open main assembly in default ALC in the root domain

* [netcore] Don't define get_global_loaded_images()

   Every assembly load request should come from an assembly load context.  Each ALC has a set of loaded images.  So we should never need a global list.

   With this PR, we no longer share MonoImages across distinct ALCs.  So in principle, each ALC can open the same assembly but resolve its references in different ways.

   Fixes part of https://github.com/mono/mono/issues/13891

* [runtime] Mark mono_pe_file_open external only

* [loader] Pass MonoAssemblyLoadContext to mono_image_open_raw  and mono_image_open_metadata_only

* [loader] Pass MonoAssemblyLoadContext to do_mono_image_open and set MonoImage:alc

* [loader] Add version 2 of assembly preload hook

   Pass MonoAssemblyLoadContext through the preload hook.  This is used in mono_assembly_request_byname_nosearch which, in turn, is called by load_reference_by_aname_default_asmctx which is used to resolve references from one assembly to another.

* [netcore] Pass native ALC ptr to AssemblyLoadContext.InternalLoadFile

* [netcore] Implement AssemblyLoadContext.InternalInitializeNativeALC

   also implement mono_domain_create_individual_alc ()

* [netcore] Pass ALC to System.Reflection.Assembly.InternalLoad

   Pass the domain default ALC to mono_assembly_load ()

   Also pass MonoAssemblyLoadContext to mono_assembly_load_full_gac_base_default ()

* [loader] Implement MONO_LOADED_IMAGES_ASSEMBLY properly

   Store the MonoLoadedImages for netmodules in the MonoImage for the main image of an assembly.  This is also used by SRE - the dummy module of the AssemblyBuilder has the loaded_images that contains the ModuleBuilders.

* [loader] Use global_loaded_images for netmodules with framework Mono

   The new stuff is only for ALC support in netcore

* [loader] Drop netmodule support in MonoAssemblyLoadContext

   netmodules are not supported in netcore

* [loader] Spin out image hashing out of image.c

   Move MonoLoadedImages support code to loaded-images.c loaded-images-global.c and loaded-images-netcore.c

Also spin out assembly-load-context.c for MonoAssemblyLoadContext functions

* Move ALC icall to assembly-load-context.c

* formatting fix

* [msvc] Add new files to .filters

* update comments

* [image] Change mono_loaded_images_remove_image to decrement the refcount

Decrement the refcount and remove the image from the loaded images hashes in
one place.  Change mono_loaded_images_remove_image to return TRUE if the rest
of image unloading should proceed or not.

* [loader] Drop unused argument to mono_alc_init

Commit migrated from https://github.com/mono/mono/commit/d5b374bb51a07bf3525d63b4cef6ad6979c27d07

5 years agoFix leaks in mono_lookup_internal_call_full_with_flags, for lack of destructors....
Jay Krell [Wed, 17 Jul 2019 19:09:19 +0000 (12:09 -0700)]
Fix leaks in mono_lookup_internal_call_full_with_flags, for lack of destructors. (mono/mono#15659)

* Fix leaks in mono_lookup_internal_call_full_with_flags, for lack of C++ destructors.

* Initialize `sigstart` also.

Commit migrated from https://github.com/mono/mono/commit/e2ce0a16a61a02511728d217d92156691dc42289

5 years agoconfigure/makefile To support updating zlib to 1.2.11. (mono/mono#15697)
Jay Krell [Wed, 17 Jul 2019 19:07:56 +0000 (12:07 -0700)]
configure/makefile To support updating zlib to 1.2.11. (mono/mono#15697)

Commit migrated from https://github.com/mono/mono/commit/b08aa719484455c33553ae52394bb48840d653f5

5 years agoPrint two bytes at a time in mono_pe_file_map conversion error (mono/mono#15523)
Ryan Lucia [Wed, 17 Jul 2019 18:49:30 +0000 (11:49 -0700)]
Print two bytes at a time in mono_pe_file_map conversion error (mono/mono#15523)

* Print two bytes at a time

* Iterate over gunichar2

Commit migrated from https://github.com/mono/mono/commit/86e22c4a7fd1477a5d12df3d2495a2c4bbf84ed4

5 years agoAdd com.apple.security.cs.allow-unsigned-executable-memory exception to hardened...
Alexander Köplinger [Wed, 17 Jul 2019 18:48:06 +0000 (20:48 +0200)]
Add com.apple.security.cs.allow-unsigned-executable-memory exception to hardened runtime entitlements (mono/mono#15721)

This avoids the issue from https://github.com/mono/mono/issues/13445 when hardened runtime is enabled.

Commit migrated from https://github.com/mono/mono/commit/c62473114a9a994676383047104549604230c8e6

5 years agoMerge pull request mono/mono#15713 from lewing/sdk-disable-gac
Larry Ewing [Wed, 17 Jul 2019 13:09:36 +0000 (09:09 -0400)]
Merge pull request mono/mono#15713 from lewing/sdk-disable-gac

[ios][android] disable gac in ios and android sdk builds

Commit migrated from https://github.com/mono/mono/commit/36b9e006f324f4291eb0dc97420142339bfc20a8

5 years ago[netcore] Clear system last error before P/Invoke calls with SetLastError=true (mono...
Filip Navara [Wed, 17 Jul 2019 12:44:50 +0000 (14:44 +0200)]
[netcore] Clear system last error before P/Invoke calls with SetLastError=true (mono/mono#15703)

Fixes mono/mono#15691

Commit migrated from https://github.com/mono/mono/commit/9af45e09db9c0d9813be46cd89d7c5092ea9600b

5 years ago[runtime] Fix the error message for exceptions created from MonoError. (mono/mono...
Zoltan Varga [Wed, 17 Jul 2019 01:09:39 +0000 (21:09 -0400)]
[runtime] Fix the error message for exceptions created from MonoError. (mono/mono#15705)

Fixes https://github.com/mono/mono/issues/15692.

Commit migrated from https://github.com/mono/mono/commit/553fee6f03250a981eddf3a0bc9b6fa4f68ecf43

5 years ago[interp] Make the code GC safe on wasm. (mono/mono#15695)
Zoltan Varga [Tue, 16 Jul 2019 21:49:33 +0000 (17:49 -0400)]
[interp] Make the code GC safe on wasm. (mono/mono#15695)

* [interp] Pass the vtable to get_virtual_method () to reduce the number of objrefs being passed around.

* No longer a prototype.

* [interp] Make the code GC safe on wasm.

* Use frame->o only on WASM.

Commit migrated from https://github.com/mono/mono/commit/978653633b976b65497c931252c6fb8b8724a2a9

5 years agoFix use of freed memory. (mono/mono#15660)
Jay Krell [Tue, 16 Jul 2019 20:16:52 +0000 (13:16 -0700)]
Fix use of freed memory. (mono/mono#15660)

Fix use of freed memory.
Move the free later, on the assumption that the free itself doesn't use memory now freed before it.
Found with Valgrind.

Commit migrated from https://github.com/mono/mono/commit/43f1a268045a1a3746bfd4a610b7b4874599aa38

5 years ago[netcore] Use the strict loader (mono/mono#15668)
Aleksey Kliger (λgeek) [Tue, 16 Jul 2019 18:30:16 +0000 (14:30 -0400)]
[netcore] Use the strict loader (mono/mono#15668)

Mono historically was quite lax in how it resolved assembly references - it
would pick the first assembly with a matching simple name.  The "strict"
mode (available in framework Mono with `--assembly-loader=strict`) follows the
spec behavior: the version and public key token of the candidate assembly must
match what is requested.

Commit migrated from https://github.com/mono/mono/commit/d8a679375d706e992d590c3eb90e1c57cb2864e7

5 years ago[netcore] Ignore public key when matching assemblies (mono/mono#15678)
Filip Navara [Tue, 16 Jul 2019 18:05:26 +0000 (20:05 +0200)]
[netcore] Ignore public key when matching assemblies (mono/mono#15678)

Related to mono/mono#15669

Commit migrated from https://github.com/mono/mono/commit/d2f7851c92f697ef96fe402353768f011d465827

5 years ago[debugger] Don't list finalizer gc thread if it's not executing managed code (mono...
Thays Grazia [Mon, 15 Jul 2019 14:58:04 +0000 (11:58 -0300)]
[debugger] Don't list finalizer gc thread if it's not executing managed code (mono/mono#15618)

* The example that reproduces the bug does this:
var thread = vm.GetThreads()[0];
greetingValue = program.InvokeMethod(thread, greeting, new Value[0]) as StringMirror;

But sometimes the Thread[0] was the MainThread of the program and it works, and other times was the GC Finalizer, but when it tries to run something on GC Finalizer thread, the thread is not suspended and throws an exception.
In the fix I removed the Finalizer thread if it's not executing a managed code of the list that is returned when CMD_VM_ALL_THREADS is called.

Fix mono/mono#13311

Commit migrated from https://github.com/mono/mono/commit/73128453daff8966f1c8eeacb734579971b02218

5 years agoFix leak in create_runtime_invoke_info when mono_class_vtable_… (mono/mono#15661)
Jay Krell [Mon, 15 Jul 2019 09:34:54 +0000 (02:34 -0700)]
Fix leak in create_runtime_invoke_info when mono_class_vtable_… (mono/mono#15661)

Commit migrated from https://github.com/mono/mono/commit/ceb09980f56bcafbe95247f081bf4233c9544e25

5 years agoTrim mono_mini_arch_lock, mono_mini_arch_unlock, mini_arch_mutex. (mono/mono#15663)
Jay Krell [Mon, 15 Jul 2019 09:34:35 +0000 (02:34 -0700)]
Trim mono_mini_arch_lock, mono_mini_arch_unlock, mini_arch_mutex. (mono/mono#15663)

Commit migrated from https://github.com/mono/mono/commit/6cd6f65f69b35aec860e23e3c2ffcecb29f79791

5 years ago[llvm] avoid FP elimination on iOS/armv7 (mono/mono#15617)
Bernhard Urban [Sun, 14 Jul 2019 20:15:56 +0000 (22:15 +0200)]
[llvm] avoid FP elimination on iOS/armv7 (mono/mono#15617)

[llvm] avoid FP elimination on iOS/armv7

Instead of
```
push    {r4, r5, r6, r7, r10, r11, lr}
```

LLVM will generate
```
push    {r4, r5, r6, r7, lr}
add     r7, sp, mono/mono#12
push    {r9, r10}
```

Seems like this https://github.com/mono/llvm/commit/mono/mono@a04e9e4a0af16f15ace258e81448b7eeca5ff599 assumes that `-disable-fp-elim` is passed for iOS targets. I wondered why this wouldn't break things for them, but when you run `clang` from Xcode with `-v`, you will discover that its driver passes `-mdisable-fp-elim`.

Together with https://github.com/mono/llvm/pull/48 this fixes crashes with FullAOT+LLVM on iOS 32bit.

Fixes https://github.com/mono/mono/issues/15058

Contributes to https://github.com/mono/mono/issues/9621

Commit migrated from https://github.com/mono/mono/commit/9a19bdb6e63590875e9ac80496720dd365611754

5 years agoAdd configure flag to disable GAC support; disable GAC in netcore (mono/mono#15681)
Aleksey Kliger (λgeek) [Sat, 13 Jul 2019 15:36:37 +0000 (11:36 -0400)]
Add configure flag to disable GAC support; disable GAC in netcore (mono/mono#15681)

* [runtime] Add configure flag to disable GAC support

* [netcore] Disable GAC support

Commit migrated from https://github.com/mono/mono/commit/70e9f8c5010cbe118f6043ac34e1e556a9e15d25

5 years agoMerge pull request mono/mono#10202 from Unity-Technologies/fix-dynamic-method-marshal...
Larry Ewing [Fri, 12 Jul 2019 23:22:01 +0000 (18:22 -0500)]
Merge pull request mono/mono#10202 from Unity-Technologies/fix-dynamic-method-marshal-info

Don't try to access metadata for dynamic method added to non-dynamic …

Commit migrated from https://github.com/mono/mono/commit/016a5253bb57c376c9b444387edf22d3facc6ed8

5 years ago[ci] Upload mac-entitlements.plist to azure when uploading .pkg
Alexander Köplinger [Fri, 12 Jul 2019 17:46:50 +0000 (19:46 +0200)]
[ci] Upload mac-entitlements.plist to azure when uploading .pkg

So it can be used by the codesigning job.

Commit migrated from https://github.com/mono/mono/commit/e3d5b23ff96a3742dd8f5592c956c3c1d454c57e

5 years agoAdd hardened runtime testing to Catalina lane (mono/mono#15589)
Jo Shields [Fri, 12 Jul 2019 13:29:00 +0000 (09:29 -0400)]
Add hardened runtime testing to Catalina lane (mono/mono#15589)

* Permit DYLD mangling, so p/invokes work from non-system paths

* Add com.apple.security.cs.disable-library-validation

This is required for the .dylibs used in p/invokes to work.

* Use adhoc signing

Commit migrated from https://github.com/mono/mono/commit/202dca075b5110398a77e659e1bc128e6eda51e5

5 years agoextern "C" reduction. (mono/mono#15634)
Jay Krell [Fri, 12 Jul 2019 10:01:35 +0000 (03:01 -0700)]
extern "C" reduction. (mono/mono#15634)

Commit migrated from https://github.com/mono/mono/commit/81ed8dfaff96bb035ad5cadb19782424e183b3ed

5 years ago[jit] Fix the devirt of EqualityComparer<byte>. (mono/mono#15644)
Zoltan Varga [Fri, 12 Jul 2019 05:24:52 +0000 (01:24 -0400)]
[jit] Fix the devirt of EqualityComparer<byte>. (mono/mono#15644)

* [jit] Fix the devirt of EqualityComparer<byte>.

* Add a test.

* Fix the tests.

Commit migrated from https://github.com/mono/mono/commit/04034032f4c7959d58daf1eaf878ea85a80bc74d

5 years ago[netcore] Do not inline ThrowHelpers, fix SkipFrames handling. (mono/mono#15607)
Egor Bogatov [Thu, 11 Jul 2019 19:42:14 +0000 (22:42 +0300)]
[netcore] Do not inline ThrowHelpers, fix SkipFrames handling. (mono/mono#15607)

1) Do not inline ThrowHelpers (e.g. `static void ThrowException() => throw new Exception();`)
2) `get_trace` incorrectly handles `skip` argument
3) fix broken ci (`dl-test-assets.py` is not python2 compatible any more)

Fixes https://github.com/mono/mono/issues/15182
Fixes https://github.com/mono/mono/issues/15188

Commit migrated from https://github.com/mono/mono/commit/792bfbff913f80a663ab086c71ac5a238e64fffa

5 years ago[netcore] Fix IsAssignableFrom (mono/mono#15641)
Egor Bogatov [Thu, 11 Jul 2019 19:41:12 +0000 (22:41 +0300)]
[netcore] Fix IsAssignableFrom (mono/mono#15641)

Mono used to return `true` for these three cases (see System.Reflection.Tests.TypeTests.IsAssignableFrom tests):
```csharp
using System.Reflection;
using Xunit;

namespace ConsoleApp
{
    public static class Program
    {
        static void Main(string[] args)
        {
            Assert.False(typeof(TI_Interface1[]).GetTypeInfo().IsAssignableFrom(
                         typeof(TI_StructWithInterface[]).GetTypeInfo()));

            Assert.False(typeof(int?[]).GetTypeInfo().IsAssignableFrom(
                         typeof(int[]).GetTypeInfo()));

            Assert.False(typeof(int[]).GetTypeInfo().IsAssignableFrom(
                         typeof(int?[]).GetTypeInfo()));

        }
    }

    public interface TI_Interface1 { }
    public struct TI_StructWithInterface : TI_Interface1 { }
}
```
Fixes https://github.com/mono/mono/issues/10848
Fixes https://github.com/mono/mono/issues/15080

Unrelated  System.Reflection.MetadataLoadContext.Tests tests that don't fail anymore:
Close https://github.com/mono/mono/issues/15351
Close https://github.com/mono/mono/issues/15348
Close https://github.com/mono/mono/issues/15347
Close https://github.com/mono/mono/issues/15346
Close https://github.com/mono/mono/issues/15345
Close https://github.com/mono/mono/issues/15343
Close https://github.com/mono/mono/issues/15342
Close https://github.com/mono/mono/issues/15341
Close https://github.com/mono/mono/issues/15338
Close https://github.com/mono/mono/issues/15337
Close https://github.com/mono/mono/issues/15336

Commit migrated from https://github.com/mono/mono/commit/972cd6536510d3174e057393b50998c610cb2473

5 years ago[metadata] Respect unmanaged calling conventions in function signatures. (mono/mono...
Zebediah Figura [Thu, 11 Jul 2019 18:38:03 +0000 (13:38 -0500)]
[metadata] Respect unmanaged calling conventions in function signatures. (mono/mono#15363)

According to ECMA-335 § II.15.3, calling conventions other than "default" and
"vararg" describe unmanaged methods. Accordingly they should be treated as
pinvokes so that that their calling conventions are respected.

Commit migrated from https://github.com/mono/mono/commit/2f1b50bfbf9db129d844dad8e45ec248f0c877e4

5 years agoMisc AIX/PASE tweaks (mono/mono#15651)
Calvin Buckley [Thu, 11 Jul 2019 16:42:47 +0000 (13:42 -0300)]
Misc AIX/PASE tweaks (mono/mono#15651)

* Partial enablement of alternate stack for AIX/i

It turns out much like macOS, AIX doesn't like to do mprotect/valloc
for the first thread's guard pages, so skip those. It seems mostly
fine except for one or two crashes causes it to grab the wrong IAR
and deadlock dumping memory. As such, leave the code and configure
script override to disable in place, just change the comment and
add support code.

* Use Qp2getifaddrs on PASE

Not sure if proper way to implement. Reuses getifaddrs code as much
as possible, since it's merely a name change based on the docs, due
to it being namespaced in case AIX gets it or something.

I'm not sure how many of these codepaths still work properly;
one had a questionable order of ifdef.

This will eventually prepare for CoreFX NetworkInterface, so test
it here.

Commit migrated from https://github.com/mono/mono/commit/41469ee55a6db885c1b46c29c454e503c0965f21

5 years agoRemove configure cruft -- Interlocked and GetProcessId. (mono/mono#15633)
Jay Krell [Thu, 11 Jul 2019 11:39:12 +0000 (04:39 -0700)]
Remove configure cruft -- Interlocked and GetProcessId. (mono/mono#15633)

They are never checked and all relevant systems have all of them.

Commit migrated from https://github.com/mono/mono/commit/2950bd39e14586c3052baaea59b39ef67f3138b6

5 years agoCleanup mono_threads_platform_get_stack_bounds. (mono/mono#15632)
Jay Krell [Thu, 11 Jul 2019 11:35:57 +0000 (04:35 -0700)]
Cleanup mono_threads_platform_get_stack_bounds. (mono/mono#15632)

Fix mingw warning unused function __readfsdword.

Commit migrated from https://github.com/mono/mono/commit/7bdff9065b93319639fc8379a05c91b8ff12bc2e

5 years ago[debugger] Add intrinsic for creating a byte array (mono/mono#15591)
Thays Grazia [Wed, 10 Jul 2019 21:29:13 +0000 (18:29 -0300)]
[debugger] Add intrinsic for creating a byte array (mono/mono#15591)

Fixes mono/mono#15268

Commit migrated from https://github.com/mono/mono/commit/4917c086b6f638254cefc6de4fccc700d87db97b

5 years ago[interp] Add JitHelper intrins for enum comparison (mono/mono#15635)
Vlad Brezae [Wed, 10 Jul 2019 17:42:50 +0000 (20:42 +0300)]
[interp] Add JitHelper intrins for enum comparison (mono/mono#15635)

Fixes https://github.com/mono/mono/issues/15596

Commit migrated from https://github.com/mono/mono/commit/2f2a9bcc373d1ef7566f56bfae91038311313742

5 years ago[netcore] Don't default to mscorlib in Assembly.GetType (mono/mono#15488)
Ryan Lucia [Wed, 10 Jul 2019 16:21:56 +0000 (09:21 -0700)]
[netcore] Don't default to mscorlib in Assembly.GetType (mono/mono#15488)

* [netcore] Don't default to mscorlib in Assembly.GetType

* Add argument for whether or not to search mscorlib

* Reorder and rename search_mscorlib argument

* Use gboolean exclusively

Commit migrated from https://github.com/mono/mono/commit/370e76dfc83616042adde1b2ffd130e25363002e

5 years agoRemove quadratic behavior from g_strconcat. (mono/mono#15630)
Jay Krell [Wed, 10 Jul 2019 16:06:51 +0000 (09:06 -0700)]
Remove quadratic behavior from g_strconcat. (mono/mono#15630)

Prefer strlen + memcpy over strcat.

Commit migrated from https://github.com/mono/mono/commit/7a486d8f438434159e1a7f0f8762a76b2faffeac

5 years agoFix warning: unused function get_address_from_sockaddr (mono/mono#15631)
Jay Krell [Wed, 10 Jul 2019 08:36:46 +0000 (01:36 -0700)]
Fix warning: unused function get_address_from_sockaddr (mono/mono#15631)

Commit migrated from https://github.com/mono/mono/commit/58fc782d8641307c6383faebb7cd4a3d219726c9

5 years agoProvide g_strnlen to replace strnlen for portability to older systems. (mono/mono...
Jay Krell [Wed, 10 Jul 2019 03:43:13 +0000 (20:43 -0700)]
Provide g_strnlen to replace strnlen for portability to older systems. (mono/mono#15626)

See https://github.com/mistydemeo/tigerbrew/issues/605.
See https://www.gnu.org/software/gnulib/manual/html_node/strnlen.html.

Commit migrated from https://github.com/mono/mono/commit/77c269721ed2f6b510af94a30be9b43f183f0eb7

5 years ago[interp] Avoid declaring MonoError's in interp_exec_method_full (), it increases...
Zoltan Varga [Tue, 9 Jul 2019 19:16:46 +0000 (15:16 -0400)]
[interp] Avoid declaring MonoError's in interp_exec_method_full (), it increases the native stack frame size because the optimizer can't seem to figure out live ranges. (mono/mono#15613)

* [interp] Avoid declaring MonoError's in interp_exec_method_full (), it increases the native stack frame size because the optimizer can't seem to figure out live ranges.

* Remove some unused fields from InterpFrame.

Commit migrated from https://github.com/mono/mono/commit/cba874139d8f59873c8f89531891340fe81788bd

5 years ago[debugger] Update client thread frames after SetIP. (mono/mono#15449)
Thays Grazia [Tue, 9 Jul 2019 19:07:46 +0000 (16:07 -0300)]
[debugger] Update client thread frames after SetIP. (mono/mono#15449)

* Fixes mono/mono#13408

PR of draft https://github.com/mono/mono/pull/14667

* Disabling test on Interpreter.

Commit migrated from https://github.com/mono/mono/commit/d33747a6e3bdb13803ae2dcd7077edd7df094b5b

5 years ago[jit] Add support for valuetype arguments to gsharedvt constrained calls. (mono/mono...
Zoltan Varga [Tue, 9 Jul 2019 15:40:06 +0000 (11:40 -0400)]
[jit] Add support for valuetype arguments to gsharedvt constrained calls. (mono/mono#15610)

Commit migrated from https://github.com/mono/mono/commit/2cefbc18df3eade8f2ac3ba94138a8851f24315d

5 years ago[netcore] Fix netcore CI lane (mono/mono#15627)
Egor Bogatov [Tue, 9 Jul 2019 11:29:19 +0000 (14:29 +0300)]
[netcore] Fix netcore CI lane (mono/mono#15627)

Commit migrated from https://github.com/mono/mono/commit/9dc20c9b5faf7e9e80f82007132e25a12d2c5c5e

5 years agoRemove support for llvm36, its not used anymore. (mono/mono#15619)
Zoltan Varga [Tue, 9 Jul 2019 09:44:17 +0000 (05:44 -0400)]
Remove support for llvm36, its not used anymore. (mono/mono#15619)

* Remove support for llvm36, its not used anymore.

* [jit] Remove support for older llvm versions.

Commit migrated from https://github.com/mono/mono/commit/aeacedfd38fd53c0c351429f5d880477467ec941

5 years ago[profiler] Fix printf bug -- char* vs. MonoString* (mono/mono#15602)
Jay Krell [Tue, 9 Jul 2019 09:24:39 +0000 (02:24 -0700)]
[profiler] Fix printf bug -- char* vs. MonoString* (mono/mono#15602)

Gcc warned.

Commit migrated from https://github.com/mono/mono/commit/5a0bc3cf81eec6f8edb4a5c45b566c71235a765b

5 years ago[jit] [x86] [amd64] Cleanup with x86_byte() (mono/mono#15600)
Jay Krell [Tue, 9 Jul 2019 09:12:53 +0000 (02:12 -0700)]
[jit] [x86] [amd64] Cleanup with x86_byte() (mono/mono#15600)

Commit migrated from https://github.com/mono/mono/commit/369f796d8d955f188ba2485b205d60b4cb70ccc6

5 years agoAccess mini_debug_options directly within the runtime. (mono/mono#15594)
Jay Krell [Tue, 9 Jul 2019 09:12:15 +0000 (02:12 -0700)]
Access mini_debug_options directly within the runtime. (mono/mono#15594)

We had some inconsistency around accessing mini_debug_options in the runtime (both directly as well as through the function, mini_get_debug_options). This PR makes the access consistent through the runtime.

Commit migrated from https://github.com/mono/mono/commit/39b52e2da89ec4d118103cfcbd2dd646c31a9eb9

5 years agoDisable check-seq-points test. (mono/mono#15623)
Jay Krell [Tue, 9 Jul 2019 09:09:29 +0000 (02:09 -0700)]
Disable check-seq-points test. (mono/mono#15623)

See https://github.com/mono/mono/pull/15599#issuecomment-509444313.
See https://github.com/mono/mono/pull/15567.

Alternative to https://github.com/mono/mono/pull/15599 and part https://github.com/mono/mono/pull/15567.

Commit migrated from https://github.com/mono/mono/commit/135eaa17580b9619f647894c48da55a22c9b945f

5 years agoruntime.h remove extern "C" and distribute normally instead of extra. (mono/mono...
Jay Krell [Mon, 8 Jul 2019 17:59:05 +0000 (10:59 -0700)]
runtime.h remove extern "C" and distribute normally instead of extra. (mono/mono#15558)

Commit migrated from https://github.com/mono/mono/commit/e4bc8790d3e3c6db3022a318bfa20384bd1b9fe3

5 years agoAlign native_handle open/close for MonoThreadInfo/MonoInternalThread on Windows....
Johan Lorensson [Mon, 8 Jul 2019 17:50:17 +0000 (19:50 +0200)]
Align native_handle open/close for MonoThreadInfo/MonoInternalThread on Windows. (mono/mono#15482)

* Align native_handle open/close for MonoThreadInfo/MonoInternalThread on Windows.

* Drop assert on DuplicateHandle failure.

* Fix native thread handle gpointer conversion.

Commit migrated from https://github.com/mono/mono/commit/12c962835ff2d18d0ec46013113bfe56f1fc1157

5 years ago[runtime] Implement mono_verifier_class_is_valid_generic_instantiation () etc. even...
Zoltan Varga [Mon, 8 Jul 2019 08:36:49 +0000 (04:36 -0400)]
[runtime] Implement mono_verifier_class_is_valid_generic_instantiation () etc. even if the verifier is disabled. (mono/mono#15564)

Fixes https://github.com/mono/mono/issues/15551.

Commit migrated from https://github.com/mono/mono/commit/cb330378cfc86555e559b0fb0539d27a337ad987

5 years agomono_native_tls_get_value that does not change LastError. (mono/mono#15568)
Jay Krell [Mon, 8 Jul 2019 07:44:23 +0000 (00:44 -0700)]
mono_native_tls_get_value that does not change LastError. (mono/mono#15568)

Commit migrated from https://github.com/mono/mono/commit/f19bc9634364185a0a3628c3e1a6fd3f06ed1a89

5 years agoInline GetLastError and SetLastError. (mono/mono#15560)
Jay Krell [Mon, 8 Jul 2019 07:42:54 +0000 (00:42 -0700)]
Inline GetLastError and SetLastError. (mono/mono#15560)

Commit migrated from https://github.com/mono/mono/commit/963ba77863303f6a74e8b5bfe6e5c05bbbb19ccb

5 years ago[netcore] Throw ICE for Array.Copy(object[], enum[]) (mono/mono#15585)
Egor Bogatov [Sun, 7 Jul 2019 13:11:03 +0000 (16:11 +0300)]
[netcore] Throw ICE for Array.Copy(object[], enum[]) (mono/mono#15585)

* test

* undo rsp changes

* Fix ICollection_NonGeneric_CopyTo_ArrayOfEnumType

* group all "requires precise gc" issues

* Add more gc precise tests (and a flaky one)

Commit migrated from https://github.com/mono/mono/commit/55cc1d6d8f2d210c1957166ee0c5c8f8177201a2

5 years agoConvert dl-test-assets.py to Python 3 (mono/mono#15524)
Ryan Lucia [Sat, 6 Jul 2019 21:34:30 +0000 (17:34 -0400)]
Convert dl-test-assets.py to Python 3 (mono/mono#15524)

Commit migrated from https://github.com/mono/mono/commit/851dfdb98a2c41427c4f756b2b2f8721ab8e16fc

5 years agoCleanup zlib-helper.c allocations -- move integer overflow checks into calloc. (mono...
Jay Krell [Sat, 6 Jul 2019 18:59:27 +0000 (11:59 -0700)]
Cleanup zlib-helper.c allocations -- move integer overflow checks into calloc. (mono/mono#15505)

Commit migrated from https://github.com/mono/mono/commit/d540aee31f71edb901fe6239f04bb29ee6e3c0d6

5 years ago[jit] Add missing float conv.u8.ovf.un conversion. (mono/mono#13907)
Zoltan Varga [Sat, 6 Jul 2019 09:47:47 +0000 (05:47 -0400)]
[jit] Add missing float conv.u8.ovf.un conversion. (mono/mono#13907)

* [jit] Add missing float conv.u8.ovf.un conversion.

* Add support for the float64 bit version as well.

* Fix interpreter support.

Commit migrated from https://github.com/mono/mono/commit/de5dca22649ae581085863b0935f94eff4483e55

5 years agoDistribute sgen-dynarray.h via source, not EXTRA_DIST. (mono/mono#15559)
Jay Krell [Fri, 5 Jul 2019 16:05:13 +0000 (09:05 -0700)]
Distribute sgen-dynarray.h via source, not EXTRA_DIST. (mono/mono#15559)

Commit migrated from https://github.com/mono/mono/commit/1cb8e04331068796bd3c049ce0fd3b59615535f4

5 years agoRemove extra explicit dist. (mono/mono#15557)
Jay Krell [Fri, 5 Jul 2019 16:04:22 +0000 (09:04 -0700)]
Remove extra explicit dist. (mono/mono#15557)

Automake sees through the conditionals.

Commit migrated from https://github.com/mono/mono/commit/2b7e2d2f34f980c8a03234fe617e011f96df491a

5 years ago[netcore] Read NETCORETESTS_VERSION and NETCOREAPP_VERSION fro… (mono/mono#15584)
Alexander Köplinger [Fri, 5 Jul 2019 15:03:49 +0000 (17:03 +0200)]
[netcore] Read NETCORETESTS_VERSION and NETCOREAPP_VERSION fro… (mono/mono#15584)

* [netcore] Simplify CI build invocation

We now have build.sh as a one-stop entry to the build system.

* [netcore] Read NETCORETESTS_VERSION and NETCOREAPP_VERSION from eng/Versions.props

The Versions.props is auto-updated by Arcade so we automatically get new versions.

Commit migrated from https://github.com/mono/mono/commit/bc269dc39e917ec1255673ebdcebdd0afaed1c3e

5 years ago[netcore] CI work, add rsp for Windows (mono/mono#15549)
Egor Bogatov [Fri, 5 Jul 2019 15:02:44 +0000 (18:02 +0300)]
[netcore] CI work, add rsp for Windows (mono/mono#15549)

Commit migrated from https://github.com/mono/mono/commit/3a7afab91c2a7feb210aedc1053bbc44f80f6d25

5 years agoLink with -z now or -bind_at_load. (mono/mono#14562)
Jay Krell [Fri, 5 Jul 2019 13:54:17 +0000 (06:54 -0700)]
Link with -z now or -bind_at_load. (mono/mono#14562)

Advantages:
 Dynamic linker gets out of the way of random function calls,
 in terms of timing, in terms of locking, and in term of success,
 and possibly in terms of security (readonly function pointers).
 If you successfully load, then you can make function calls with impunity,
 without regard as to if they are in the same .so as the caller, well,
 assuming they are to a leaf like libc, or to something itself built with -z now.

 The "success" is significant, as otherwise loaded LLVM has unresolved symbols lurking, depending on which code paths you send it down.

Disadvantage: Slower startup.

Mixed:
 Platform consistency, since this is how Windows behaves usually (unless you say link /delayload)

This will combine well with an upcoming revision of https://github.com/mono/mono/pull/14524.

Difficult alternative: Force the binding along sensitive paths by calling their callees earlier.
Typical alternative: Ignore the matter.

Android: It is believed this switch produces a warning, which is ignored, there is no affect, and it is unclear if the behavior is actually "now" or "lazy". Logs could be checked and a test run, but neither.

Commit migrated from https://github.com/mono/mono/commit/e7f9dbe73c3344c96a13892a6c4c45f8e5c35aa3

5 years agoReadonly codemanager callbacks. (mono/mono#15538)
Jay Krell [Fri, 5 Jul 2019 13:46:10 +0000 (06:46 -0700)]
Readonly codemanager callbacks. (mono/mono#15538)

Commit migrated from https://github.com/mono/mono/commit/4cf527f6d9ce224c8d1972c95e212f74a0c91043

5 years agoMake thread locals just always extern. (mono/mono#15563)
Jay Krell [Fri, 5 Jul 2019 13:38:16 +0000 (06:38 -0700)]
Make thread locals just always extern. (mono/mono#15563)

Making them static for C is not worth the ifdef.

Commit migrated from https://github.com/mono/mono/commit/28ec3644efa4e7cff0d8850e01aa96f0621a9749

5 years agoWin32 zlib support. (mono/mono#15509)
Jay Krell [Fri, 5 Jul 2019 12:38:56 +0000 (05:38 -0700)]
Win32 zlib support. (mono/mono#15509)

Fixes https://github.com/mono/mono/issues/15503

Always statically link on Windows (msvc and mingw).
This is a somewhat old zlib, and will be updated shortly (https://github.com/mono/mono/pull/15480)

Note that zlib is not valid C++, so always compile as C.

Commit migrated from https://github.com/mono/mono/commit/b84b85688ba252d1e514ff2dec6a3d10544caa8c

5 years agoInterpreter reads last error to late after pinvoke. (mono/mono#15571)
Johan Lorensson [Fri, 5 Jul 2019 08:30:17 +0000 (10:30 +0200)]
Interpreter reads last error to late after pinvoke. (mono/mono#15571)

* Interpreter reads last error to late after pinvoke.

This could lead to clobbered last error since interpreter loop needs to
run two additional IL instructions in order to read out the value. This works
on JIT since the lowering saving the last error will happen right after
pinvoke.

This fix makes sure interpreter will get needed information to read out
last error right after pinvoke (if requested).

It adds a new IL prefix issued in managed->native wrapper that will tell
codegen (and interpreter) that upcoming calli instruction needs to save
last error, meaning that it could be done right after issuing the call,
no need to run any additional IL instructions to do that work, closing
the gap between the return of pinvoke call and save of last error.

Should fix, https://github.com/mono/mono/issues/15541.

* Optimize emit_get_last_error.

Commit migrated from https://github.com/mono/mono/commit/b1b61d7cb7f580f5e5438a756ef3e67a5a832eeb

5 years agoDo not compile metadata support/compress.c. (mono/mono#15535)
Jay Krell [Thu, 4 Jul 2019 14:05:17 +0000 (07:05 -0700)]
Do not compile metadata support/compress.c. (mono/mono#15535)

Commit migrated from https://github.com/mono/mono/commit/5637cbd42d6d795cef8310e4435b076ca03bc008

5 years ago[netcore] Make System.Reflection.Tests.TypeTests.GetEnumUnderlyingType Pass (mono...
Maxim Lipnin [Thu, 4 Jul 2019 13:10:18 +0000 (16:10 +0300)]
[netcore] Make System.Reflection.Tests.TypeTests.GetEnumUnderlyingType Pass (mono/mono#15510)

* [netcore] Make System.Reflection.Tests.TypeTests.GetEnumUnderlyingType Pass

* Remove recursive name parsing in case of "+" character; remove if condition for nested names

Commit migrated from https://github.com/mono/mono/commit/e0da61d691e79ae810f40b2eef2d30647d30ff72

5 years agoMake sure TLS (thread local storage) is always TLS and not FLS (fiber local storage).
Jay Krell [Wed, 3 Jul 2019 09:35:11 +0000 (02:35 -0700)]
Make sure TLS (thread local storage) is always TLS and not FLS (fiber local storage).
The Windows SDKs are inconsistent (and clearly documented as so), and the JIT assumes TLS.

Commit migrated from https://github.com/mono/mono/commit/167709be8ca7f85975b47e4e2925c413f01770a7

5 years ago[debugger][wasm] Display content of "this" (mono/mono#15528)
Thays Grazia [Wed, 3 Jul 2019 15:15:18 +0000 (12:15 -0300)]
[debugger][wasm] Display content of "this" (mono/mono#15528)

* Implementing watch of variable "this"
Fixes mono/mono#15446

* Fixing indentation.

Commit migrated from https://github.com/mono/mono/commit/fb49d2d6313e75b2e82ece414dbfc47a54ef6da3

5 years ago[interp] Simplify MINT_NEWOBJ_ARRAY
Vlad Brezae [Tue, 2 Jul 2019 15:02:25 +0000 (18:02 +0300)]
[interp] Simplify MINT_NEWOBJ_ARRAY

Commit migrated from https://github.com/mono/mono/commit/6136d51ae92e2e421f257e3c7939f12affc8deaf

5 years ago[interp] Make newarr lockfree
Vlad Brezae [Tue, 2 Jul 2019 14:42:24 +0000 (17:42 +0300)]
[interp] Make newarr lockfree

Before this commit, we were creating the array class from the element class during run time, also taking a lock in the meantime. This makes array allocation 2x faster. (on multithread much faster)

Commit migrated from https://github.com/mono/mono/commit/aa7b713715735f06fe4fa9fe32b9b7a0e19c90bc

5 years agoAbort async suspend request on failure doing preemptive suspend. (mono/mono#15486)
Johan Lorensson [Wed, 3 Jul 2019 11:08:05 +0000 (13:08 +0200)]
Abort async suspend request on failure doing preemptive suspend. (mono/mono#15486)

When a preemptive suspend fails, state machine will get into an invalid
state and the thread is in an unknown state (running/self-suspended). In case of
failure in mono_threads_suspend_begin_async_suspend, a new method should be
called, mono_threads_transition_abort_async_suspend making sure state machine
reflects correct thread state as well as reporting correct result to initial
caller of mono_threads_suspend_begin_async_suspend.

Commit migrated from https://github.com/mono/mono/commit/e30184752b7047007352e7d384cc471875168a15

5 years agoHAVE_DL_LOADER is never used so remove it. (mono/mono#15500)
Jay Krell [Wed, 3 Jul 2019 09:01:59 +0000 (02:01 -0700)]
HAVE_DL_LOADER is never used so remove it. (mono/mono#15500)

Commit migrated from https://github.com/mono/mono/commit/08feb423c1f214a5341fcb0132054cd0dcf9f891

5 years agoAC_DEFINE instead of AC_SUBST MONO_DL_NEED_USCORE. (mono/mono#15499)
Jay Krell [Wed, 3 Jul 2019 09:01:19 +0000 (02:01 -0700)]
AC_DEFINE instead of AC_SUBST MONO_DL_NEED_USCORE. (mono/mono#15499)

i.e. so it can be used in C instead of make.
i.e. so it can actually work.

The lone use is here:
```
C:\s\mono2\mono\utils\mono-dl.c(271):#if MONO_DL_NEED_USCORE
```

Commit migrated from https://github.com/mono/mono/commit/33b4d2695ee15b8416cd2c6077691e4c8bbad94f

5 years agoDo not compile unused support/uncompr.c. (mono/mono#15516)
Jay Krell [Wed, 3 Jul 2019 08:59:38 +0000 (01:59 -0700)]
Do not compile unused support/uncompr.c. (mono/mono#15516)

Commit migrated from https://github.com/mono/mono/commit/177ae36c7a34ac331e8e38a40d4caa131f4d89f6

5 years ago[netcore] Clean up CoreFX.issues.rsp (mono/mono#15526)
Egor Bogatov [Wed, 3 Jul 2019 08:58:50 +0000 (11:58 +0300)]
[netcore] Clean up CoreFX.issues.rsp (mono/mono#15526)

Commit migrated from https://github.com/mono/mono/commit/57f362207c1b1caee96dd5a3ae0f1bd3a8d6461a

5 years agoCorrect MONO_DL_NEED_USCORE for C++, and memcpy is faster than strcpy. (mono/mono...
Jay Krell [Tue, 2 Jul 2019 15:09:32 +0000 (08:09 -0700)]
Correct MONO_DL_NEED_USCORE for C++, and memcpy is faster than strcpy. (mono/mono#15498)

Commit migrated from https://github.com/mono/mono/commit/4b074e842b301837dbce9931d08c338050249087

5 years agoAdd support for TLS callbacks on Windows. (mono/mono#15423)
Johan Lorensson [Tue, 2 Jul 2019 12:06:57 +0000 (14:06 +0200)]
Add support for TLS callbacks on Windows. (mono/mono#15423)

* Add support for TLS callbacks on Windows.

Mono runtime depends on DllMain to be called by OS in order to correctly
detach threads from the runtime. If this doesn't happen,
threads from native thread pools (not owned by runtime) and attached
using native->managed callback, won't detach resulting in attached
threads no longer running. Since threads are still attached
to runtime, next GC will try to suspend the thread and that will fail
and that in turn will put the state machine in an incorrect state,
bringing down the runtime at next GC (when the thread state is revisited).

This problem is currently handled by DllMain, but since DllMain only exist
in DLL's, statically link Mono runtime will get us into the above scenario.

This commit add support to hook up a TLS callback using the same mechanism
used by MSVC linker and c-runtime (also available under MINGW). The
callback will be included in a section/segment of an object file and included
in final image (DLL or EXE) by linker and called by OS loader, solving the
problem with static linked Mono runtime not being able to detach terminating
threads.

The commit keeps current DllMain method when building a DLL but
includes a mechanism making sure we only use one of the callback techniques
at runtime, if both have been included in final image. This will simplify the build
of libmini since we can always build the object including the callback, regardless
how the library will be consumed.

Commit migrated from https://github.com/mono/mono/commit/5fee1d3eea11ddae2f2b3a92bfb03cea7b47c091

5 years ago[stats] distinguish between mini and LLVM AOT method (mono/mono#15483)
Bernhard Urban [Tue, 2 Jul 2019 08:55:51 +0000 (10:55 +0200)]
[stats] distinguish between mini and LLVM AOT method (mono/mono#15483)

[stats] distinguish between mini and LLVM AOT method

Also print the stats on shutdown when configured with `--with-core=only`

Commit migrated from https://github.com/mono/mono/commit/6f7da4ce491aa01f766d08d6cc58902b24bb3def

5 years ago[netcore] Remove some unused SRE icalls. (mono/mono#15484)
Zoltan Varga [Tue, 2 Jul 2019 08:27:48 +0000 (04:27 -0400)]
[netcore] Remove some unused SRE icalls. (mono/mono#15484)

Commit migrated from https://github.com/mono/mono/commit/adbb7df7ce26461716b7cffaa6e95cb6af7266a6

5 years agoFix const warning. (mono/mono#15478)
Jay Krell [Tue, 2 Jul 2019 07:08:06 +0000 (00:08 -0700)]
Fix const warning. (mono/mono#15478)

Commit migrated from https://github.com/mono/mono/commit/d956cf687cb39bab18194a7eea608becfbc372d5

5 years agoMake codeman not public (mono/mono#15415)
Jay Krell [Tue, 2 Jul 2019 07:07:18 +0000 (00:07 -0700)]
Make codeman not public (mono/mono#15415)

Seems a bit obscure to be public, the header is not public.

Commit migrated from https://github.com/mono/mono/commit/caecad895a1984e91e5d60a95dfd34777174512d

5 years agoAdd back some stubs for the non-threads build.
Zoltan Varga [Fri, 28 Jun 2019 22:20:29 +0000 (18:20 -0400)]
Add back some stubs for the non-threads build.

Commit migrated from https://github.com/mono/mono/commit/3970c6112a03acdbd4cc01a3a8bbf973fecf1f8e

5 years ago[wasm] Implement pthreads support in the runtime.
Zoltan Varga [Fri, 28 Jun 2019 07:46:41 +0000 (03:46 -0400)]
[wasm] Implement pthreads support in the runtime.

Commit migrated from https://github.com/mono/mono/commit/7c3adaf873fad721d5b75045411f9285fec40b77

5 years ago[runtime] Disable a a AC_TRY_RUN when cross-compiling.
Zoltan Varga [Tue, 25 Jun 2019 20:03:38 +0000 (16:03 -0400)]
[runtime] Disable a a AC_TRY_RUN when cross-compiling.

Commit migrated from https://github.com/mono/mono/commit/bc787a8a0105e96630597dda72fbbe4df4a3c71c

5 years ago[netcore] Remove IsByRef check on Reflection.Emit.DynamicMethod
Steve Pfister [Tue, 2 Jul 2019 01:12:06 +0000 (21:12 -0400)]
[netcore] Remove IsByRef check on Reflection.Emit.DynamicMethod

Fixes https://github.com/mono/mono/issues/15324

Removed check on the return type being by ref.

Commit migrated from https://github.com/mono/mono/commit/d39c84d45f20fac4884ca5e4a3074f1518e8ca8b

5 years agoDisable zlib on mingw Windows build to avoid dependency on zlib (mono/mono#15493)
Johan Lorensson [Mon, 1 Jul 2019 23:15:38 +0000 (01:15 +0200)]
Disable zlib on mingw Windows build to avoid dependency on zlib (mono/mono#15493)

mono/mono#4484 broke Windows mingw build due to new dependency, zlib1.dll not available in PATH on build bots. Disabling for now until we know how this should be handled (and also fixed for MSVC build runtime).

Commit migrated from https://github.com/mono/mono/commit/51a11b68c52034f0c6beef9f62dfa1c9d33761f0

5 years ago[netcore] Bump Roslyn
Marek Safar [Mon, 1 Jul 2019 19:01:24 +0000 (21:01 +0200)]
[netcore] Bump Roslyn

Commit migrated from https://github.com/mono/mono/commit/71d1b10c3eb2d2da8a773004cc16e4a5e90c7db8

5 years ago[netcore] Fix Array.Copy* tests. Bump NETCORETESTS_VERSION ver… (mono/mono#15428)
Egor Bogatov [Mon, 1 Jul 2019 18:20:25 +0000 (21:20 +0300)]
[netcore] Fix Array.Copy* tests. Bump NETCORETESTS_VERSION ver… (mono/mono#15428)

* Fix Array.Copy* tests

* simplify code

* Add comments

* Address feedback

* Update CoreFX.issues.rsp

* Fix SRE tests

* Add comment

* bump versions again

Commit migrated from https://github.com/mono/mono/commit/d20fe8ec3799f97468c21d3f41dcab9071c85218

5 years ago[metadata] Rename, null-initialize, and properly free *args variables (mono/mono...
Miguel de Icaza [Mon, 1 Jul 2019 16:11:02 +0000 (09:11 -0700)]
[metadata] Rename, null-initialize, and properly free *args variables (mono/mono#13855)

Commit migrated from https://github.com/mono/mono/commit/de18c594f0000812f91ee22c6eb044e2ea3964f0

5 years agoRemove unused AMD64 JIT CALLCONV_IS_STDCALL. (mono/mono#15416)
Jay Krell [Mon, 1 Jul 2019 07:53:01 +0000 (00:53 -0700)]
Remove unused AMD64 JIT CALLCONV_IS_STDCALL. (mono/mono#15416)

Commit migrated from https://github.com/mono/mono/commit/8c20d5c67a774002404439950c9d60dfd0d0edf1

5 years agoFix 32-bit build error when using C++ compiler.
lateralusX [Thu, 27 Jun 2019 09:30:06 +0000 (11:30 +0200)]
Fix 32-bit build error when using C++ compiler.

Commit migrated from https://github.com/mono/mono/commit/be77d03c225a3be8589ac2499afc66d2f043e3f4

5 years agoDisable compiler server on darwin. Add force-enable option for compiler server. ...
Katelyn Gadd [Fri, 28 Jun 2019 22:24:09 +0000 (15:24 -0700)]
Disable compiler server on darwin. Add force-enable option for compiler server. (mono/mono#15450)

Commit migrated from https://github.com/mono/mono/commit/c239906a0177a69417f021e4bd2702b179b68454

5 years agoAdd tests
Filip Navara [Thu, 27 Jun 2019 09:07:40 +0000 (11:07 +0200)]
Add tests

Commit migrated from https://github.com/mono/mono/commit/c788634b54eabfe2e6f2365bac09ec2f0aeb6582

5 years agoFix marshalling bugs for StringBuilder parameters
Filip Navara [Tue, 25 Jun 2019 09:31:38 +0000 (11:31 +0200)]
Fix marshalling bugs for StringBuilder parameters

Commit migrated from https://github.com/mono/mono/commit/cbe365b659aade2ae85f3f1c55267df837bf2738

5 years ago[netcore] Fix Assembly.GetForwardedTypes() (mono/mono#15452)
Ryan Lucia [Fri, 28 Jun 2019 15:54:27 +0000 (11:54 -0400)]
[netcore] Fix Assembly.GetForwardedTypes() (mono/mono#15452)

* [netcore] Make GetForwardedTypes return nested types

* [netcore] Throw proper error in GetTopLevelForwardedTypes

* Remove unnecessary function

* Formatting

* Re-enable relevant tests

* Switch to REFERENCE_MISSING

* Use local error

Commit migrated from https://github.com/mono/mono/commit/c879bc4691b4a76f1866af08024b0df5e27b6b8e

5 years ago[runtime] Implement support for embedded ppdb, when the ppdb blob is compressed and...
Zoltan Varga [Tue, 7 Mar 2017 01:28:24 +0000 (20:28 -0500)]
[runtime] Implement support for embedded ppdb, when the ppdb blob is compressed and embedded into the pe image.

Commit migrated from https://github.com/mono/mono/commit/112297ef5c076a2716c020ddb0bbf1e0a2da7703