platform/upstream/dotnet/runtime.git
4 years agoFix x86 build break and reflect PR feedback
Jan Vorlicek [Mon, 6 Apr 2020 13:13:27 +0000 (15:13 +0200)]
Fix x86 build break and reflect PR feedback

4 years agoLittle refactoring based on PR feedback
Jan Vorlicek [Sat, 4 Apr 2020 00:22:30 +0000 (17:22 -0700)]
Little refactoring based on PR feedback

4 years agoFix Unix build break
Jan Vorlicek [Fri, 3 Apr 2020 08:56:03 +0000 (10:56 +0200)]
Fix Unix build break

4 years agoMove the reverse pinvoke frame check to EECodeManager
Jan Vorlicek [Thu, 2 Apr 2020 20:45:07 +0000 (22:45 +0200)]
Move the reverse pinvoke frame check to EECodeManager

Reflects PR feedback.

4 years agoPrevent return address hijacking of NativeCallable method
Jan Vorlicek [Thu, 2 Apr 2020 15:27:21 +0000 (17:27 +0200)]
Prevent return address hijacking of NativeCallable method

We have seen a failure in the CI where the OnHijackWorkerTripThread was
called in preemptive mode and so a contract in Thread::SetFrame down its
call chain has fired when checking that the thread is in cooperative
mode.
I have found that the issue is caused by hijacking a NativeCallable
method. Such methods switch to preemptive mode before they return and so
when they are hijacked, the OnHijackWorkerTripThread is called in
preemptive mode.

The fix is to prevent return address hijacking for NativeCallable
methods.

4 years agoFix large version bubble field offset computation (#34401)
Jan Vorlicek [Thu, 2 Apr 2020 13:11:13 +0000 (15:11 +0200)]
Fix large version bubble field offset computation (#34401)

This change fixes two bugs in field offset computation where the results
that crossgen2 was getting was different from what runtime computes. In
both cases, the problem was caused by alignment of a derived class being
done differently.
The first issue was happening for the case when the base and derived
classes are in different assemblies. Runtime detect if two assemblies
are in the same version bubble using the native manifest metadata table
containing a list of assemblies that was supposed to contain all
assemblies that the assembly being compiled was found to reference.
However, it contained only assemblies that were not in the original
assembly reference list, e.g. ones pulled in by inlining. So runtime
wasn't getting the same view on what's in the bubble.
The second issue happened for the case when both the base and derived
class were from the same assembly, but one of the ancestor classes had a
field of a value class type that was from another assembly and could be
transitively decomposed to fields of types from the same assembly or types
like primitive types, object, pointer or enums. The alignment of a derived
class members is determined based on that and runtime decision is to
align if there is any type from another assembly in the type hierarchy
of a class or in fields of any ancestors.
For example, the decision would be different for the following scenario:
Assembly A:
struct AA
{
    int a;
}
Assembly B:
class B1
{
    AA aa;
}
class B2 : B1
{
    int x;
}
Here crossgen2 would not align the first member but runtime would. So the
layout of B2 produced by crossgen2 would be:
```
Offset  Field
0       MethodTable
8       a
12      x
```
Layout produced by the runtime would be
```
Offset  Field
0       MethodTable
8       a
16      x
```

The fix for the first issue is to put all referenced assemblies into the
native manifest metadata.
The fix for the second issue is to stop decomposing members of value
classes once we hit a value class that's from another module.

4 years agoR2RDump fixes for parsing composite images (#34429)
Tomáš Rylek [Thu, 2 Apr 2020 12:52:48 +0000 (14:52 +0200)]
R2RDump fixes for parsing composite images (#34429)

1. Fixed several inconsistencies w.r.t. signature context in
recursive descent into generic signatures based on offline
investigation with JanV.

2. Don't crash the dump upon invalid UTF8 characters.

Thanks

Tomas

4 years agoFix ordering of the instructions (#34447)
Andrey Kurdyumov [Thu, 2 Apr 2020 11:55:41 +0000 (17:55 +0600)]
Fix ordering of the instructions (#34447)

Command for opening Visual Studio works from root folder,
but not inside library folder as was implied by ordering in the instructions.

4 years agoEnhance PAL initialization order (#34308)
Jan Vorlicek [Thu, 2 Apr 2020 10:37:58 +0000 (12:37 +0200)]
Enhance PAL initialization order (#34308)

* Enhance PAL initialization order

The CGroups initialization has _ASSERTE that is not asserting because
debugging support was being initialized after the CGroups initialization.

This change moves the debugging support initialization to the earliest
possible point. It also modifies it so that it doesn't depend on the
PAL env functions and uses getenv instead. And finally, initialization
of the critical section for debug printf is moved to the very end
of DBG_init_channels just as a little cleanup.

4 years agoFix crossgen2 delegates to static generic methods (#34370)
Jan Vorlicek [Thu, 2 Apr 2020 10:19:59 +0000 (12:19 +0200)]
Fix crossgen2 delegates to static generic methods (#34370)

In crossgen2 we convert all methods to their canon versions in
CreateMethodEntrypointNodeHelper, which causes a problem for
delegates set to generic static methods. When these methods are called
via a delegate, at runtime it gets a hidden generic argument that
is a MethodDesc of a canon version of the static method instead of the
specific instantiation.

I've investigated why we convert all methods to their canon versions in
the CreateMethodEntrypointNodeHelper and I've found a PR by @trylek
in CoreRT repo that has introduced it. I've discussed that with him, but
he wasn't able to figure out why the change was made and it seems like
it was mostly accidental or fixing some problem that no longer exists.

Removing this conversion fixes the problem and I have verified that it
doesn't introduce new ones by running both pri 1 CoreCLR tests and the
libraries tests. It has also made the diff between code generated by
crossgen1 and crossgen2 e.g. for System.Private.CoreLib.dll smaller.

4 years agoInitial Mono Android CI (#34125)
Jo Shields [Thu, 2 Apr 2020 08:29:42 +0000 (04:29 -0400)]
Initial Mono Android CI (#34125)

4 years agoMove StrongNameKeyId=Open default value down after arcade is imported (#34428)
Santiago Fernandez Madero [Thu, 2 Apr 2020 05:37:52 +0000 (22:37 -0700)]
Move StrongNameKeyId=Open default value down after arcade is imported (#34428)

4 years agoAdd test for native library load through AssemblyLoadContext.LoadUnmanagedDll (#34425)
Elinor Fung [Thu, 2 Apr 2020 03:00:11 +0000 (20:00 -0700)]
Add test for native library load through AssemblyLoadContext.LoadUnmanagedDll (#34425)

* Reorganize the NativeLibrary tests to be in one root folder and build/use the same native library for testing

* Add test for AssemblyLoadContext.LoadUnmanagedDll

4 years agoDelete Ubuntu 14.04 conditions (#34361)
Jan Kotas [Thu, 2 Apr 2020 02:38:22 +0000 (19:38 -0700)]
Delete Ubuntu 14.04 conditions (#34361)

Ubuntu 14.04 is no longer supported.

4 years agoEliminate dead configuration code (#34285)
Andrew Au [Thu, 2 Apr 2020 02:27:21 +0000 (19:27 -0700)]
Eliminate dead configuration code (#34285)

* Eliminate dead configuration code

* Remove more dead code

* Eliminating EEConfig::GetConfiguration_DontUse_

* Eliminate EEConfig::GetConfigValueCallback

* Eliminate ConfigSearch

4 years agoFix write behind allocated memory in thread name setting (#34424)
Jan Vorlicek [Thu, 2 Apr 2020 00:57:02 +0000 (02:57 +0200)]
Fix write behind allocated memory in thread name setting (#34424)

The code in CorUnix::InternalSetThreadDescription is writing behind
the end of the allocated memory in case the name is shorter than 16
characters. That is causing memory heap corruption.

4 years agoBuild managed part of crossgen2 as platform independent (AnyCPU) (#33041)
Gleb Balykov [Wed, 1 Apr 2020 21:33:32 +0000 (00:33 +0300)]
Build managed part of crossgen2 as platform independent (AnyCPU) (#33041)

4 years agoReport correct max depth in exception message (#34410)
Thomas Levesque [Wed, 1 Apr 2020 20:49:39 +0000 (22:49 +0200)]
Report correct max depth in exception message (#34410)

Co-authored-by: Thomas Levesque <thomaslevesque@users.noreply.github.com>
4 years agoupdate perf jitdump for ppc64/ppc64le and s390x (#34373)
monojenkins [Wed, 1 Apr 2020 20:09:37 +0000 (16:09 -0400)]
update perf jitdump for ppc64/ppc64le and s390x (#34373)

Add missing constants to handle ppc64/ppc64le and s390x platforms.

Related: https://github.com/mono/mono/commit/68a8b9290958ee5e9b21d8ff6b73a707e2504d39
Fixes: https://github.com/mono/mono/issues/19402

Co-authored-by: sharkcz <sharkcz@users.noreply.github.com>
4 years agoPerf followup for Pinned Object Heap (#34215)
Vladimir Sadov [Wed, 1 Apr 2020 20:08:53 +0000 (13:08 -0700)]
Perf followup for Pinned Object Heap (#34215)

* free list bucket skipping

* couple more tweaks

* More size buckets in POH free lists

* static_data_table

* PR feedback

* off-by-one error in BASE_LOH_ALIST_BITS

4 years agoEnsure generic parameter constraint type is included when building image (#34346)
monojenkins [Wed, 1 Apr 2020 20:01:28 +0000 (16:01 -0400)]
Ensure generic parameter constraint type is included when building image (#34346)

sets.

This fixes: https://issuetracker.unity3d.com/issues/editor-crash-when-entering-and-exiting-playmode-for-a-few-times-with-microsoft-maps-sdk

@joncham and I were working on this we hit the two asserts that I've removed. We were wondering if they were still needed?

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: UnityAlex <UnityAlex@users.noreply.github.com>
4 years ago[wasm] Throw an exception when trying to start a thread instead of asserting. (#34347)
monojenkins [Wed, 1 Apr 2020 19:13:10 +0000 (15:13 -0400)]
[wasm] Throw an exception when trying to start a thread instead of asserting. (#34347)

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years ago[mono] Fix finalizer thread init in iOS sample (#34405)
Alexis Christoforides [Wed, 1 Apr 2020 19:05:19 +0000 (15:05 -0400)]
[mono] Fix finalizer thread init in iOS sample (#34405)

Starting with https://github.com/mono/mono/pull/16907 , the runtime ends in GC-Safe state (mode) after mono_jit_init_version() is called. mono_gc_init_finalizer_thread() expects the GC to not already be in safe mode.

4 years agoUpdate ownership of area-System.ServiceModel (#34408)
Stephen Bonikowsky [Wed, 1 Apr 2020 17:14:43 +0000 (10:14 -0700)]
Update ownership of area-System.ServiceModel (#34408)

Stephen Bonikowsky is no longer on the WCF team, updating ownership.

4 years agoRevert "Revert "Switch reverse PInvoke to the NativeCallable plan (#34251)" (#34306...
Jan Kotas [Wed, 1 Apr 2020 16:28:04 +0000 (09:28 -0700)]
Revert "Revert "Switch reverse PInvoke to the NativeCallable plan (#34251)" (#34306)" (#34315)

This reverts commit 94c4b5248bbf7f3219ca4af7960832d9acf218da.

4 years agoDisable test on windows and enable on other platforms (#34331)
Jan Jahoda [Wed, 1 Apr 2020 15:11:59 +0000 (17:11 +0200)]
Disable test on windows and enable on other platforms (#34331)

* Disable test on windows and enable on other platforms

* Remove mac from test

4 years agoCall into ETW methods in ConcurrentBag only when logging is enabled (#34392)
Marek Safar [Wed, 1 Apr 2020 15:08:58 +0000 (17:08 +0200)]
Call into ETW methods in ConcurrentBag only when logging is enabled (#34392)

4 years ago[mono] Fix setMArch, getArchName() doesn't work as expected (#34368)
Egor Bogatov [Wed, 1 Apr 2020 12:23:24 +0000 (15:23 +0300)]
[mono] Fix setMArch, getArchName() doesn't work as expected (#34368)

Turns out `llvm::Triple(llvm::sys::getDefaultTargetTriple()).getArchName()` doesn't work as expected on all targets so the only option is to set arch via defines.

NOTE: it accepts "x86-64", not "x86_64

4 years agoRemove duplicated .gitignore patterns (#34281)
pi1024e [Wed, 1 Apr 2020 09:46:37 +0000 (05:46 -0400)]
Remove duplicated .gitignore patterns (#34281)

4 years agoFix build break in coreclr where -os is not supported in Windows (#34358)
Santiago Fernandez Madero [Wed, 1 Apr 2020 08:33:17 +0000 (01:33 -0700)]
Fix build break in coreclr where -os is not supported in Windows (#34358)

4 years ago[mono] fix SIMD instructions' availability (#34319)
Egor Bogatov [Wed, 1 Apr 2020 08:26:02 +0000 (11:26 +0300)]
[mono] fix SIMD instructions' availability (#34319)

4 years ago[mono] Fix LLVM JIT build on arm64 host (#34332)
Egor Bogatov [Wed, 1 Apr 2020 08:25:08 +0000 (11:25 +0300)]
[mono] Fix LLVM JIT build on arm64 host (#34332)

4 years ago[mono] Set MArch in llvm-jit (#34350)
Egor Bogatov [Wed, 1 Apr 2020 08:24:30 +0000 (11:24 +0300)]
[mono] Set MArch in llvm-jit (#34350)

4 years agoDisable Bitmap round-tripping tests for old libgdiplus versions (#34354)
Jan Kotas [Wed, 1 Apr 2020 06:37:57 +0000 (23:37 -0700)]
Disable Bitmap round-tripping tests for old libgdiplus versions (#34354)

* Fix filename typo

* Disable Bitmap round-tripping tests for old libgdiplus versions

Old libgdiplus versions have uninitialized stack variable bug that makes Bitmap round-tripping unreliable. The bug causes Bitmap.Flags, Bitmap.HorizontalResolution and Bitmap.VerticalResolution properties to be set to bogus values if the stack happens to contain certain bit patterns. This bug was fixed for libgdiplus 6 by https://github.com/mono/libgdiplus/commit/81e45a1d5a3ac3cf035bcc3fabb2859818b6cc04#diff-c96a8261ecb168c12b44248208da21c0R118.

* Fix and simplify gdiplus library loading

4 years agoFix System.Data.SqlClient baseline (#34352)
Matt Mitchell [Wed, 1 Apr 2020 05:57:40 +0000 (22:57 -0700)]
Fix System.Data.SqlClient baseline (#34352)

* Fix System.Data.SqlClient version

Fixes https://github.com/dotnet/runtime/issues/34351

* Update Microsoft.Windows.Compatibility.pkgproj

4 years agoDisable test based on 34178 (#34179)
Jarret Shook [Wed, 1 Apr 2020 01:55:42 +0000 (18:55 -0700)]
Disable test based on 34178 (#34179)

* Disable test based on 34178

* Try with */*

* Fix diff

4 years agoFixing intellisense in vscode for src and ref projects (#34025)
Anirudh Agnihotry [Tue, 31 Mar 2020 22:30:00 +0000 (15:30 -0700)]
Fixing intellisense in vscode for src and ref projects (#34025)

* fixing intel for ref and src

* fixing ref and src intell

* renaming props file

* remove extra property

* fixing the intellisense in tests

* add extra line

* addressing feedback

* revert shim path

* fix allconfig restore

* adding comment

4 years ago[FileSystem] ReAdd check for same device (#34343)
Mitchell Hwang [Tue, 31 Mar 2020 21:47:34 +0000 (17:47 -0400)]
[FileSystem] ReAdd check for same device (#34343)

Co-authored-by: Mitchell Hwang <mihw@microsoft.com>
4 years agoFix ProfileTailCallNaked so it doesn't write xmm1 past the end of its stack (#33908)
David Mason [Tue, 31 Mar 2020 20:59:51 +0000 (13:59 -0700)]
Fix ProfileTailCallNaked so it doesn't write xmm1 past the end of its stack (#33908)

* Fix ProfileTailCallNaked so it doesn't write xmm1 past the end of its stack, and do some documentation/refactoring.

* code review feedback

4 years agoadd support for FreeBSD cross-compilation (#34000)
Tomas Weinfurt [Tue, 31 Mar 2020 20:36:32 +0000 (13:36 -0700)]
add support for FreeBSD cross-compilation (#34000)

* add support for FreeBSD cross-compilation

* feedback from review

* update detection

* add openssl to docs

* feedback from reviews

* feedback from reviews

* final cleanup

* feedback from reviews

* simplify detection of route.h

* correct __CrossBuild detection

* use TargetOS for installer

4 years agoupdate brancing to preview4 (#34338)
Anirudh Agnihotry [Tue, 31 Mar 2020 20:14:14 +0000 (13:14 -0700)]
update brancing to preview4 (#34338)

4 years agoInitial proposal for P/Invokes via Source Generators (#33742)
Aaron Robinson [Tue, 31 Mar 2020 19:19:00 +0000 (12:19 -0700)]
Initial proposal for P/Invokes via Source Generators  (#33742)

* Initial proposal for P/Invokes via Source Generators.

4 years agoNativeCallable bugfixes (#34335)
Jan Kotas [Tue, 31 Mar 2020 19:06:57 +0000 (12:06 -0700)]
NativeCallable bugfixes (#34335)

- Fix race condition in JIT_ReversePInvokeEnter
- Disable R2R for x86 on all platforms

4 years ago[debugger] Adding static to ss_req_acquire and ss_req_count (#34327)
monojenkins [Tue, 31 Mar 2020 18:37:01 +0000 (14:37 -0400)]
[debugger] Adding static to ss_req_acquire and ss_req_count (#34327)

Adding static to ss_req_acquire and ss_req_count
Fixes mono/mono#19389

Co-authored-by: thaystg <thaystg@users.noreply.github.com>
4 years agoApply formatting patch (#34333)
Jan Kotas [Tue, 31 Mar 2020 17:22:59 +0000 (10:22 -0700)]
Apply formatting patch (#34333)

4 years agoCache parameterized ctor delegates in class info rather than converter (#34248)
Layomi Akinrinade [Tue, 31 Mar 2020 17:13:42 +0000 (13:13 -0400)]
Cache parameterized ctor delegates in class info rather than converter (#34248)

* Cache parameterized ctor delegates in class info rather than converter

* Address review feedback - move delegate assignment to start of deserialization

* Address review feedback - nullability

4 years agoGuard against deserializing types with open generics (#34163)
Layomi Akinrinade [Tue, 31 Mar 2020 17:11:35 +0000 (13:11 -0400)]
Guard against deserializing types with open generics (#34163)

* Guard against deserializing types with open generics

* Include serialization tests

* Address review feedback

* Address review feedback

4 years agoCheck for COM registration functions on base types of registered type (#34307)
Elinor Fung [Tue, 31 Mar 2020 17:08:11 +0000 (10:08 -0700)]
Check for COM registration functions on base types of registered type (#34307)

4 years agoRemove inactive JsonElement test that depends on JSON path being set on DOM exception...
Layomi Akinrinade [Tue, 31 Mar 2020 17:07:15 +0000 (13:07 -0400)]
Remove inactive JsonElement test that depends on JSON path being set on DOM exceptions (#34167)

4 years ago[mono] Implement Environment.GetFolderPath on iOS (#34022)
Egor Bogatov [Tue, 31 Mar 2020 14:23:20 +0000 (17:23 +0300)]
[mono] Implement Environment.GetFolderPath on iOS (#34022)

* Implement Environment.GetFolderPath on iOS

* Address feedback

* Move GetFolderPathCore to Environment.Unix.GetFolderPathCore.cs

* Fix build issue

* Address feedback

* cache all special directories

* Fix build issue

* remove a whitespace

* Fix UserProfile issue

* undo changes in GetEnvironmentVariableCore

* Update Environment.Unix.Mono.cs

* Extract to InternalGetEnvironmentVariable

* Fix build issue

* Return emtpy string if underlying native function returns null

* Add nullability

4 years agoUpdate Microsoft.CodeAnalysis.FxCopAnalyzers to 3.0.0-beta3.final (#34312)
Stephen Toub [Tue, 31 Mar 2020 14:20:36 +0000 (10:20 -0400)]
Update Microsoft.CodeAnalysis.FxCopAnalyzers to 3.0.0-beta3.final (#34312)

4 years agoExpression.Field should validate field name for null (#34301)
Vitek Karas [Tue, 31 Mar 2020 13:53:01 +0000 (06:53 -0700)]
Expression.Field should validate field name for null (#34301)

Small change to correctly check for null in one of the overloads of Expression.Field.

4 years ago[mono] Use $(HostArch) for LLVM packages (#34322)
Egor Bogatov [Tue, 31 Mar 2020 13:26:52 +0000 (16:26 +0300)]
[mono] Use $(HostArch) for LLVM packages (#34322)

* Use HostArch for LLVM packages

* define HostArch for mono

4 years agoInitial perf jitdump implementation (#33893)
monojenkins [Tue, 31 Mar 2020 13:04:01 +0000 (09:04 -0400)]
Initial perf jitdump implementation (#33893)

Fixes mono/mono#17024

Co-authored-by: fanyang-mono <fanyang-mono@users.noreply.github.com>
4 years ago[runtime] Fix a problem with PR mono/mono#19361. (#34299)
monojenkins [Tue, 31 Mar 2020 09:06:04 +0000 (05:06 -0400)]
[runtime] Fix a problem with PR mono/mono#19361. (#34299)

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years agoStreamline C heap allocations (#34289)
Jan Kotas [Tue, 31 Mar 2020 05:32:29 +0000 (22:32 -0700)]
Streamline C heap allocations (#34289)

- Remove unnecessary layers in heap allocation APIs
- Delete HeapCreate/Alloc/Free/Destroy from the PAL

4 years agoRemove TargetOS renaming under installer (#34313)
Jan Kotas [Tue, 31 Mar 2020 05:02:44 +0000 (22:02 -0700)]
Remove TargetOS renaming under installer (#34313)

4 years agoMerge pull request #34208 from maryamariyan/inspection
Maryam Ariyan [Tue, 31 Mar 2020 05:00:44 +0000 (22:00 -0700)]
Merge pull request #34208 from maryamariyan/inspection

Extensions commit mop-up

4 years agoChange PublicKeyToken for M.E. src and test projects
Maryam Ariyan [Fri, 27 Mar 2020 22:04:40 +0000 (15:04 -0700)]
Change PublicKeyToken for M.E. src and test projects
- Updates InternalsVisibleTo files as well

- Setup Logging.EventSource.Tests
- Fix three failing EventSourceLoggerTest tests
- Delete file: IntegrationTesting csproj not needed.
- Rename folder test -> tests (Logging/tests/DI.Common/tests)
- Cleanup other csproj

    fix compile issue

4 years agoCondition before/after import in IL.Sdk for pre5.0 (#34278)
Viktor Hofer [Tue, 31 Mar 2020 03:25:43 +0000 (05:25 +0200)]
Condition before/after import in IL.Sdk for pre5.0 (#34278)

With this, the IL SDK will continue to work when it comes to either single or multitargeting without restoring the projects in multi-targeting mode. This helps to not introduce a breaking change for 3.x SDKs.

4 years agoRevert "Switch reverse PInvoke to the NativeCallable plan (#34251)" (#34306)
Santiago Fernandez Madero [Tue, 31 Mar 2020 02:45:31 +0000 (19:45 -0700)]
Revert "Switch reverse PInvoke to the NativeCallable plan (#34251)" (#34306)

This reverts commit 4e30ff033fbd915c5a39df8901d43c601deeeeb4.

4 years agoRestore TargetArchitecture default (#34295)
Jan Kotas [Tue, 31 Mar 2020 00:58:56 +0000 (17:58 -0700)]
Restore TargetArchitecture default (#34295)

Fixes #34292

4 years agoExplicitly throw the OutOfMemoryException instead of relying on Shared.Rent/Array...
Felipe Pessoto [Tue, 31 Mar 2020 00:52:01 +0000 (21:52 -0300)]
Explicitly throw the OutOfMemoryException instead of relying on Shared.Rent/Array constructor. Because it can behave differently in OSX, where it supports int.MaxValue array size. (#34040)

4 years agoFlow TargetArchitecture always in Unix build script (#34300)
Santiago Fernandez Madero [Tue, 31 Mar 2020 00:30:52 +0000 (17:30 -0700)]
Flow TargetArchitecture always in Unix build script (#34300)

4 years agoMake `compCurBB` available for `fgMorphBlockReturn`. (#34184)
Sergey Andreenko [Tue, 31 Mar 2020 00:06:32 +0000 (17:06 -0700)]
Make `compCurBB` available for `fgMorphBlockReturn`. (#34184)

* Extract `fgMergeBlockReturn`.

Morph is already a very vague verb in the Jit, try to use a more precise one.

* Add a function header.

* Make `compCurBB` available for `fgMorphBlockReturn`.

When we generate an assignment we could need to create a new assertion, that requires `compCurBB` to be available.

* Delete `INVALID_POINTER_VALUE`.

I would like to remove it because:
1) it was debug only;
2) there were no null checks for `compHndBBtab`, because it is a dependent variable
so there was no need to distinguish valid null pointer from a bad invalid pointer;
3) that is the only place where this mechanism was used.

* Allow to CSE the merge return ASG.

I can't see a reason why it should not, there are no diffs.
The issue with the previous version was that we did not actually know what we were marking: GT_ASG, GT_COMMA, something else? Was the idea to mark individual ASG under COMMA?

4 years agoFix wrong assert in cgroups code (#34291)
Jan Vorlicek [Mon, 30 Mar 2020 23:27:02 +0000 (01:27 +0200)]
Fix wrong assert in cgroups code (#34291)

There is an assert in FindCgroupPath that fires when hierarchy_root
and cgroup_path_relative_to_mount are equal, which is the case for
cgroups that are not named. This assert checks that the common
path in those two variables ends with / which is only the case
with named groups.

We have never seen this assert to fire because cgroups initialization
happens before the debugger support initialization in PAL and so
asserts are disabled at that point. I am going to fix that in a
separate PR.

This problem was discovered with the standalone GC where the assert
actually fires as it uses a plain C assert function.

This change fixes the assert to account for the case when both the
paths are the same.

4 years ago[mono][llvm] Improve LLVM 9 compatibility. (#34182)
imhameed [Mon, 30 Mar 2020 21:01:25 +0000 (14:01 -0700)]
[mono][llvm] Improve LLVM 9 compatibility. (#34182)

Improve LLVM 9 compatibility.

Several intrinsics were removed in LLVM 7 and above; replace them with
IR sequences that generate the desired instructions.

Fix some type mismatch problems with the generated IR (in
Sse2.StoreAlignedNonTemporal, Vector128.CreateScalarUnsafe, and
Sse2.MaskMove); these were caught by running the coreclr hardware
intrinsic JIT tests.

Support the two-argument forms of Sse.SqrtScalar, Sse.ReciprocalScalar,
and Sse.ReciprocalSqrtScalar.

llvm::linkCoreCLRGC(), in llvm/CodeGen/GCs.h, was removed and replaced with
llvm::linkAllBuiltinGCs(), in llvm/CodeGen/BuiltinGCs.h.

In mono_llvm_dump_value and mono_llvm_dump_module, flush the c library's
stdout stream before using (and flushing) LLVM's own buffered output
functions.

4 years ago[CBOR] Implement tag and special value support for CborWriter and CborReader (#34046)
Eirik Tsarpalis [Mon, 30 Mar 2020 20:49:09 +0000 (21:49 +0100)]
[CBOR] Implement tag and special value support for CborWriter and CborReader (#34046)

* Implement tag support for CborWriter and CborReader

* Implement CBOR special value support

* add nested special value tests

* implement half-precision float decoding; address feedback

* address style

* remove dead code

* add checks for CBOR tags in indefinite-length collections

* Update src/libraries/System.Security.Cryptography.Encoding/tests/Cbor/CborWriter.Integer.cs

Co-Authored-By: Jeremy Barton <jbarton@microsoft.com>
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
4 years agoAdd System.Type converter for JsonSerializer (#34249)
Layomi Akinrinade [Mon, 30 Mar 2020 20:37:49 +0000 (16:37 -0400)]
Add System.Type converter for JsonSerializer (#34249)

* Add System.Type converter for JsonSerializer

* Address review feedback

* Remove throw helper

4 years agoHoist volatile variable's access outside the loop (#34225)
Kunal Pathak [Mon, 30 Mar 2020 20:06:05 +0000 (13:06 -0700)]
Hoist volatile variable's access outside the loop (#34225)

* Hoist volatile variable's access outside the loop

`_tables` is a volatile object and it has `_countPerLock` volatile field.
On ARM64, JIT generates memory barrier instruction "dmb" for every volatile
variable access which could be expensive. This PR caches the volatile
variables outside the loop and use cached local variables instead.

Fixes: https://github.com/dotnet/runtime/issues/34198

4 years agoAllow coreclr_create_delegate to return pointers to NativeCallable methods (#34270)
Jan Kotas [Mon, 30 Mar 2020 20:03:34 +0000 (13:03 -0700)]
Allow coreclr_create_delegate to return pointers to NativeCallable methods (#34270)

* Allow coreclr_create_delegate to return pointers to NativeCallable methods

Fixes #34266

* Simplify CorHost implementation

* Updated error message

4 years agoFix ASPNET package paths (#34283)
Eric StJohn [Mon, 30 Mar 2020 19:57:39 +0000 (12:57 -0700)]
Fix ASPNET package paths (#34283)

4 years agoGenerate memory barrier with inner shareable domain for ARM64 (#34227)
Kunal Pathak [Mon, 30 Mar 2020 19:09:09 +0000 (12:09 -0700)]
Generate memory barrier with inner shareable domain for ARM64 (#34227)

Today, for volatile variable access, JIT generates "dmb oshld" which is
a memory barrier with outer shareable domain.

Coreclr uses [atomics and interlocked APIs](https://github.com/dotnet/runtime/blob/fcd862e06413a000f9cafa9d2f359226c60b9b42/src/coreclr/src/inc/volatile.h#L153)
for memory safety and msvc / clang both generate inner shareable domain
for them. Hence it is sensible for JIT that is compiled with
[msvs](https://godbolt.org/z/8XEWYr) ./ [clang](https://godbolt.org/z/DMZi26)
to generate inner shareable domain for volatile access.
[gcc](https://godbolt.org/z/zSf4fS) too emits inner shareable domain for API
that takes full system memory barrier.

4 years agoFix debug symbol generation (#34154)
Jan Vorlicek [Mon, 30 Mar 2020 18:32:48 +0000 (20:32 +0200)]
Fix debug symbol generation (#34154)

* Fix debug symbol generation

The debug symbol generation got recently broken. For most of the
shared libraries, the debug symbols were stripped twice due to
the fact that install_clr for them was invoked twice - once for
the default install location and once for the sharedFramework
location and the stripping was executed in both of them. First
stripping stripped the symbols off the target binary and set
so called debuglink in the binary to point to the symbol file.
This debuglink includes a crc32 of the dbg symbols file.
The second stripping tried to strip symbols from the already
stripped binary. That resulted in a small dbg symbols file
that didn't actually contain any useful symbols. Moreover,
it is not possible to set a debuglink in a binary if it is
already set there. So the second attempt failed and the crc
was left set to the crc of the previous debug. Thus when
debugger loads such a binary, it cannot find the debug symbols
file, as the crc doesn't match. And even if it matched, the
data would have no value.

The fix is to modify install_clr so that it has an extra
optional argument to specify the secondary install location and
use just one install_clr per target. The function then does the
stripping just once and the actual installation once or twice
depending on the secondary location argumenbt presence.

* Fix libraries and installer

* Fix installer placement of lib files

4 years agofix TLS13 procesing on windows (#34181)
Tomas Weinfurt [Mon, 30 Mar 2020 18:29:39 +0000 (11:29 -0700)]
fix TLS13 procesing on windows (#34181)

* fix TLS13 procesing on windows

* fix test

* rework disabled renegotiation

* update platform detection

Co-authored-by: Tomas Weinfurt <furt@GokceOncu.middleeast.corp.microsoft.com>
4 years agoFix EnumerableViewOfDispatch.GetEnumerator ref counting (#34230)
Elinor Fung [Mon, 30 Mar 2020 18:27:43 +0000 (11:27 -0700)]
Fix EnumerableViewOfDispatch.GetEnumerator ref counting (#34230)

4 years agoVectorise BitArray for ARM64 (#33749)
Ganbarukamo41 [Mon, 30 Mar 2020 17:45:39 +0000 (02:45 +0900)]
Vectorise BitArray for ARM64 (#33749)

* Vectorise BitArray for ARM64

* Make algorithms endianness agnostic

* Change loop counter to uint to prevent overflow

* Fix CopyTo(bool[])

* Move constant variables outside the loop

* More unsigned goodness

* Use span.Clear instead of Fill(0)

4 years agoAdd solution files for Extensions projects (#34234)
Maryam Ariyan [Mon, 30 Mar 2020 17:29:54 +0000 (10:29 -0700)]
Add solution files for Extensions projects (#34234)

4 years agoJIT: initial workup for suppressing dumps and checks post-phase (#33305)
Andy Ayers [Mon, 30 Mar 2020 17:24:33 +0000 (10:24 -0700)]
JIT: initial workup for suppressing dumps and checks post-phase (#33305)

Allow phases to declare what parts of jit state they might have modified,
and suppress dumps and checks based on these declarations.

Existing phases that don't know about this are handled by defaulting to
reporting that everything might have been modified.

Changed over all explicit phases to return status, as well as a handful
of phases that are methods on the Compiler object. Also converted a few
lambda phases into Compiler phase methods.

4 years agoUnifying duplicate msbuild properties in CoreCLR build (#34261)
Jan Kotas [Mon, 30 Mar 2020 17:06:24 +0000 (10:06 -0700)]
Unifying duplicate msbuild properties in CoreCLR build (#34261)

- __TargetOS -> TargetOS
- __BuildType, BuildType -> Configuration
- __BuildArch, BuildArch -> TargetArchitecture

4 years agoFix for changed host behaviour on app crash (#34224)
Elinor Fung [Mon, 30 Mar 2020 16:47:26 +0000 (09:47 -0700)]
Fix for changed host behaviour on app crash (#34224)

* Switch back to only handling synchronous exceptions in host components

Add native hosting tests for components with unhandled exceptions.

* Switch setting /EHa to be for coreclr instead of shared default

4 years agoBump maximum ICU library version in Unix System.Globalization.Native (#34095)
Jan Vorlicek [Mon, 30 Mar 2020 12:44:47 +0000 (14:44 +0200)]
Bump maximum ICU library version in Unix System.Globalization.Native (#34095)

* Bump maximum ICU library version we scan in System.Globalization.Native on Unix

The maximum major version of ICU library that we start scanning at was set to 70
(50 as the minimum supported version + 20) long time ago. The available version
of ICU is approaching that limit (it is at 67 now).
This change bumps the max scanned version to 80 to give us enough head space
for a couple of years (guessing based on the current release rate)

* Reflect PR feedback

4 years ago[wasm] Throw an exception in some blocking operations in non-threaded mode. (#34265)
monojenkins [Mon, 30 Mar 2020 12:36:08 +0000 (08:36 -0400)]
[wasm] Throw an exception in some blocking operations in non-threaded mode. (#34265)

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years ago[interp] Optimize Span<byte>.Fill (#34219)
Vlad Brezae [Mon, 30 Mar 2020 08:55:58 +0000 (11:55 +0300)]
[interp] Optimize Span<byte>.Fill (#34219)

* [interp] Intrinsify Type.IsValueType

* [interp] Intrinsify InitBlockUnaligned

4 years ago[llvmonly] Avoid marking the rgctx/vtable variable indirect, its not needed. (#33955)
monojenkins [Mon, 30 Mar 2020 08:53:48 +0000 (04:53 -0400)]
[llvmonly] Avoid marking the rgctx/vtable variable indirect, its not needed. (#33955)

In normal llvm mode, these variables are marked as indirect and stored to a stack slot so the EH code can access them.

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years ago[runtime] Allocate the memory for gshared gparams from image sets. (#34262)
monojenkins [Mon, 30 Mar 2020 08:43:24 +0000 (04:43 -0400)]
[runtime] Allocate the memory for gshared gparams from image sets. (#34262)

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

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->

Co-authored-by: vargaz <vargaz@users.noreply.github.com>
4 years agoCleanup build scripts (#34268)
Jan Kotas [Mon, 30 Mar 2020 05:27:39 +0000 (22:27 -0700)]
Cleanup build scripts (#34268)

- Delete unnecessary msbuild properties (left-overs from the conversion to SDK projects)
- Delete jit.settings.targets

4 years agoSwitch reverse PInvoke to the NativeCallable plan (#34251)
Jan Kotas [Mon, 30 Mar 2020 04:33:06 +0000 (21:33 -0700)]
Switch reverse PInvoke to the NativeCallable plan (#34251)

Fixes #33581

4 years agoFix nullable annotation on GetIPv4Properties (#34257)
Stephen Toub [Mon, 30 Mar 2020 00:28:48 +0000 (20:28 -0400)]
Fix nullable annotation on GetIPv4Properties (#34257)

4 years agoRename ArchGroup -> TargetArchitecture (#34260)
Jan Kotas [Mon, 30 Mar 2020 00:20:20 +0000 (17:20 -0700)]
Rename ArchGroup -> TargetArchitecture (#34260)

Most places use TargetArchitecture already. These two properties seems to be always set to the same value.

4 years agoDelete *.nativeproj projects (#34259)
Jan Kotas [Sun, 29 Mar 2020 21:19:03 +0000 (14:19 -0700)]
Delete *.nativeproj projects (#34259)

Left-over from Razzle build

4 years agoAdded some stress coverage for Pinned Object Heap (#34217)
Vladimir Sadov [Sun, 29 Mar 2020 08:17:35 +0000 (01:17 -0700)]
Added some stress coverage for Pinned Object Heap (#34217)

4 years agoRemove a couple unnecessary ToStrings in System.DirectoryServices (#34244)
Stephen Toub [Sat, 28 Mar 2020 21:44:31 +0000 (17:44 -0400)]
Remove a couple unnecessary ToStrings in System.DirectoryServices (#34244)

These are calling ToString on a StringBuilder, but StringBuilder.Append has a StringBuilder-based overload in netcoreapp.  On other builds this will just fall back to the object-based overload, which will call ToString.

4 years agoAdd Nightly Build feed to README.md (#34241)
FreddyD-GH [Sat, 28 Mar 2020 20:57:06 +0000 (16:57 -0400)]
Add Nightly Build feed to README.md (#34241)

* Update README.md

* Update homepage and add section to dogfooding

* Link homepage to existing dogfooding.md page

* Add section for Obtaining nightly builds of NuGet packages

* Incorporate dotnet CLI commands

4 years agoUpdate SignedXml.cs (#34238)
Scott Xu [Sat, 28 Mar 2020 18:07:59 +0000 (02:07 +0800)]
Update SignedXml.cs (#34238)

4 years agoDelete tiered-compilation-guide.md (#34242)
Jan Kotas [Sat, 28 Mar 2020 18:07:36 +0000 (11:07 -0700)]
Delete tiered-compilation-guide.md (#34242)

This contains outdated information about tiered compilation preview

4 years agoUse separate key instances for span/array/array+offset test classes (#34199)
Jeremy Barton [Sat, 28 Mar 2020 16:58:34 +0000 (09:58 -0700)]
Use separate key instances for span/array/array+offset test classes (#34199)

Because the key object generation was done in the algorithm-specific base class,
the triplet of interface types was using the key instances in parallel.

By moving the static variable (and initialization thereof) to each of the derived
classes, the key objects are unique per class, which matches the test parallelism.

Making the classes be part of the same test collection would also solve this problem,
which would save on a few random keygens, but would likely overall take more
time due to the number of tests that would be moved to sequential execution.

4 years agoUpdate dependencies from https://github.com/mono/linker build 20200327.4 (#34237)
dotnet-maestro[bot] [Sat, 28 Mar 2020 14:32:35 +0000 (14:32 +0000)]
Update dependencies from https://github.com/mono/linker build 20200327.4 (#34237)

- ILLink.Tasks - 5.0.0-preview.3.20177.4

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
4 years ago.NET Core to .NET branding changes (#33694)
Jan Kotas [Sat, 28 Mar 2020 14:00:19 +0000 (07:00 -0700)]
.NET Core to .NET branding changes (#33694)

Contributes to #33680

4 years agoImprove platform detection for Android and SunOS (#34236)
Adeel Mujahid [Sat, 28 Mar 2020 13:51:54 +0000 (15:51 +0200)]
Improve platform detection for Android and SunOS (#34236)