platform/upstream/dotnet/runtime.git
5 years ago[netcore] Onboard Arcade (mono/mono#14301)
Jo Shields [Thu, 2 May 2019 14:24:10 +0000 (10:24 -0400)]
[netcore] Onboard Arcade (mono/mono#14301)

Commit migrated from https://github.com/mono/mono/commit/748da2e4a93e820540f857ee8c6d3f752141f4de

5 years ago[netcore] clean up excludes-System.Runtime.Tests.rsp (mono/mono#14294)
Egor Bogatov [Thu, 2 May 2019 12:00:40 +0000 (15:00 +0300)]
[netcore] clean up excludes-System.Runtime.Tests.rsp (mono/mono#14294)

* update System.Runtime.Tests.rsp

* Update System.Private.CoreLib.csproj

* Update excludes-System.Runtime.Tests.rsp

* Invoke AppContext.OnProcessExit from runtime

* remove Utf16/Utf8 tests

* Implement LoadFromPath

* make NativeLibrary os specific

* Add missing LoadWithPartialName

* Update Assembly.cs

* Update Assembly.cs

* Update NativeLibrary.Unix.cs

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

5 years agoMerge pull request mono/mono#14295 from vargaz/mixed-eh-5
Larry Ewing [Thu, 2 May 2019 06:46:36 +0000 (01:46 -0500)]
Merge pull request mono/mono#14295 from vargaz/mixed-eh-5

[runtime] Fix some mixed EH problems.

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

5 years ago[runtime] Fix some mixed EH problems.
Zoltan Varga [Wed, 1 May 2019 06:00:56 +0000 (02:00 -0400)]
[runtime] Fix some mixed EH problems.

Commit migrated from https://github.com/mono/mono/commit/781d20bab4902bfad0ac29b9fb82c28812d7edc1

5 years ago[aot] Avoid passing -march=arm to llc when using thumb, it forces arm32 code generati...
Zoltan Varga [Wed, 1 May 2019 00:47:27 +0000 (20:47 -0400)]
[aot] Avoid passing -march=arm to llc when using thumb, it forces arm32 code generation. (mono/mono#14288)

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

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

5 years agoAdd minimal COM support into WinAOT BCL profile and Windows Mono runtime.
lateralusX [Mon, 29 Apr 2019 08:17:45 +0000 (10:17 +0200)]
Add minimal COM support into WinAOT BCL profile and Windows Mono runtime.

Technologies like SharpDX uses a minimal set of COM support from runtime
and System.Runtime.InteropServices.Marshal:

AddRef
Release
QueryInterface

All these are low level wrappers around methods in IUknown interface and
doesn't need any of the additional runtime COM support enabled to work.

Technologies like CoreRT includes these methods in their full AOT
profile, meaning that SharpDX can run on CoreRT on Windows platforms. Mono's
WinAOT profile and runtime currently don't, making it impossible  to use
SharpDX.

This PR adds the needed methods into WinAOT profile and also make
sure corresponding icalls always gets included on Windows build Mono runtime.

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

5 years agoMerge pull request mono/mono#14199 from kjpou1/wasm-sdk-cl-args
Larry Ewing [Mon, 29 Apr 2019 22:33:44 +0000 (17:33 -0500)]
Merge pull request mono/mono#14199 from kjpou1/wasm-sdk-cl-args

[wasm][sdk] Add command line quoting and escaping to WasmLinkAssembli…

Commit migrated from https://github.com/mono/mono/commit/498974d09ac841eb2ad62cb8f528a79490e9492d

5 years agoMirror changes from mono/coreclr,corefx,corert (mono/mono#14163)
Marek Safar [Mon, 29 Apr 2019 17:30:57 +0000 (19:30 +0200)]
Mirror changes from mono/coreclr,corefx,corert (mono/mono#14163)

Mirror changes from mono/coreclr,corefx,corert

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

5 years agoRemove libgcc_s_seh-1.dll dependency when targeting Win32 with gcc. (mono/mono#14251)
Jay Krell [Sun, 28 Apr 2019 01:57:17 +0000 (18:57 -0700)]
Remove libgcc_s_seh-1.dll dependency when targeting Win32 with gcc. (mono/mono#14251)

Don't use popcount intrinsic.
Alternative but not exactly contradictory to https://github.com/mono/mono/pull/14248.

Note that this is a single inlinable instruction on x86,
if you assume at least SSE4 from circa 2007, which I am avoiding here.

Commit migrated from https://github.com/mono/mono/commit/90a91429ae75240b4d0e791a563a9d553be09d56

5 years ago[interp] Optimize enum Hasflag (mono/mono#14173)
Vlad Brezae [Sat, 27 Apr 2019 09:14:16 +0000 (12:14 +0300)]
[interp] Optimize enum Hasflag (mono/mono#14173)

* [interp] Optimize enum.HasFlag for csc pattern

Avoid boxing and slow call. Makes it 100x faster.

* [interp] Optimize enum.HasFlag for mcs pattern

* [interp] Transform ldc.i4 + conv.i8 into ldc.i8

Simplifies code, making enum.HasFlag optimization work for long enums.

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

5 years ago[interp] Optimize special static field access (mono/mono#14202)
Vlad Brezae [Fri, 26 Apr 2019 21:28:12 +0000 (00:28 +0300)]
[interp] Optimize special static field access (mono/mono#14202)

* [interp] Optimize special static field access

3x faster. For value types 10x.

* [interp] Remove duplicated code

* [interp] Further optimize thread static field access

Provides an additional 50% perf gain.

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

5 years ago[interp] Don't change next_jit_code_hash during imethod transform (mono/mono#14240)
Vlad Brezae [Fri, 26 Apr 2019 15:20:33 +0000 (18:20 +0300)]
[interp] Don't change next_jit_code_hash during imethod transform (mono/mono#14240)

This field is used by the internal hash table to link nodes and it can be changed during hash table insertion of other imethods. Copying this field back was leading to random hangs in hash table lookup.

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

5 years ago[runtime] Add a python version of the offsets tool. (mono/mono#14229)
Zoltan Varga [Fri, 26 Apr 2019 15:12:24 +0000 (11:12 -0400)]
[runtime] Add a python version of the offsets tool. (mono/mono#14229)

* [runtime] Add a python version of the offsets tool.

This version only depends on python and libclang. It currently only
works on osx.

* [runtime] Add a dummy structure needed by the python version of the offsets tool.

* [offsets-tool-py] Change some argument names for compatibility.

* [wasm] Use the python offsets tool on osx, the c# version is 32 bit, and the 64 bit version doesn't work.

* [wasm] Fix the ordering of mono libraries on the link line.

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

5 years ago[netcore] Avoid touching or using submodules in coreonly mode
Jo Shields [Thu, 25 Apr 2019 20:47:01 +0000 (16:47 -0400)]
[netcore] Avoid touching or using submodules in coreonly mode

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

5 years ago[netcore] Smarter version numbering of nupkg (mono/mono#14011)
Jo Shields [Thu, 25 Apr 2019 19:42:56 +0000 (15:42 -0400)]
[netcore] Smarter version numbering of nupkg (mono/mono#14011)

The version number in version.h only shows e.g. "6.3.0", and we
want full version numbers ideally, to match what our Mac pkg files
show. This logic calculates that version number.

Commit migrated from https://github.com/mono/mono/commit/3521df4cf476ce459cdacd815f64876d8b3e5a94

5 years ago[netcore] Fix `make dist` following https://github.com/mono/mono/pull/14167 (mono...
Jo Shields [Thu, 25 Apr 2019 18:27:46 +0000 (14:27 -0400)]
[netcore] Fix `make dist` following https://github.com/mono/mono/pull/14167 (mono/mono#14233)

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

5 years agoFix arm32 tailcall_reg/tailcall_membase. (mono/mono#14187)
Jay Krell [Thu, 25 Apr 2019 17:10:06 +0000 (10:10 -0700)]
Fix arm32 tailcall_reg/tailcall_membase. (mono/mono#14187)

* Revert "[Tailcall] [arm] [jit] Fix moving tailcall parameters. (mono/mono#12701)"

This reverts commit mono/mono@257efc6374cbffb95d83dc9257b432d6ae3d80f6.

* When moving parameters for tailcall, and having pushed ip,
and adjusting the offset to account for that, split the adjustment
between sp and frame pointer, as frame pointer may or may not be sp.
This fixes https://github.com/mono/mono/issues/11489.

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

5 years ago[netcore] ASP.NET Core sample (mono/mono#14224)
Egor Bogatov [Thu, 25 Apr 2019 16:28:56 +0000 (19:28 +0300)]
[netcore] ASP.NET Core sample (mono/mono#14224)

* ASP.NET Core sample

* update makefile

* update Home page

* Update Makefile

* remove ASPNET_SHAREDRUNTIME

* replace mvc with web sample

Commit migrated from https://github.com/mono/mono/commit/591d6d0a2139757760aaf169769f4967ee7d70e8

5 years ago[interp] Don't check for exception in native wrappers (mono/mono#14184)
Vlad Brezae [Thu, 25 Apr 2019 07:09:11 +0000 (10:09 +0300)]
[interp] Don't check for exception in native wrappers (mono/mono#14184)

We already do it when we get back to the interpreter.

Commit migrated from https://github.com/mono/mono/commit/913951b350a89d8e594aaa25506d91fc66abcdad

5 years agoMerge pull request mono/mono#14101 from lateralusX/lateralusX/add-coop-support-window...
Johan Lorensson [Thu, 25 Apr 2019 06:53:13 +0000 (02:53 -0400)]
Merge pull request mono/mono#14101 from lateralusX/lateralusX/add-coop-support-windows-msvc

Add hybrid/cooperate suspend runtime support on Windows.

Commit migrated from https://github.com/mono/mono/commit/45a3eef924a5a4b9012f3e2e802527614292b8c1

5 years ago[interp] fix op_explicit for cast from nfloat to nint and vice versa (mono/mono#14201)
Bernhard Urban [Thu, 25 Apr 2019 06:37:01 +0000 (08:37 +0200)]
[interp] fix op_explicit for cast from nfloat to nint and vice versa (mono/mono#14201)

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

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

5 years ago[netcore] Restore Roslyn compilers from NuGet to allow up-to-date version to be used...
Filip Navara [Wed, 24 Apr 2019 15:24:46 +0000 (17:24 +0200)]
[netcore] Restore Roslyn compilers from NuGet to allow up-to-date version to be used (mono/mono#14157)

* Restore Roslyn compilers from NuGet to allow up-to-date version to be used

* Move the Roslyn version to makefile, ensure that it is updated before building System.Private.CoreLib

* Pass the whole path to Roslyn props file instead of just Roslyn version to dotnet build

* Make the Roslyn restore compatible with .NET Core 2.2 SDK

Commit migrated from https://github.com/mono/mono/commit/019b4563d3ef09e91b4382091232964d9548d69a

5 years ago[netcore] Don't wrap CustomAttributeNamedArgument into CustomAttributeNamedArgument...
Egor Bogatov [Wed, 24 Apr 2019 15:23:51 +0000 (18:23 +0300)]
[netcore] Don't wrap CustomAttributeNamedArgument into CustomAttributeNamedArgument (mono/mono#14180)

* don't wrap CustomaAttributeNamedArg

* fix BlockCopy failing test

* update NETCORETESTS_VERSION and NETCOREAPP_VERSION

* avoid typedard creation in netcore

* fix merge issue

Commit migrated from https://github.com/mono/mono/commit/95b873997aaa220362e3da45b4a541ff17e9d9b4

5 years ago[llvm] Propagate nonnull attribute through LLVM IR (mono/mono#13697)
Alexander Kyte [Wed, 24 Apr 2019 14:53:47 +0000 (10:53 -0400)]
[llvm] Propagate nonnull attribute through LLVM IR (mono/mono#13697)

## Summary

This change allows LLVM to identify unnecessary null checks. We mark GOT accesses (including those made by LDSTR) and new object calls as nonnull.

Since LLVM won't propagate this, we propagate from definition to usage, across casts, and from usage to definition (conditionally).

This enables it to remove a significant portion of some benchmarks.

In real-world code, we can expect to see this remove the unnecessary null checks made by private methods.

## Example

### C#:

Note that the constant strings are trivially non-null. This PR spots and propagates that.

```

   static void ThrowIfNull(string s)
    {
        if (s == null)
            ThrowArgumentNullException();
    }

    static void ThrowArgumentNullException()
    {
        throw new ArgumentNullException();
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static int Bench(string a, string b, string c, string d)
    {
        ThrowIfNull(a);
        ThrowIfNull(b);
        ThrowIfNull(c);
        ThrowIfNull(d);

        return a.Length + b.Length + c.Length + d.Length;
    }

    [Benchmark(Description = nameof(NoThrowInline))]
    public int Test() => Bench("a", "bc", "def", "ghij");

```

### Before:

```

define hidden monocc i32 @NoThrowInline_MainClass_Bench_string_string_string_string(i64*  %arg_a, i64* %arg_b, i64* %arg_c, i64*  %arg_d) mono/mono#6 gc "mono" {
BB0:
  br label %INIT_BB1

INIT_BB1:                                         ; preds = %BB0
  br label %INITED_BB2

INITED_BB2:                                       ; preds = %INIT_BB1
  br label %BB3

BB3:                                              ; preds = %INITED_BB2
  br label %BB2

BB2:                                              ; preds = %BB3
  notail call monocc void @NoThrowInline_MainClass_ThrowIfNull_string(i64* %arg_a)
  notail call monocc void @NoThrowInline_MainClass_ThrowIfNull_string(i64* %arg_b)
  notail call monocc void @NoThrowInline_MainClass_ThrowIfNull_string(i64* %arg_c)
  notail call monocc void @NoThrowInline_MainClass_ThrowIfNull_string(i64* %arg_d)
  %0 = bitcast i64* %arg_a to i32*
  %1 = getelementptr i32, i32* %0, i32 4
  %t50 = load volatile i32, i32* %1
  %2 = bitcast i64* %arg_b to i32*
  %3 = getelementptr i32, i32* %2, i32 4
  %t52 = load volatile i32, i32* %3
  %t53 = add i32 %t50, %t52
  %4 = bitcast i64* %arg_c to i32*
  %5 = getelementptr i32, i32* %4, i32 4
  %t55 = load volatile i32, i32* %5
  %t56 = add i32 %t53, %t55
  %6 = bitcast i64* %arg_d to i32*
  %7 = getelementptr i32, i32* %6, i32 4
  %t58 = load volatile i32, i32* %7
  %t60 = add i32 %t56, %t58
  br label %BB1

BB1:                                              ; preds = %BB2
  ret i32 %t60
}

```

### After:

Note: safepoint in below code is added by backend, not part of this change

```

define hidden monocc i32 @NoThrowInline_MainClass_Bench_string_string_string_string(i64* nonnull %arg_a, i64* nonnull %arg_b, i64* nonnull %arg_c, i64* nonnull %arg_d) mono/mono#6 gc "mono" {
BB0:
  %0 = getelementptr i64, i64* %arg_a, i64 2
  %1 = bitcast i64* %0 to i32*
  %t50 = load volatile i32, i32* %1, align 4
  %2 = getelementptr i64, i64* %arg_b, i64 2
  %3 = bitcast i64* %2 to i32*
  %t52 = load volatile i32, i32* %3, align 4
  %t53 = add i32 %t52, %t50
  %4 = getelementptr i64, i64* %arg_c, i64 2
  %5 = bitcast i64* %4 to i32*
  %t55 = load volatile i32, i32* %5, align 4
  %t56 = add i32 %t53, %t55
  %6 = getelementptr i64, i64* %arg_d, i64 2
  %7 = bitcast i64* %6 to i32*
  %t58 = load volatile i32, i32* %7, align 4
  %t60 = add i32 %t56, %t58
  %8 = load i64*, i64** getelementptr inbounds ([37 x i64*], [37 x i64*]* @mono_aot_NoThrowInline_llvm_got, i64 0, i64 7), align 8
  %9 = load i64, i64* %8, align 4
  %10 = icmp eq i64 %9, 0
  br i1 %10, label %gc.safepoint_poll.exit, label %gc.safepoint_poll.poll.i

gc.safepoint_poll.poll.i:                         ; preds = %BB0
  %11 = load void ()*, void ()** bitcast (i64** getelementptr inbounds ([37 x i64*], [37 x i64*]* @mono_aot_NoThrowInline_llvm_got, i64 0, i64 25) to void ()**), align 8
  call void %11() mono/mono#8
  br label %gc.safepoint_poll.exit

gc.safepoint_poll.exit:                           ; preds = %BB0, %gc.safepoint_poll.poll.i
  ret i32 %t60
}

```

## Dependencies

This depends on https://github.com/mono/linker/pull/528.

Commit migrated from https://github.com/mono/mono/commit/0d9e13f983ffa82e8e2360072dc67a4ee3989324

5 years agoMerge pull request mono/mono#14192 from kjpou1/wasm-fix-cl
Larry Ewing [Wed, 24 Apr 2019 13:59:39 +0000 (08:59 -0500)]
Merge pull request mono/mono#14192 from kjpou1/wasm-fix-cl

[wasm][tests] Fix browser test command line arguments.

Commit migrated from https://github.com/mono/mono/commit/194070823c5136aae08d0987a83232e69f25db10

5 years agoFix race condition under wow64 for cooperative suspended threads.
lateralusX [Wed, 24 Apr 2019 08:16:17 +0000 (10:16 +0200)]
Fix race condition under wow64 for cooperative suspended threads.

Under hybrid suspend a thread can be cooperative suspended but still
checked for a platform critical region under wow64. Since thread is
not preemptive suspended we can't reliably call GetThreadContext and
doing so could also (even correctly) return a context flagged as critical
triggering an assert in stw for cooperative suspended threads.

Commit migrated from https://github.com/mono/mono/commit/0d390066ca091528bb551f24ec4e7c4177551f09

5 years agoAdd hybrid/cooperate runtime support on Windows.
lateralusX [Thu, 11 Apr 2019 14:08:24 +0000 (16:08 +0200)]
Add hybrid/cooperate runtime support on Windows.

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

5 years ago[netcore] Convert netcore/Makefile.am to a normal makefile, get the configure variabl...
Zoltan Varga [Tue, 23 Apr 2019 21:01:24 +0000 (17:01 -0400)]
[netcore] Convert netcore/Makefile.am to a normal makefile, get the configure variables from config.make. (mono/mono#14167)

* [netcore] Convert netcore/Makefile.am to a normal makefile, get the configure variables from config.make.

* [netcore] Convert mcs/class/System.Private.CoreLib/Makefile.am to a normal makefile.

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

5 years ago[netcore] Throw the correct exception for byref returns returning null, .net core...
Zoltan Varga [Tue, 23 Apr 2019 16:05:50 +0000 (12:05 -0400)]
[netcore] Throw the correct exception for byref returns returning null, .net core throws a nullref. (mono/mono#14128)

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

5 years ago[aot] partial revert of mono/mono#14043 (mono/mono#14135)
Bernhard Urban [Tue, 23 Apr 2019 13:53:05 +0000 (15:53 +0200)]
[aot] partial revert of mono/mono#14043 (mono/mono#14135)

We need to emit a real call here. On arm/android we would emit this now:
```asm
ldr pc, =label
.ltorg         # place address of `label` here.
```
which is a jump to `label`, not a call.

We need a different solution to make larger assemblies work, but for now
I revert it so the `2019-02` intergration is unblocked.

Partial revert of mono/mono#14043

Commit migrated from https://github.com/mono/mono/commit/223e0bd78d0531eb7b58edb1286e1c545c65f57a

5 years ago[DIM] Throwing AmbiguousImplementationException on call of multiple candidate impleme...
Thays Grazia [Tue, 23 Apr 2019 12:48:39 +0000 (09:48 -0300)]
[DIM] Throwing AmbiguousImplementationException on call of multiple candidate implementations. (mono/mono#14127)

* Adding AmbiguousImplementationException exception and throwing this when there are multiple candidate implementations.

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

5 years ago[netcore] Establish a baseline for make xtestpass (mono/mono#14072)
Filip Navara [Tue, 23 Apr 2019 12:44:39 +0000 (14:44 +0200)]
[netcore] Establish a baseline for make xtestpass (mono/mono#14072)

* Bump CoreFX version, include few more packages

* Add exclusions for System.Collections.NonGeneric.Tests

* Exclude tests that crash runtime

* Add more exclusions for known failures

* Exclude System.Utf8String.Experimental.Tests, it is CoreCLR specific
Exclude System.ComponentModel.Composition.Registration.Tests, the published version throws PNSE for all methods

Please enter the commit message for your changes. Lines starting

* Make a list of known non-passing tests and establish baseline for 'make xtestpass'

* Add exclusions

* Reenable System.Net.NameResolution.Functional.Tests

* Reenable System.Net.Sockets.Tests

* Reenable System.Diagnostics.Tracing.Tests

* Reenable System.Net.Http.Functional.Tests

* Reenable System.Net.HttpListener.Tests

* Reenable System.CodeDom.Tests

* Reenable System.Linq.Expressions.Tests

* Reenable System.Threading.ThreadPool.Tests

* Reenable System.Runtime.Tests

* Reenable System.Collections.Tests

* Reenable System.Threading.ThreadPool.Tests

* Reenable System.Memory.Tests

* Reenable System.Linq.Parallel.Tests

* Update exclusions for System.Diagnostics.Process.Tests

* Reenable System.Dynamic.Runtime.Tests

* Reenable System.Runtime.Numerics.Tests

* Sort excluded tests

* Reenable System.Reflection.Tests

* Reenable System.Reflection.Emit.Tests

* Reenable System.Linq.Parallel.Tests

* Reenable System.Diagnostics.TraceSource.Tests

* Reenable System.Threading.Tests

* Disable tests that trigger UI on macOS

* Update System.Runtime.Tests exclusion list

* Update line numbers

Commit migrated from https://github.com/mono/mono/commit/921f00352f173c7f20551cc900a6c41fb73770f2

5 years agoCleanup patch_info code a little. (mono/mono#14037)
Jay Krell [Tue, 23 Apr 2019 08:57:31 +0000 (01:57 -0700)]
Cleanup patch_info code a little. (mono/mono#14037)

 e.g. whenever underlying representation is nul terminated string.
 MONO_PATCH_INFO_LDSTR_LIT
 MONO_PATCH_INFO_OBJC_SELECTOR_REF
almost the same as
 MONO_PATCH_INFO_JIT_ICALL
 MONO_PATCH_INFO_JIT_ICALL_ADDR
 MONO_PATCH_INFO_JIT_ICALL_ADDR_NOCALL

MONO_PATCH_INFO_LDSTR_LIT no longer allocate
 and copy the string from the AOT image into image_pool.

g_str_equal check pointer equality first.
While obviously correct, not obviously faster,
as it adds cost when strings are unequal.

Uninline g_str_equal, seems cleaner, but perhaps less efficient.

Combine the switch-exit and default: paths,
as only one case other than default exited the switch.

Lift out other common subexpressions.

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

5 years ago[runtime] Fix a warning. (mono/mono#14168)
Zoltan Varga [Tue, 23 Apr 2019 00:56:48 +0000 (20:56 -0400)]
[runtime] Fix a warning. (mono/mono#14168)

Commit migrated from https://github.com/mono/mono/commit/2477d73d58176c69107a829d04ad2dd2ac73efd2

5 years ago[llvm] Remove unused dlsym_cb. (mono/mono#14164)
Zoltan Varga [Tue, 23 Apr 2019 00:56:33 +0000 (20:56 -0400)]
[llvm] Remove unused dlsym_cb. (mono/mono#14164)

Commit migrated from https://github.com/mono/mono/commit/0a95f46f30512ed9f28bd1468035bc0ca6bfb90f

5 years ago[llvmonly] Enable invariant loads from preinited got slots. (mono/mono#14027)
Zoltan Varga [Mon, 22 Apr 2019 22:03:36 +0000 (18:03 -0400)]
[llvmonly] Enable invariant loads from preinited got slots. (mono/mono#14027)

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

5 years ago[image] Create MonoImageStorage to own the image raw data (mono/mono#13942)
Aleksey Kliger (λgeek) [Mon, 22 Apr 2019 18:43:11 +0000 (14:43 -0400)]
[image] Create MonoImageStorage to own the image raw data (mono/mono#13942)

* [image] Create MonoImageStorage to own the image raw data

Create a new data structure: MonoImageStorage.

It is an object that will have the responsibility for the raw data of a
MonoImage.  It has a string key and a refcount that is used to share a
MonoImageStorage between multiple MonoImage objects.

The reason we need this is because the current MonoAssembly/MonoImage design is
broken for multiple domains and (more evidently) it will be broken when we add
AssemblyLoadContext support.  The issue is that a MonoImage may be shared
between multiple domains (or ALCs), but it has a 'references' field which
points to a single other MonoAssembly.

This is a problem because the references of an image may be resolved
differently in different domains (or ALCs).

The eventual solution will be to stop sharing MonoImages based on path name (or
in the case of in-memory images based on a name made up from the address of the
byte blob).

However we still don't want to open the same data more than once (if we're on a
config where we don't have mmap, we malloc some memory and dump the data in
there - we don't want to do that multiple times for the same file).

So the solution is to create this MonoImageStorage object and make it possible
to share it based on path name, but don't give it any responsibilities except
for owning the memory.  It doesn't know anything about metadata or assemblies
or any of that stuff - it just owns a chunk of memory and knows when and how to
free it.

This commit just adds the MonoImageStorage object and wires it up in MonoImage
loading.  There should be no observable behavioral changes from this commit.

* [win32] call FreeLibrary from MonoImageStorage dtor, not mono_image_close_except_pools

If we're sharing a MonoImageStorage, only call FreeLibrary when the storage is
finally destroyed, not every time one of the images is closed.

Commit migrated from https://github.com/mono/mono/commit/43540e6649806a84257f1a385dbfe5482eb8ae7f

5 years agoSmall step toward reduction/elimination of JIT icall hashing. (mono/mono#14149)
Jay Krell [Mon, 22 Apr 2019 09:04:32 +0000 (02:04 -0700)]
Small step toward reduction/elimination of JIT icall hashing. (mono/mono#14149)

Ultimate goal is to significantly reduce or maybe completely
eliminate the hashing of JIT icalls.

It is not a small change.

This is a small digestable albeit tedious step toward that.

The "names" of opcode emulation icalls are needed for
token pasting and/or struct fields. They are needed without quotes.

This PR removes the quotes.
And then for now, just always restores them.

This is extracted from https://github.com/mono/mono/pull/14047
as a step toward making it easier to review.

Commit migrated from https://github.com/mono/mono/commit/800701fe3f370a3f1ab79723192fb3262d1b8375

5 years ago[interp] Fix buffer overflow when incrementing sp
Vlad Brezae [Fri, 19 Apr 2019 20:11:38 +0000 (23:11 +0300)]
[interp] Fix buffer overflow when incrementing sp

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

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

5 years agoBump monolite (mono/mono#14144)
Alexander Köplinger [Fri, 19 Apr 2019 22:35:18 +0000 (00:35 +0200)]
Bump monolite (mono/mono#14144)

Looks like monolite was broken somehow. Rebuild it.

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

5 years agoMerge pull request mono/mono#14136 from kjpou1/wasm-function-tests
Larry Ewing [Fri, 19 Apr 2019 21:08:12 +0000 (16:08 -0500)]
Merge pull request mono/mono#14136 from kjpou1/wasm-function-tests

[wasm] Fix NRE WebAssembly.Core.Array during initialization

Commit migrated from https://github.com/mono/mono/commit/061fb882951f3d7cced1c527b1a8d4ff75659196

5 years ago[loader] Don't store through a null ptr (mono/mono#14110)
Aleksey Kliger (λgeek) [Fri, 19 Apr 2019 19:57:31 +0000 (15:57 -0400)]
[loader] Don't store through a null ptr (mono/mono#14110)

* [loader] Dont't store through a null ptr

If 'status' is null, don't try to write to it.

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

* [metadata] Protect writes to MonoImageOpenStatus* in a few places.

When possible assert that `MonoImageOpenStatus *status` arguments to various
functions in the runtime aren't null.  There are a few places (MONO_API) where
it's possible that callers are passing null.  In that case, use a local
MonoImageOpenStatus, or check for null before doing assignments.

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

5 years agoMake dedicated MonoError for `mono_error_set_argument_out_of_range` (mono/mono#14119)
pedestrianlove [Fri, 19 Apr 2019 16:13:21 +0000 (00:13 +0800)]
Make dedicated MonoError for `mono_error_set_argument_out_of_range` (mono/mono#14119)

* Make dedicated MonoError for mono_error_set_argument_out_of_range

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

5 years ago[Coop] Convert performance counters and performance counter categories. (mono/mono...
Jay Krell [Fri, 19 Apr 2019 15:27:16 +0000 (08:27 -0700)]
[Coop] Convert performance counters and performance counter categories. (mono/mono#13623)

* Cut down on strlen calls.
But keep the shared memory format unchanged to match .NET. (i.e. don't
put string lengths in it).

* PR: MONO_ENTER_NO_SAFEPOINTS instead of gchandle.

Push/pop frames in loops and mind the return/goto/break/continue carefully, instead of using assignment.

*PR: Reduce gsize to adequate int, move multiple int declarations to same line.

* PR: Fix prototypes in disabled code.

* PR: Spell out `int` as `gint32`.

Use an uppercase guid to workaround Windows problem.

* A bit more true to the previous version.
* Reduce diff a little.
* if (is_ok()) around one line instead of goto around it.
* Restore some old code.
* Restore more verbosity, that used to have a point but no longer does.

Commit migrated from https://github.com/mono/mono/commit/435feaaa0201de4341198c0cec5e225732d50298

5 years ago[llvm] Avoid looking up intrinsics by name in most cases. (mono/mono#14029)
Zoltan Varga [Fri, 19 Apr 2019 08:15:54 +0000 (04:15 -0400)]
[llvm] Avoid looking up intrinsics by name in most cases. (mono/mono#14029)

[llvm] Avoid looking up intrinsics by name in most cases.

Commit migrated from https://github.com/mono/mono/commit/84f6e1dfacbb8deba277907028e9418b4fdfe5b3

5 years agoMerge pull request mono/mono#14129 from lewing/sample-tfm
Larry Ewing [Fri, 19 Apr 2019 02:24:47 +0000 (21:24 -0500)]
Merge pull request mono/mono#14129 from lewing/sample-tfm

[wasm] Fix the samples target framework

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

5 years ago[aot] Add a depfile= argument which causes the AOT compiler to write out a gcc style...
Zoltan Varga [Thu, 18 Apr 2019 20:41:47 +0000 (16:41 -0400)]
[aot] Add a depfile= argument which causes the AOT compiler to write out a gcc style dep file listing the dependencies between the output file and all referenced assemblies. (mono/mono#14124)

* [aot] Add a depfile= argument which causes the AOT compiler to write out a gcc style dep file listing the dependencies between the output file and all referenced assemblies.

* Add a manpage entry.

* Update after comments.

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

5 years agoMerge pull request mono/mono#14113 from vargaz/netcore-pinvoke
Larry Ewing [Thu, 18 Apr 2019 16:43:09 +0000 (11:43 -0500)]
Merge pull request mono/mono#14113 from vargaz/netcore-pinvoke

[wasm] Fix the types of the generated function declarations in the pinvoke table.

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

5 years agoProtecting boxing a null value (mono/mono#14018)
Thays Grazia [Thu, 18 Apr 2019 16:29:21 +0000 (13:29 -0300)]
Protecting boxing a null value (mono/mono#14018)

When a static method is called the obj is not used, so it can be null and it doesn't need to be boxed.
Adding an assert in the method to prevent other crash in this method if a NULL is received.

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

5 years ago[interp] disable tail call opt if managed debugger is enabled (mono/mono#14098)
Bernhard Urban [Thu, 18 Apr 2019 15:56:10 +0000 (17:56 +0200)]
[interp] disable tail call opt if managed debugger is enabled (mono/mono#14098)

[interp] disable tail call opt if managed debugger is enabled

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

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

5 years agoRespect call convention modopts in native wrappers. (mono/mono#14017)
Vincent Povirk [Thu, 18 Apr 2019 13:44:31 +0000 (08:44 -0500)]
Respect call convention modopts in native wrappers. (mono/mono#14017)

MS's C++ compiler emits code that uses this.

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

5 years agoMerge pull request mono/mono#13931 from lateralusX/lateralusX/external-direct-icalls...
Johan Lorensson [Thu, 18 Apr 2019 10:20:54 +0000 (06:20 -0400)]
Merge pull request mono/mono#13931 from lateralusX/lateralusX/external-direct-icalls-symbol-name

Add support for direct icalls using external functions not in icall-def.h.

Commit migrated from https://github.com/mono/mono/commit/90869d7708c6edaae2a213624c9bf9f89a062fec

5 years agomono_remoting_marshal_init in mono_marshal_get_proxy_cancast to register icalls....
Jay Krell [Thu, 18 Apr 2019 08:10:47 +0000 (01:10 -0700)]
mono_remoting_marshal_init in mono_marshal_get_proxy_cancast to register icalls. (mono/mono#14097)

Alternatively move the registration to mono_remoting_init.

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

5 years ago[netcore] Fix failures in System.Tests.MulticastDelegateTests (mono/mono#14096)
Filip Navara [Thu, 18 Apr 2019 06:39:31 +0000 (08:39 +0200)]
[netcore] Fix failures in System.Tests.MulticastDelegateTests (mono/mono#14096)

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

5 years ago[netcore] improve Windows support (mono/mono#14100)
Egor Bogatov [Thu, 18 Apr 2019 06:30:11 +0000 (09:30 +0300)]
[netcore] improve Windows support (mono/mono#14100)

* better Windows support

* remove unzip.py

* move FeaturePortableTimer to csproj

Commit migrated from https://github.com/mono/mono/commit/61dbc22bfd40654fe66a03d45c23e2357575c7dd

5 years agoMerge pull request mono/mono#14088 from vargaz/wasm-direct-calls
Larry Ewing [Wed, 17 Apr 2019 22:55:00 +0000 (17:55 -0500)]
Merge pull request mono/mono#14088 from vargaz/wasm-direct-calls

[llvmonly] Allow direct calls to inflated methods since they can initialize themselves correctly now.

Commit migrated from https://github.com/mono/mono/commit/93c45bae279f98b0c66349cab78a4f5d2ee83494

5 years agoMerge pull request mono/mono#14041 from kjpou1/wasm-sdk-packages
Larry Ewing [Wed, 17 Apr 2019 22:32:27 +0000 (17:32 -0500)]
Merge pull request mono/mono#14041 from kjpou1/wasm-sdk-packages

[wasm] [sdk] Build and package the sdk nugets.

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

5 years ago[interp] Small vt opcode optimisations (mono/mono#14040)
Vlad Brezae [Wed, 17 Apr 2019 18:47:48 +0000 (21:47 +0300)]
[interp] Small vt opcode optimisations (mono/mono#14040)

[interp] Simplify cpobj.vt

[interp] Optimize stelem.vt/ldelem.vt

[interp] Avoid unnecessary write barrier for ldobj.vt
Write barriers are only required for stores in the major heap/los.

[interp] Simplify ldfld.vt/stfld.vt

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

5 years ago[interp] Improve boxing/unboxing (mono/mono#14048)
Vlad Brezae [Wed, 17 Apr 2019 18:38:19 +0000 (21:38 +0300)]
[interp] Improve boxing/unboxing (mono/mono#14048)

* [interp] Remove redundant check

It can't be an enum if it is stored on the vtstack

* [interp] Optimize boxing

Makes boxing of primitives 4x faster and boxing of vt 3x faster.

* [interp] Remove unneccessary check in unbox

We do the same check as jit. Makes unboxing 10x faster.

* [interp] Extract some duplicate code for boxing

* [interp] Fix boxing of nullable with constrained calls

Before the box opcode optimization, it was handling nullable. When normally boxing a nullable we call the Box method, but this is awkward when doing a constrained call, so we just add a separate opcode. This is slightly slower than calling Box, but much faster than the old code using the generic mono_value_box_checked.

Commit migrated from https://github.com/mono/mono/commit/183de1c3022f5b6f409349c05a1b405f9c79c2bf

5 years agoReview feedback.
lateralusX [Wed, 17 Apr 2019 15:04:08 +0000 (17:04 +0200)]
Review feedback.

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

5 years ago[netcore] Fix two System.Tests.PseudoCustomAttributeTests tests (mono/mono#14073)
Egor Bogatov [Wed, 17 Apr 2019 14:39:38 +0000 (17:39 +0300)]
[netcore] Fix two System.Tests.PseudoCustomAttributeTests tests (mono/mono#14073)

Now all custom attribute related tests pass in System.Runtime.Tests.
Also this PR fixes broken acceptance tests for regular mono introduced in https://github.com/mono/mono/pull/13809

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

5 years ago[interp] Fix interp strmfld vt (mono/mono#14086)
Vlad Brezae [Wed, 17 Apr 2019 13:40:07 +0000 (16:40 +0300)]
[interp] Fix interp strmfld vt (mono/mono#14086)

* [interp] Fix store remote value type field

Looks like the culprit for some random mcs tests failures

* [interp] Delete dummy code

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

5 years agoReplace two element hash table with two element array and cheap linear search. (mono...
Jay Krell [Wed, 17 Apr 2019 09:06:28 +0000 (02:06 -0700)]
Replace two element hash table with two element array and cheap linear search. (mono/mono#14049)

Replace two element hash table with two element array and cheap linear search.

Maybe I misunderstand the code?
Or significant expansion is expected?

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

5 years agoFactor the function mono_call_add_patch_info out of a few lines of repeated code...
Jay Krell [Wed, 17 Apr 2019 07:41:54 +0000 (00:41 -0700)]
Factor the function mono_call_add_patch_info out of a few lines of repeated code in many backends. (mono/mono#13970)

This notably does not apply to amd64, x86.
They have more logic intertwined around the patch when they emit the call.

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

5 years ago[llvmonly] Add stubs for methods which cannot be compiled since they can be called...
Zoltan Varga [Tue, 16 Apr 2019 23:44:28 +0000 (19:44 -0400)]
[llvmonly] Add stubs for methods which cannot be compiled since they can be called directly.

Commit migrated from https://github.com/mono/mono/commit/605ea1555cef59c21d6b061f563212cf6b940ee8

5 years agoRemove a few string allocs/copies, i.e. for generic trampoline names. (mono/mono...
Jay Krell [Tue, 16 Apr 2019 22:37:10 +0000 (15:37 -0700)]
Remove a few string allocs/copies, i.e. for generic trampoline names. (mono/mono#14038)

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

5 years ago[arm] align stack pointer in throw trampoline (mono/mono#14078)
Bernhard Urban [Tue, 16 Apr 2019 22:36:05 +0000 (00:36 +0200)]
[arm] align stack pointer in throw trampoline (mono/mono#14078)

This is a regression introduced by mono/mono@e46fa20466010a18b9b9a8130f6d8c62899780b3

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

Commit migrated from https://github.com/mono/mono/commit/98a1d40584b5e40052c93d0e4059f821ee1609fa

5 years ago[llvmonly] Make direct calls to more methods, not enabled yet.
Zoltan Varga [Tue, 16 Apr 2019 20:39:21 +0000 (16:39 -0400)]
[llvmonly] Make direct calls to more methods, not enabled yet.

Commit migrated from https://github.com/mono/mono/commit/61d6860f217edf521c71193bc9ed7fc2e8cf47f9

5 years ago[aot] Prepend the assembly name to the mangled method names.
Zoltan Varga [Tue, 16 Apr 2019 20:38:52 +0000 (16:38 -0400)]
[aot] Prepend the assembly name to the mangled method names.

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

5 years ago[netcore] Allow cross-module direct calls to alloc wrappers.
Zoltan Varga [Tue, 16 Apr 2019 18:55:05 +0000 (14:55 -0400)]
[netcore] Allow cross-module direct calls to alloc wrappers.

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

5 years ago[llvmonly] Allow direct calls to inflated methods since they can initialize themselve...
Zoltan Varga [Tue, 16 Apr 2019 17:19:19 +0000 (13:19 -0400)]
[llvmonly] Allow direct calls to inflated methods since they can initialize themselves correctly now.

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

5 years ago[aot] Change how the context is computed in init_aot_method (). Instead of (mono...
Zoltan Varga [Tue, 16 Apr 2019 15:30:16 +0000 (11:30 -0400)]
[aot] Change how the context is computed in init_aot_method (). Instead of (mono/mono#14026)

getting it from the caller, save it in the aot image and read it back.
This will make it possible to emit direct calls to gshared methods later.

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

5 years agoRegister mono_gc_wbarrier_generic_nostore_internal regular with its own name, not...
Jay Krell [Tue, 16 Apr 2019 11:34:46 +0000 (04:34 -0700)]
Register mono_gc_wbarrier_generic_nostore_internal regular with its own name, not dynamic with a special name. (mono/mono#14042)

Commit migrated from https://github.com/mono/mono/commit/18f0bf055eb2bfa8981062bdad3af2fb4bbc9be4

5 years agoRegister g_free icall regular, as monoeg_g_free. (mono/mono#14044)
Jay Krell [Tue, 16 Apr 2019 11:34:29 +0000 (04:34 -0700)]
Register g_free icall regular, as monoeg_g_free. (mono/mono#14044)

The point here is that register_dyn is a bit obscure and could use clarification.

Commit migrated from https://github.com/mono/mono/commit/6225a9b031fd9d70d23cbb0139b471238e7616f5

5 years ago[netcore] Fix WaitHandle.SignalAndWait (mono/mono#13809)
Egor Bogatov [Tue, 16 Apr 2019 10:04:02 +0000 (13:04 +0300)]
[netcore] Fix WaitHandle.SignalAndWait (mono/mono#13809)

* fix failing tests

* Add build-corefx-test-for- rule

* Update WaitHandle.cs

* fix S.T.T.rsp file

* fix build

* bump corlib version

* handle new errors in old mono

* Update w32handle.c

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

5 years ago[netcore] Fix System.Tests.PseudoCustomAttributeTests.* tests (mono/mono#14065)
Egor Bogatov [Tue, 16 Apr 2019 09:51:26 +0000 (12:51 +0300)]
[netcore] Fix System.Tests.PseudoCustomAttributeTests.* tests (mono/mono#14065)

* fix Custom Attribute tests

* fix CA

* fix CA

* Update MonoCustomAttrs.cs

* fix MarshalAsAttribute

* Update MarshalAsAttribute.cs

* Update MarshalAsAttribute.cs

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

5 years ago[netcore] Add linker descriptor for corelib. (mono/mono#14064)
Zoltan Varga [Tue, 16 Apr 2019 09:48:12 +0000 (05:48 -0400)]
[netcore] Add linker descriptor for corelib. (mono/mono#14064)

* [netcore] Add linker descriptor. This is just a copy of the mscorlib descriptor.

* [netcore] Update linker descriptor for netcore.

* Remove com/remoting related classes.
* Other smaller changes.

* [netcore] Allow loading corlib from MONO_PATH.

* Update System.Private.CoreLib.xml

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

5 years agoMerge branch 'master' of https://github.com/mono/mono into wasm-sdk-packages
Kenneth Pouncey [Tue, 16 Apr 2019 03:20:44 +0000 (05:20 +0200)]
Merge branch 'master' of https://github.com/mono/mono into wasm-sdk-packages

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

5 years ago[llvmonly] Fix a buffer overflow. (mono/mono#14057)
Zoltan Varga [Mon, 15 Apr 2019 23:23:05 +0000 (19:23 -0400)]
[llvmonly] Fix a buffer overflow. (mono/mono#14057)

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

5 years ago[aot] change method table generation so that it works for larger assemblies on ARM...
Bernhard Urban [Mon, 15 Apr 2019 22:25:51 +0000 (00:25 +0200)]
[aot] change method table generation so that it works for larger assemblies on ARM (mono/mono#14043)

[aot] change method table generation so that it works for larger assemblies on ARM

At the end of the AOT compilation, we dump a table containing all method
entrypoints using the toolchain linker to resolve the addresses. Previously
we used `bl` for that, however on larger assemblies the offset might
overflow the 24bit immediate (thus, the linker bailing out with
"Error: branch out of range"). Instead, using `ldr pc,=<label>` followed
by `.ltorg` emits the full 32bit address to a method. That takes 8 bytes
for each method instead of 4 bytes.

( I couldn't reopen https://github.com/mono/mono/pull/3486 anymore)

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

5 years ago[netcore] Misc. fixes (mono/mono#14050)
Filip Navara [Mon, 15 Apr 2019 13:02:47 +0000 (15:02 +0200)]
[netcore] Misc. fixes (mono/mono#14050)

* Check for lower bounds on non-zero-based arrays

* Grab correct version of System.Reflection.Context

* Move Attribute type validation to fix checking for custom attributes using interface types

* Fix parameter checks

Commit migrated from https://github.com/mono/mono/commit/012ac05aa9de47ae421af4c0e7d0724de2d18d82

5 years ago[interp] Static field access fixes (mono/mono#14009)
Vlad Brezae [Mon, 15 Apr 2019 12:35:34 +0000 (15:35 +0300)]
[interp] Static field access fixes (mono/mono#14009)

* [interp] Further optimize static vt field access

We don't require any write barrier checking since we always copy between interpreter vt_stack and static data. We can also include the vt size in the code stream. Makes it over 1.5x times faster.

* [interp] Fix static field access using ldfld/stfld

Static field access using the ldfld/stfld instructions was not updated when stsfld/ldsfld were optimized.

* [interp] Fix special static vtype field access

Commit migrated from https://github.com/mono/mono/commit/79f15ccd35a0f921a2ff6744d564cbc47d8877d0

5 years ago[netcore] Switch to msbuild nuget which is available for all platforms (mono/mono...
Filip Navara [Mon, 15 Apr 2019 09:30:46 +0000 (11:30 +0200)]
[netcore] Switch to msbuild nuget which is available for all platforms (mono/mono#13989)

* Switch to msbuild nuget which is available for all platforms

* Remove check-env rule dependency

* Add missing reference to System.Composition.TypedParts

* Sort references by name

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

5 years ago[netcore] Do not inline if [DynamicSecurityMethod] exists (mono/mono#14032)
Egor Bogatov [Mon, 15 Apr 2019 06:34:23 +0000 (09:34 +0300)]
[netcore] Do not inline if [DynamicSecurityMethod] exists (mono/mono#14032)

* fix crash

* fix build

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

5 years agoRemove redundant check of llvm_acfg->aot_opts.direct_icalls. (mono/mono#14028)
Jay Krell [Sun, 14 Apr 2019 19:58:17 +0000 (12:58 -0700)]
Remove redundant check of llvm_acfg->aot_opts.direct_icalls. (mono/mono#14028)

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

5 years ago[netcore] Make System.Private.CoreLib and host APIs compilable on Windows (mono/mono...
Filip Navara [Sun, 14 Apr 2019 16:58:40 +0000 (18:58 +0200)]
[netcore] Make System.Private.CoreLib and host APIs compilable on Windows (mono/mono#13943)

* Fix Windows builds of CLR hosting API

* Make System.Private.CoreLib compilable on Windows

* Remove accidental change

* Fix Unix build

* Update GlobalizationMode.cs

* Update GlobalizationMode.Unix.cs

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

5 years agoRemove constant parameter to mono_tls_get_tls_setter and mono_tls_get_tls_getter...
Jay Krell [Sun, 14 Apr 2019 14:24:18 +0000 (07:24 -0700)]
Remove constant parameter to mono_tls_get_tls_setter and mono_tls_get_tls_getter. (mono/mono#13894)

It doesn't matter, but for code clarity.
Also strengthen the types of both of these, though rarely enough to avoid casts.

Commit migrated from https://github.com/mono/mono/commit/568c822ae9c23acecff478a2deaeb81e942ffbc1

5 years ago[interp] Optimize ldobj/stobj (mono/mono#13761)
Vlad Brezae [Fri, 12 Apr 2019 18:50:05 +0000 (21:50 +0300)]
[interp] Optimize ldobj/stobj (mono/mono#13761)

* [interp] Remove dead code

It doesn't make sense to dereference a value type

* [interp] Emit faster instructions for ldobj

* [interp] Emit faster instructions for stobj

* [interp] Simply ldobj vt

This makes it 10x faster

* [interp] Make ldind.r8 unaligned friendly

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

5 years agoIncrease gsharedvt trampolines by 10% from 4000 to 4400.
Jay Krell [Thu, 11 Apr 2019 10:03:52 +0000 (03:03 -0700)]
Increase gsharedvt trampolines by 10% from 4000 to 4400.

There are many minor arguments here.

Where this matters most -- iOS -- the pool is already dynamic.

Other platforms could use a dynamic pool or JIT (despite FullAOT).
Using JIT would defeat the test coverage.

Mitigates https://github.com/mono/mono/issues/13888.
If this feels too tenative, go bigger.

Commit migrated from https://github.com/mono/mono/commit/22bbf4416a64beb12ec2b0b5c7293892a12f0660

5 years ago[w32error] Add ENONET error case
Maxim Lipnin [Thu, 11 Apr 2019 12:51:27 +0000 (15:51 +0300)]
[w32error] Add ENONET error case

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

5 years ago[jit] Make dlmalloc use mono_valloc so it picks up the MAP_JIT flag on osx. (mono...
Zoltan Varga [Thu, 11 Apr 2019 13:19:42 +0000 (09:19 -0400)]
[jit] Make dlmalloc use mono_valloc so it picks up the MAP_JIT flag on osx. (mono/mono#13979)

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

Commit migrated from https://github.com/mono/mono/commit/5036336df811fe55d4721c2ef9b1152456ddb32a

5 years ago[debugger-agent]: Print error if the socket can not be created, remove assert that...
Miguel de Icaza [Thu, 11 Apr 2019 12:38:17 +0000 (08:38 -0400)]
[debugger-agent]: Print error if the socket can not be created, remove assert that probed the wrong value, Coverity 1307166 (mono/mono#13860)

Commit migrated from https://github.com/mono/mono/commit/56db577988d3b2244d64d32e5f885126641b2332

5 years ago[jit] Disable inlining for methods with [System.Security.DynamicSecurityMethod],...
Zoltan Varga [Sun, 7 Apr 2019 21:20:31 +0000 (17:20 -0400)]
[jit] Disable inlining for methods with [System.Security.DynamicSecurityMethod], its used to make methods which contain a StackCrawlMark.

Also check that the attribute is present for StackMaekMark locals.

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

5 years agoMerge pull request mono/mono#13815 from radical/nuget-5
Marek Safar [Thu, 11 Apr 2019 09:08:41 +0000 (11:08 +0200)]
Merge pull request mono/mono#13815 from radical/nuget-5

[nuget] Bump to nuget 5.0.0

Commit migrated from https://github.com/mono/mono/commit/995bbb998c638b3fe563dbaa5aff6c5198d1d5ce

5 years ago[netcore] Implement Assembly.GetExecutingAssembly with stack mark parameter (mono...
Filip Navara [Thu, 11 Apr 2019 08:31:22 +0000 (10:31 +0200)]
[netcore] Implement Assembly.GetExecutingAssembly with stack mark parameter (mono/mono#13903)

* Implement Assembly.GetExecutingAssembly with stack mark parameter

* Address PR feedback

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

5 years ago[netcore] Fix marshalling of ref ptr return types (mono/mono#13914)
Filip Navara [Thu, 11 Apr 2019 08:31:11 +0000 (10:31 +0200)]
[netcore] Fix marshalling of ref ptr return types (mono/mono#13914)

* Fix marshalling of ref ptr return types

* Revert assert -> exception change

Commit migrated from https://github.com/mono/mono/commit/847296f1f0f71468fb08d1c6b48a4a1775f94c5c

5 years agoDo not crash the runtime in System.Reflection.Emit.ILGeneration tests (mono/mono...
Filip Navara [Thu, 11 Apr 2019 08:30:59 +0000 (10:30 +0200)]
Do not crash the runtime in System.Reflection.Emit.ILGeneration tests (mono/mono#13917)

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

5 years agoMerge pull request mono/mono#13959 from filipnavara/link-windows
Johan Lorensson [Thu, 11 Apr 2019 08:18:47 +0000 (04:18 -0400)]
Merge pull request mono/mono#13959 from filipnavara/link-windows

[windows] Link libgcc statically on Windows

Commit migrated from https://github.com/mono/mono/commit/562ac284e4e4705384b129712f8c1fbb897bf69e

5 years agoMerge pull request mono/mono#13946 from lateralusX/lateralusX/merge-icall-hash-maps
Johan Lorensson [Thu, 11 Apr 2019 06:58:59 +0000 (02:58 -0400)]
Merge pull request mono/mono#13946 from lateralusX/lateralusX/merge-icall-hash-maps

Merge icall_hash and icall_hash_foreign into one.

Commit migrated from https://github.com/mono/mono/commit/0c1489b83687f1cd76748a557eba7414adfdd20c

5 years agoCleaning exceptions during static constructor loading (mono/mono#13962)
Thays Grazia [Wed, 10 Apr 2019 22:25:49 +0000 (19:25 -0300)]
Cleaning exceptions during static constructor loading (mono/mono#13962)

Cleaning exceptions during static constructor loading

Reset the stack_trace and trace_ips because the type initialization exception is reused.
Fixes mono/mono#13714

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