platform/upstream/dotnet/runtime.git
4 years agoFix Vector128 and Vector256 WithUpper documentation (dotnet/coreclr#27274)
John [Wed, 13 Nov 2019 19:20:23 +0000 (19:20 +0000)]
Fix Vector128 and Vector256 WithUpper documentation (dotnet/coreclr#27274)

* Update Vector128.cs

* Update Vector256.cs

* Update Vector128.cs

* Update Vector128.cs

* Update Vector256.cs

* Update Vector128.cs

* Update Vector256.cs

Commit migrated from https://github.com/dotnet/coreclr/commit/081243009eacfd7a4bda37dd6d4668cc977c9c18

4 years agoRun the format job in a temp dir (dotnet/coreclr#27852)
Jarret Shook [Wed, 13 Nov 2019 17:42:15 +0000 (09:42 -0800)]
Run the format job in a temp dir (dotnet/coreclr#27852)

This will allow us to use whatever version of dotnet we want.

Commit migrated from https://github.com/dotnet/coreclr/commit/4fe26a4653b5dcc1259b26a7439f96f452cb0d9e

4 years agoMake SuperILC to execute .cmd/.sh only (dotnet/coreclr#27854)
Jan Vorlicek [Wed, 13 Nov 2019 17:04:37 +0000 (18:04 +0100)]
Make SuperILC to execute .cmd/.sh only (dotnet/coreclr#27854)

Until now, SuperILC was executing both .cmd/.sh files of tests and .exe
files it has found in the test folders that didn't match the .cmd/.sh
file names. This is different from how coreclr tests are run in regular
test runs. Only the .cmd/.sh files should be executed, the .exe files
with names not matching the .cmd/.sh files are always just helper
applications used by the tests and not the main test executables.
This change updates SuperILC to execute only the .cmd / .sh, thus
getting rid of about 5 failures from the coreclr pri 1 test runs.

Commit migrated from https://github.com/dotnet/coreclr/commit/76751786c52895a96dac39e83570d14bb2b42b49

4 years agoFix assert when extending lifetimes (dotnet/coreclr#27839)
Carol Eidt [Wed, 13 Nov 2019 16:00:28 +0000 (08:00 -0800)]
Fix assert when extending lifetimes (dotnet/coreclr#27839)

This assert was added in the prework for EH write-thru. In the case where we're extending lifetimes for stress, we should ignore the locations of these. Note that they aren't reported to codegen anyway.

Fix dotnet/coreclr#27804

Commit migrated from https://github.com/dotnet/coreclr/commit/1fd33a734290138da009fbd0682f1f4399172b8f

4 years agoRevert "Upload the final modified version of the tests that is sent to helix (dotnet...
Jarret Shook [Wed, 13 Nov 2019 11:51:51 +0000 (03:51 -0800)]
Revert "Upload the final modified version of the tests that is sent to helix (dotnet/coreclr#27826)" (dotnet/coreclr#27851)

This reverts commit dotnet/coreclr@f46c7a6240bea3f7aac1f5c858204cd5e4940fbd.

Commit migrated from https://github.com/dotnet/coreclr/commit/3324cea03f7710a9dc57c6dd7823d1a394ce35bb

4 years ago[interpreter] Fix error: use of undeclared identifier 'g_pExecuteBackoutCodeHelperMet...
Leslie Zhai [Wed, 13 Nov 2019 11:07:00 +0000 (19:07 +0800)]
[interpreter] Fix error: use of undeclared identifier 'g_pExecuteBackoutCodeHelperMethod' (dotnet/coreclr#27850)

https://github.com/dotnet/coreclr/issues/27848

Commit migrated from https://github.com/dotnet/coreclr/commit/25343654668bfa83a280a4b2eec0e6d71c3aa55e

4 years agoAdd tracing for handling of dependencies for Assembly.LoadFrom (dotnet/coreclr#27833)
Elinor Fung [Wed, 13 Nov 2019 09:11:41 +0000 (01:11 -0800)]
Add tracing for handling of dependencies for Assembly.LoadFrom (dotnet/coreclr#27833)

Commit migrated from https://github.com/dotnet/coreclr/commit/80557919596be103e60ce1c90ed4860e0708ff56

4 years agoInstall binaries that are part of shared framework into separa… (dotnet/coreclr#27841)
Jeremy Koritzinsky [Wed, 13 Nov 2019 00:18:18 +0000 (16:18 -0800)]
Install binaries that are part of shared framework into separa… (dotnet/coreclr#27841)

* Change the install_clr command to use cmake_parse_arguments to make it easier to extend and easier to read.

Add additional install_clr commands to install the files that go into the shared framework into the sharedFramework folder.

* Install SOS README.

* Collapse conditions. Output message explaining that we're reading the native version out of the native version header so in the case that the header doesn't exist we get something actionable.

Commit migrated from https://github.com/dotnet/coreclr/commit/03b7b318ab6641c20baeb37f963c4599a97d9276

4 years agoFix an AV in crossgen caused by invalid profiling data (dotnet/coreclr#27842)
Fadi Hanna [Tue, 12 Nov 2019 23:32:30 +0000 (15:32 -0800)]
Fix an AV in crossgen caused by invalid profiling data (dotnet/coreclr#27842)

Commit migrated from https://github.com/dotnet/coreclr/commit/e40384b6dfcbd8db3a817528f5619de31dab4e0b

4 years agoChanges to DBG_printf (dotnet/coreclr#20383)
Jonathan Marler [Tue, 12 Nov 2019 21:05:00 +0000 (14:05 -0700)]
Changes to DBG_printf (dotnet/coreclr#20383)

1. will now restore the original errno in all cases
2. combine the snprintf calls in the if(bHeader) block, the only difference was the file/function string
3. we now check the return value of snprintf and _vsnprintf_s instead of ignoring them.  When sprintf fails for the header, we just drop the header, when _vsnprintf_s fails for the message itself, we print an error.
4. replaced an alloca with a statically sized buffer

Commit migrated from https://github.com/dotnet/coreclr/commit/cec441660fb12bd48dab3e4f234d5a6315121aa0

4 years agoFix out of range access in GetRecycleMemoryInfo (dotnet/coreclr#26873) (dotnet/corecl...
303248153 [Tue, 12 Nov 2019 20:57:10 +0000 (05:57 +0900)]
Fix out of range access in GetRecycleMemoryInfo (dotnet/coreclr#26873) (dotnet/coreclr#26912)

Commit migrated from https://github.com/dotnet/coreclr/commit/2c2bbb50280edcc03fbf946d89ebc01dfff62d76

4 years agoDelete unused Enum.InternalCompareTo (dotnet/coreclr#27837)
Jan Kotas [Tue, 12 Nov 2019 20:24:07 +0000 (21:24 +0100)]
Delete unused Enum.InternalCompareTo (dotnet/coreclr#27837)

Commit migrated from https://github.com/dotnet/coreclr/commit/012c53ba4644ace6997dec0d608b5fd00a77983c

4 years agoPre-consolidation mop up fixes dotnet/coreclr#3 (dotnet/coreclr#27836)
Tomáš Rylek [Tue, 12 Nov 2019 19:00:59 +0000 (11:00 -0800)]
Pre-consolidation mop up fixes dotnet/coreclr#3 (dotnet/coreclr#27836)

This change contains the remaining fixes I made while digging
through the PR run in the runtime repo:

1) Some more repo-relative vs. coreclr-relative repo adjustments
reflecting the migration process;

2) Make sure that XunitTestBinBase always ends with a directory
separator, otherwise my recent fix for Common folder exclusion
doesn't work;

3) Opportunistically shorten project names of two native interop
test components - as the project name is repeated about 3-4 times
in some intermediate paths, it quickly exceeds the standard
Windows path length limit. Please note there's no functional
change in the test.

Thanks

Tomas

Commit migrated from https://github.com/dotnet/coreclr/commit/35e54e804f48ccb8ec4b852fa67a9f88850d214b

4 years agoSome GT_BLK/GT_OBJ related cleanup (dotnet/coreclr#27053)
mikedn [Tue, 12 Nov 2019 18:33:18 +0000 (20:33 +0200)]
Some GT_BLK/GT_OBJ related cleanup (dotnet/coreclr#27053)

* Display class layout name in dumps

* Delete unused gtNewBlkOpNode size parameter

* gtNewObjNode always returns a GenTreeObj

* Can't have GTF_VAR_DEATH on a GT_OBJ node

* Delete unnecessary uses of gtNewCpObjNode

* Delete unnecessary uses of gtNewBlockVal

* Delete fgMorphBlkToInd

Modifying nodes in place is the norm in JIT, there's no need for a function to abstract that.

* Delete unused RewriteSIMDOperand keepBlk parameter

* Cleanup Rationalizer::RewriteSIMDOperand

Commit migrated from https://github.com/dotnet/coreclr/commit/8f9eb95bb1df95911c121fdafd65c3fe8d490a75

4 years agoFixing an assert in card stealing. (dotnet/coreclr#27822)
Vladimir Sadov [Tue, 12 Nov 2019 15:02:02 +0000 (07:02 -0800)]
Fixing an assert in card stealing. (dotnet/coreclr#27822)

* Fixing an assert in card stealing.

* use ifdef to be consistent with other cases in the file

* PR feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/7aa67a90a682cf885ebab8e450eb845356cd2f1d

4 years agoFix build breaks (dotnet/coreclr#27832)
Dotnet-GitSync-Bot [Tue, 12 Nov 2019 08:09:19 +0000 (00:09 -0800)]
Fix build breaks (dotnet/coreclr#27832)

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/d5bb8bf2437d447750cf0203dd55bb5160ff36b8

4 years agoUpload the final modified version of the tests that is sent to helix (dotnet/coreclr...
Jarret Shook [Tue, 12 Nov 2019 06:25:39 +0000 (22:25 -0800)]
Upload the final modified version of the tests that is sent to helix (dotnet/coreclr#27826)

* Upload the final modified version of the tests that is sent to helix

* Add final test name

Commit migrated from https://github.com/dotnet/coreclr/commit/f46c7a6240bea3f7aac1f5c858204cd5e4940fbd

4 years agoAdd tracing for Resolving/AssemblyResolve event handler invocation (dotnet/coreclr...
Elinor Fung [Tue, 12 Nov 2019 03:55:30 +0000 (19:55 -0800)]
Add tracing for Resolving/AssemblyResolve event handler invocation (dotnet/coreclr#27788)

Commit migrated from https://github.com/dotnet/coreclr/commit/ba0ab50cccb1e04f4e209cb426fcf05952c4fad0

4 years agoFix StyleCop rule SA1129 ("Do not use default value type constructor") (dotnet/corecl...
Stephen Toub [Mon, 11 Nov 2019 23:49:48 +0000 (18:49 -0500)]
Fix StyleCop rule SA1129 ("Do not use default value type constructor") (dotnet/coreclr#42531)

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/24aa9ed911fdab705f1337f233afa5985998f761

4 years agoFix runincontext path in helixpublish (dotnet/coreclr#27824)
Jarret Shook [Tue, 12 Nov 2019 02:49:33 +0000 (18:49 -0800)]
Fix runincontext path in helixpublish (dotnet/coreclr#27824)

Commit migrated from https://github.com/dotnet/coreclr/commit/45b667d68b39f80adddfd3980d99cbdeb17d8cd0

4 years agoNon virtual calls to instance methods non-virtual dispatch on instance interface...
David Wrighton [Tue, 12 Nov 2019 00:30:58 +0000 (16:30 -0800)]
Non virtual calls to instance methods non-virtual dispatch on instance interface methods (dotnet/coreclr#27756)

* est for non_virtual_calls_to_instance_methods
* Fix handling of callvirt to instance methods on interface types that are not virtual
- Use call type to indicate if its non-virtual or not, instead of opcode
* Use ilproj to protect against future C# compiler changes
- This test needs to test the use of specific opcodes, and so an IL proj is required

Commit migrated from https://github.com/dotnet/coreclr/commit/638f59b8bd99af456d21c6a4b64da88025d2ff7d

4 years agoruntest changes and cleanup (dotnet/coreclr#27815)
Jarret Shook [Tue, 12 Nov 2019 00:18:12 +0000 (16:18 -0800)]
runtest changes and cleanup (dotnet/coreclr#27815)

Commit migrated from https://github.com/dotnet/coreclr/commit/c42b8ce0c62e971cea5790abf256bc34ed2242c9

4 years agoAddress bugs in BigInteger (dotnet/coreclr#27280)
ts2do [Mon, 11 Nov 2019 23:35:28 +0000 (17:35 -0600)]
Address bugs in BigInteger (dotnet/coreclr#27280)

* Method Add(ref BigInteger lhs, uint value, ref BigInteger result) would store most of the result blocks into lhs instead of result.
* Method ShiftLeft(ulong input, uint shift, ref BigInteger output) with a shift argument exceeding 32 would generally compute the higher blocks incorrectly.
* Multiply(ref BigInteger lhs, uint value, ref BigInteger result) would not set result._length in some cases.
* IsZero() would incorrectly return false for non-canonical zeros with _length > 0.

Fix:
* Inline Add(ref BigInteger, uint, ref BigInteger) into Add(uint).
* Inline ShiftLeft(ulong, uint, ref BigInteger) into Pow2.
* Inline ExtendBlock and ExtendBlocks into Pow2.
* Properly handle 0 in SetUInt32 and SetUInt64.

Commit migrated from https://github.com/dotnet/coreclr/commit/65a7947491685a6a3479525334e4178f8eab4b75

4 years agoImplement alive across call for CSE candidates (dotnet/coreclr#27449)
Brian Sullivan [Mon, 11 Nov 2019 22:59:36 +0000 (14:59 -0800)]
Implement alive across call for CSE candidates (dotnet/coreclr#27449)

* Added the implementation of CSE live across call algorithm

Fix CSE dataflow for Zero Diffs
Perform backward walk of statements in optValnumCSE_InitDataFlow()

Code Review feedback
- Rename cseTraits to cseLivenessTraits
- Move initialization of cseMaskTraits to optCSE_canSwap
- Rework GT_CALL backwards walk for bbCseGen
- Correct comments

Rename cseBit to cseAvailBit and cseBit2 to cseAvailCrossCallBit
Update CSE_DataFlow to handle calls that kill CSE for live across calls

* Code review feedback, added lots of comments
Fixes printing of EXP_SET BitVecs with more than 64 bits

Commit migrated from https://github.com/dotnet/coreclr/commit/470910864eca8172e6f8a3c58beb85176b9a4008

4 years agoUse Stream's BeginReadInternal from FileStream (dotnet/coreclr#27737)
Stephen Toub [Mon, 11 Nov 2019 19:10:20 +0000 (14:10 -0500)]
Use Stream's BeginReadInternal from FileStream (dotnet/coreclr#27737)

FileStream has two modes, decided upon at construction time.  When it's created in non-async mode, the Read/WriteAsync methods end up queueing work items to invoke the synchronous Read/Write methods.  To do this, the base methods on Stream delegate to Begin/EndRead/Write (since they were around first) and then the resulting IAsyncResult is wrapped.  However, Stream has an optimization that checks to see whether the derived stream actually overrides Begin/EndXx, and if it doesn't, then it skips using those and goes straight to queueing a work item to Read/Write.  However, FileStream does override those, but when it delegates to the base implementation because it's in non-async mode (rather than because it's a type derived from FileStream), going through Begin/EndXx is just unnecessary overhead.  So, in the right circumstances, we can call to Stream's special helper instead.

Commit migrated from https://github.com/dotnet/coreclr/commit/e2741eb3358768e823d17f853bf17b08fda6bf58

4 years agoRaw EventListener Design Document (dotnet/coreclr#19941)
Brian Robbins [Mon, 11 Nov 2019 18:36:00 +0000 (10:36 -0800)]
Raw EventListener Design Document (dotnet/coreclr#19941)

Commit migrated from https://github.com/dotnet/coreclr/commit/ab6b7097abe676f62d47efddd43ff3eb012e7882

4 years agoFixing an assert around Avx.ExtractVector128 and Avx2.ExtractVector128 (dotnet/corecl...
Tanner Gooding [Mon, 11 Nov 2019 16:20:37 +0000 (08:20 -0800)]
Fixing an assert around Avx.ExtractVector128 and Avx2.ExtractVector128 (dotnet/coreclr#27807)

Commit migrated from https://github.com/dotnet/coreclr/commit/df5c582c89ca17136d99c94643d29d6a7a1fd2fc

4 years agoDeduplicate some build configuration code (dotnet/coreclr#27636)
Adeel Mujahid [Mon, 11 Nov 2019 14:36:16 +0000 (16:36 +0200)]
Deduplicate some build configuration code (dotnet/coreclr#27636)

* Deduplicate some build configuration code
While working on another PR, noticed that currently it requires
updating two places to add a new platform/compiler/architecture
configuration. This PR tries to consolidate the code.

Changes:

* replace `read_array` custom function with a simple `grep -v` call.
* remove `$__PortableLinux` from build-test.sh, as it is unused.
* move argument parsing and few common functions in `build.sh` and
  `build-test.sh` in `_build-commons.sh` and sourced it.
  * combine the long case-esac block and sort cases alphabetically.
    * add missing `hyphen-less|hyphened)` variants.
  * sort `CPUName` and `OSName` list.
  * changed `__CommonMSBuildArgs` from array to string in
    `build-test.sh`, as it is in `build.sh`.
* sort local argument names in build/build-test alphabetically at
  declaration site.
* merge `locate_llvm_exec` and `locate_gcc_exec` into a single
  `locate_toolchain_exec` cmake function.
  * this enables overriding individual llvm tool via `CLR_<TOOLNAME>`
    environment variable, as it was supported by `locate_gcc_exec`
    today.

* Merge dotnet/master to fix/deduplicate-configs

* Merge conflict

* Move __CrossBuild check back to build.sh

Commit migrated from https://github.com/dotnet/coreclr/commit/a15413fd520f7f25273b92d1087b5f7964801dba

4 years agoFix StyleCop rule SA1129 ("Do not use default value type constructor") (dotnet/corecl...
Stephen Toub [Mon, 11 Nov 2019 14:08:53 +0000 (09:08 -0500)]
Fix StyleCop rule SA1129 ("Do not use default value type constructor") (dotnet/coreclr#27716)

Will enable the rule in corefx once these changes have propagated.

Commit migrated from https://github.com/dotnet/coreclr/commit/5fd4e7055571f3200b64cf6272c81ede96b6fc8b

4 years agoExplicitly enable relro (dotnet/coreclr#25473)
Konstantin Baladurin [Mon, 11 Nov 2019 12:47:05 +0000 (15:47 +0300)]
Explicitly enable relro (dotnet/coreclr#25473)

* Explicitly enable relro

We need to enable relro explicitly because in some cases it isn't enabled by
default. For example, clang does it only for openSUSE, ubuntu, alpine and android.

Commit migrated from https://github.com/dotnet/coreclr/commit/dbe8ee6b5150af9180c1873b962695f0e7802b57

4 years agoImplement SetThreadName in PAL for Linux. (dotnet/coreclr#27182)
Pieter-Jan Briers [Mon, 11 Nov 2019 12:30:18 +0000 (13:30 +0100)]
Implement SetThreadName in PAL for Linux. (dotnet/coreclr#27182)

* Implement SetThreadName in PAL for Linux.

This means thread names will now show up in gdb, htop, etc... on Linux.

I did not implement this for any other platforms:
I did not have anything to test them with,
and pthread_setname_np's API varies wildly.

Commit migrated from https://github.com/dotnet/coreclr/commit/5f5f9606a6eef78256536f667c2df7b2495a8c3d

4 years agoSuppress ms_struct warnings for non-Intel arches (dotnet/coreclr#27801)
Sinan Kaya [Mon, 11 Nov 2019 08:20:03 +0000 (03:20 -0500)]
Suppress ms_struct warnings for non-Intel arches (dotnet/coreclr#27801)

* Suppress ms_struct warnings

* Enable for x86 only

Commit migrated from https://github.com/dotnet/coreclr/commit/a5e90c90d5255a795285ba05163bf0d7878a985e

4 years agoRemove unused argument from GetRegionDisplayName (dotnet/coreclr#27806)
Stephen Toub [Mon, 11 Nov 2019 08:17:26 +0000 (03:17 -0500)]
Remove unused argument from GetRegionDisplayName (dotnet/coreclr#27806)

* Remove unused argument from GetRegionDisplayName

* Address race conditions in CultureData

While most of the race conditions in this file are benign, in these cases, a thread could end up returning an intermediate value due to multiple potential writes to the same field.

Commit migrated from https://github.com/dotnet/coreclr/commit/b7d8fed40324e45e41ef6a09c98c3dda9490e4fb

4 years agoUpdate SOS_README.md (dotnet/coreclr#27799)
Nelson Chen [Sun, 10 Nov 2019 17:25:19 +0000 (10:25 -0700)]
Update SOS_README.md (dotnet/coreclr#27799)

Correct to "out of band"

Commit migrated from https://github.com/dotnet/coreclr/commit/1b261216c6be2fd9ae0d7a8250604349f404e760

4 years agoCreate a simple minimal MSBuild front-end (dotnet/coreclr#27778)
Jeremy Koritzinsky [Sun, 10 Nov 2019 02:50:56 +0000 (18:50 -0800)]
Create a simple minimal MSBuild front-end (dotnet/coreclr#27778)

* Implement simple coreclr.proj msbuild entrypoint for building the coreclr product in the common configuration.

* Add dummy targets and automatically emit the enforcePGO argument when applicable.

* Add officialbuildId and stripSymbols arguments.

* Always pass the -stripsymbols argument.

Commit migrated from https://github.com/dotnet/coreclr/commit/f1c282bdabc38048c3f9aacb4199cf821f7f541b

4 years agoRewrite Enum.CompareTo in C# (dotnet/coreclr#27792)
Jan Kotas [Sun, 10 Nov 2019 00:18:00 +0000 (01:18 +0100)]
Rewrite Enum.CompareTo in C# (dotnet/coreclr#27792)

* Rewrite Enum.CompareTo in C#

* Handle floating point too for match the existing native implementation

Commit migrated from https://github.com/dotnet/coreclr/commit/b6488e511db32bb36614becb1a938d4a162f951d

4 years agoRelax visibility
Jan Kotas [Sat, 9 Nov 2019 14:48:46 +0000 (06:48 -0800)]
Relax visibility

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/e9ac7dc62becb08463a3d5a71f02eb247b1727c7

4 years agoRewrite the rest of the array non-generic fast paths in C# (dotnet/coreclr#27703)
Jan Kotas [Sat, 9 Nov 2019 21:24:03 +0000 (22:24 +0100)]
Rewrite the rest of the array non-generic fast paths in C# (dotnet/coreclr#27703)

* Rewrite the rest of the array non-generic fast paths in C#

* Add missing resource string

* Use CorElementType and handle native ints to match the unmanaged implementation

* Avoid try pattern for Sort and Reverse

* Match the native implementation more closely

Commit migrated from https://github.com/dotnet/coreclr/commit/89f5caabf0939f89a5081373ae21b0669616db6b

4 years agoChange BulkMoveWithWriteBarrier to be GC suspension friendly (dotnet/coreclr#27776)
Jan Kotas [Sat, 9 Nov 2019 20:49:45 +0000 (21:49 +0100)]
Change BulkMoveWithWriteBarrier to be GC suspension friendly (dotnet/coreclr#27776)

* Revert "Revert "Change BulkMoveWithWriteBarrier to be GC suspension friendly (dotnet/coreclr#27642)" (dotnet/coreclr#27758)"

This reverts commit dotnet/coreclr@b06f8a7354861feb3e0134421bdb57d06b46ce78.

* Fix wrong argument order for Unsafe.ByteOffset

* Add comment

Commit migrated from https://github.com/dotnet/coreclr/commit/fc1e6ce79279b0bd6e55fe5d0004a5efad0f0303

4 years agoRevert "Fix unquoted path parameters in Microsoft.NET.Sdk.IL.targets (dotnet/coreclr...
Stephen Toub [Sat, 9 Nov 2019 15:38:59 +0000 (10:38 -0500)]
Revert "Fix unquoted path parameters in Microsoft.NET.Sdk.IL.targets (dotnet/coreclr#27704)" (dotnet/coreclr#27793)

This reverts commit dotnet/coreclr@d15312228b941a03a752ba61e8d1b555bc4b15f2.

Commit migrated from https://github.com/dotnet/coreclr/commit/ac0f6f30ae088cff0ad6954a1fc17411856dead9

4 years agoMove AssemblyLoadContext.GetResolvedUnmanagedDll to shared (dotnet/coreclr#27775)
Ryan Lucia [Sat, 9 Nov 2019 13:04:17 +0000 (08:04 -0500)]
Move AssemblyLoadContext.GetResolvedUnmanagedDll to shared (dotnet/coreclr#27775)

Commit migrated from https://github.com/dotnet/coreclr/commit/a87fc81b54da6c8738c6b1ca1247f637c85f9dd5

4 years agoFixed typos in comments. (dotnet/coreclr#27789)
rob313663 [Sat, 9 Nov 2019 13:01:54 +0000 (14:01 +0100)]
Fixed typos in comments. (dotnet/coreclr#27789)

Commit migrated from https://github.com/dotnet/coreclr/commit/38e28317952f7557881ebc20af69d06858354705

4 years agoPre-consolidation mop-up fixes part 2 (mostly path shuffles) (dotnet/coreclr#27777)
Tomáš Rylek [Sat, 9 Nov 2019 07:30:49 +0000 (23:30 -0800)]
Pre-consolidation mop-up fixes part 2 (mostly path shuffles) (dotnet/coreclr#27777)

(*) Clean up CoreCLR / root repo considerations in gen-buildsys.sh
(*) Move tryrun.cmake to the root; adjust gen-buildsys.sh accordingly

Commit migrated from https://github.com/dotnet/coreclr/commit/889a1a1abd7dfa4c95c7c5b7455b48c464f03139

4 years agoFix computation of n-th item in an array in PC_REL_OFFSET(_field) macro in src/vm...
Egor Chesakov [Sat, 9 Nov 2019 06:09:47 +0000 (22:09 -0800)]
Fix computation of n-th item in an array in PC_REL_OFFSET(_field) macro in src/vm/arm64/virtualcallstubcpu.hpp (dotnet/coreclr#27783)

Commit migrated from https://github.com/dotnet/coreclr/commit/5b02f3fb91c62e71377c4c31d8dd147d49220e8d

4 years agoStackTrace.GetFrames should return an array of non-nullable frames (dotnet/coreclr...
Joseph Musser [Sat, 9 Nov 2019 04:41:33 +0000 (23:41 -0500)]
StackTrace.GetFrames should return an array of non-nullable frames (dotnet/coreclr#27787)

Commit migrated from https://github.com/dotnet/coreclr/commit/37ab3a1a02da60f1c683af4c9f04ca713cdff869

4 years agoRevert "Feature: dynamic expansion for generic dictionaries (dotnet/coreclr#26262)"
Stephen Toub [Sat, 9 Nov 2019 02:32:56 +0000 (21:32 -0500)]
Revert "Feature: dynamic expansion for generic dictionaries (dotnet/coreclr#26262)"

This reverts commit dotnet/coreclr@d840c759948d910da85cf8688a45c84d09f0ad5e.

Commit migrated from https://github.com/dotnet/coreclr/commit/ab8467a1e02d3e033928fb820db0f5c91030bfa6

4 years agoAvoid promoting over-sized intrinsic (dotnet/coreclr#27774)
Andrew Au [Sat, 9 Nov 2019 03:33:07 +0000 (19:33 -0800)]
Avoid promoting over-sized intrinsic (dotnet/coreclr#27774)

Commit migrated from https://github.com/dotnet/coreclr/commit/8e709deda3e1a248c19cef8a6f7786153e6ab6f7

4 years agoImprove Encoding.UTF8.GetString / GetChars performance for small inputs (dotnet/corec...
Levi Broderick [Sat, 9 Nov 2019 01:28:33 +0000 (17:28 -0800)]
Improve Encoding.UTF8.GetString / GetChars performance for small inputs (dotnet/coreclr#27268)

Commit migrated from https://github.com/dotnet/coreclr/commit/7e785950569382aa188677e8fa13c5120ae244b3

4 years agoFix mismatched type IND(LCL_VAR_ADDR) folding in RewriteSIMDOperand (dotnet/coreclr...
mikedn [Fri, 8 Nov 2019 23:21:49 +0000 (01:21 +0200)]
Fix mismatched type IND(LCL_VAR_ADDR) folding in RewriteSIMDOperand (dotnet/coreclr#27748)

* Fix mismatched type IND(LCL_VAR_ADDR) folding in RewriteSIMDOperand

If the indirection and the variable have different SIMD types then a LCL_FLD node of the appropiate type is needed instead of a LCL_VAR node.

* Delete unused loadForm function

Commit migrated from https://github.com/dotnet/coreclr/commit/a0bbdf98efd5b96c041d8b49d2a61d0ce5bf3212

4 years agoFix struct assignment where types differ (dotnet/coreclr#27577)
Carol Eidt [Fri, 8 Nov 2019 22:00:42 +0000 (14:00 -0800)]
Fix struct assignment where types differ (dotnet/coreclr#27577)

Fix struct assignment where types differ

Ensure that we don't allow assignment between different struct types, and also ensure that we always use the normalized type if it exists.

Fix dotnet/coreclr#27551

Commit migrated from https://github.com/dotnet/coreclr/commit/9455aa5425958a45a50256c851b737fbec36017d

4 years agoUse cross-module R2R generics from main module with version bubble (dotnet/coreclr...
Fadi Hanna [Fri, 8 Nov 2019 16:19:01 +0000 (08:19 -0800)]
Use cross-module R2R generics from main module with version bubble (dotnet/coreclr#27720)

* Ability to lookup the root module for precompiled R2R generics code

Commit migrated from https://github.com/dotnet/coreclr/commit/69a57026b4bcacd8520fffb84842b31ac337e59f

4 years agoFix sequential layout for classes (dotnet/coreclr#27766)
Jan Vorlicek [Fri, 8 Nov 2019 14:50:44 +0000 (15:50 +0100)]
Fix sequential layout for classes (dotnet/coreclr#27766)

This fixes 15 pri 1 coreclr tests in
JIT\Methodical\explicit\coverage\seq_gc_*
These tests are using the StructLayout(LayoutKind.Sequential) attribute on a class and
crossgen2 was willing to generate sequential layout on value types only.

This change fixes it.

Commit migrated from https://github.com/dotnet/coreclr/commit/6f9cdc4529b93a812000513fcdde27f107d35c1e

4 years agoFix exclusion of the Common folder in runtest.proj (dotnet/coreclr#27767)
Tomáš Rylek [Fri, 8 Nov 2019 14:45:18 +0000 (06:45 -0800)]
Fix exclusion of the Common folder in runtest.proj (dotnet/coreclr#27767)

As XunitTestBinBase is not required to be canonical - in fact,
it is based on BaseOutputPath which is defined in
tests/Directory.Build.props as $(ProjectDir)..\bin\tests -
we must canonicalize the constructed paths to exclusion folders
(_SkipTestDir) before excluding them from the list of all test
dirs canonicalized in the same manner, otherwise the two lists
get out of sync and we end up not exluding Common from the test
folders. This in turn causes repeated build of Coreclr.TestWrapper
under Common, causing various race conditions in parallel wrapper
build.

Thanks

Tomas

Commit migrated from https://github.com/dotnet/coreclr/commit/969a31f4fcd44d0b33995c02e6cfa3a9a967688d

4 years agoAdd EventWaitHandle creation extension method that takes an ACL (dotnet/coreclr#42213)
Carlos Sanchez Lopez [Fri, 8 Nov 2019 03:37:03 +0000 (19:37 -0800)]
Add EventWaitHandle creation extension method that takes an ACL (dotnet/coreclr#42213)

* Add EventWaitHandle creation extension method that takes an ACL

* Call OpenExisting, add basic unit tests, move MAX_PATH in csproj for all Windows platforms, ensure same exceptions are thrown in both netcore and netfx.

* Address suggestions: using for the created handle, simplify try finally, merge methods, remove an unnecessary Debug.Assert

* simplify using, reorganize PInvokes a bit, let VS format resx as it expects it, remove BOM from csproj

* Add more unit tests

* Save basic access rights in a constant, generate name randomly

* Use FullControl (EVENT_ALL_ACCESS); update unit tests to use EventWaitHandleRights

* Apply suggestion of creating an EWH, then replacing its SWH.

* Remove using causing chaos, add more unit tests, remove null string unit test.

* spacing

* Address comments

* Remove unnecessary checks/exceptions, update unit tests

* Fix netfx x86 ut failure - different exception for mode validation.

* Small documentation fix

* Remove documentation for exception thrown with null security

* more documentation fixes

* New file for unit tests

* Dispose and remove windows only attributes in tests

* suggestion to not use var

* Remove duplicate resx after merge

* Readd cs files lost during merge

* Remove resx modification since it was untouched for this PR

* Address test comments

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/954ff9d89a4787b463a132095bbfcba39f348486

4 years agoCrossgen2 CI Pipeline (dotnet/coreclr#27520)
Tomáš Rylek [Fri, 8 Nov 2019 14:15:01 +0000 (06:15 -0800)]
Crossgen2 CI Pipeline (dotnet/coreclr#27520)

This change introduces the necessary script changes for running
CoreCLR CI pipelines in Crossgen2 mode. I have also created an
initial Crossgen2 pipeline called "coreclr-crossgen2".

Thanks

Tomas

Commit migrated from https://github.com/dotnet/coreclr/commit/f16a527e20c07043f22b37741a51127c890cd2e9

4 years agoFix r2r-extra job definition (incorrect placement of testGroup) (dotnet/coreclr#27738)
Tomáš Rylek [Fri, 8 Nov 2019 06:58:19 +0000 (22:58 -0800)]
Fix r2r-extra job definition (incorrect placement of testGroup) (dotnet/coreclr#27738)

Commit migrated from https://github.com/dotnet/coreclr/commit/68043c6306a0449bb5ed10fbdea9f14dafc99df4

4 years agoAdd Semaphore creation extension methods that take an ACL (dotnet/coreclr#42377)
Carlos Sanchez Lopez [Fri, 8 Nov 2019 00:27:37 +0000 (16:27 -0800)]
Add Semaphore creation extension methods that take an ACL (dotnet/coreclr#42377)

Approved API Proposal: dotnet/coreclr#41662

Description
We don't currently have a way to create a Semaphore with a given ACL in .NET Core. We can modify the ACL, but it would be more secure to have the proper ACL on the object from the start.

Customer impact
Before this change, customers had to create a Semaphore, then set its ACLs. This presents a few problems:
- Potential security hole as semaphores can be accessed between creation and modification.
- Porting difficulties as there isn't a 1-1 API replacement
This change addresses those problems by adding a new extension method that allows creating a Semaphore and ensuring the provided ACLs are set during creation.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/74c369c25ea866ff71350346d6c33d1d383e2593

4 years agoRevert "Change BulkMoveWithWriteBarrier to be GC suspension friendly (dotnet/coreclr...
Jan Kotas [Fri, 8 Nov 2019 06:53:39 +0000 (22:53 -0800)]
Revert "Change BulkMoveWithWriteBarrier to be GC suspension friendly (dotnet/coreclr#27642)" (dotnet/coreclr#27758)

This reverts commit dotnet/coreclr@5e1ef698774c433f70795e194e2554ad6f5b7d6f.

Commit migrated from https://github.com/dotnet/coreclr/commit/b06f8a7354861feb3e0134421bdb57d06b46ce78

4 years agoLeftover changes after rebasing my runtime changes against CoreCLR (dotnet/coreclr...
Tomáš Rylek [Fri, 8 Nov 2019 06:47:54 +0000 (22:47 -0800)]
Leftover changes after rebasing my runtime changes against CoreCLR (dotnet/coreclr#27751)

1) Viktor moved the empty.csproj script to the repo root, reflect
the change;

2) In xplat-pipeline-job, pick coreClrRepoRoot dynamically based on
pipeline name (thanks Viktor for the suggestion!);

3) Some fixes to call dotnet through the scripts we recently fixed.

4) Remove superfluous echo in dotnet.cmd per Viktor's feedback.

Thanks

Tomas

Commit migrated from https://github.com/dotnet/coreclr/commit/94b2a0dcd3d00d5d6a7600455c93e467d208b96c

4 years agoArm64: Add S.P.CoreLib instrinsics UnzipEven and UnzipOdd (dotnet/coreclr#27731)
Tamar Christina [Fri, 8 Nov 2019 05:27:43 +0000 (05:27 +0000)]
Arm64: Add S.P.CoreLib instrinsics UnzipEven and UnzipOdd (dotnet/coreclr#27731)

Commit migrated from https://github.com/dotnet/coreclr/commit/4176bcabdde2aa2e878e2c72d99bc53971923d8e

4 years agoMiscellaneous formatting cleanup to the NativeLibrary tests (dotnet/coreclr#27753)
Ryan Lucia [Fri, 8 Nov 2019 04:09:18 +0000 (23:09 -0500)]
Miscellaneous formatting cleanup to the NativeLibrary tests (dotnet/coreclr#27753)

Commit migrated from https://github.com/dotnet/coreclr/commit/236266280a5a79dea8b73287689f4cfaff220ef1

4 years agoMove NativeLibrary.Free null check to managed (dotnet/coreclr#27744)
Ryan Lucia [Fri, 8 Nov 2019 03:57:43 +0000 (22:57 -0500)]
Move NativeLibrary.Free null check to managed (dotnet/coreclr#27744)

Commit migrated from https://github.com/dotnet/coreclr/commit/4ef94ad5370a2c882e6a494ba64a4552572f8694

4 years agoArm64: Update S.P.CoreLib for ZipLow and ZipHigh (dotnet/coreclr#27730)
Tamar Christina [Fri, 8 Nov 2019 03:10:49 +0000 (03:10 +0000)]
Arm64: Update S.P.CoreLib for ZipLow and ZipHigh (dotnet/coreclr#27730)

Commit migrated from https://github.com/dotnet/coreclr/commit/6912d5ffcbbf3cc4b2b7002a1eeb02579f8f8136

4 years agoPR Feedback
Carol Eidt [Fri, 8 Nov 2019 01:16:14 +0000 (17:16 -0800)]
PR Feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/d0591cc7137a6583522369ec933abeae98e9485d

4 years agoPort IsBlittable fix and related changes from single-exe (dotnet/coreclr#27746)
Jan Vorlicek [Thu, 7 Nov 2019 22:46:38 +0000 (23:46 +0100)]
Port IsBlittable fix and related changes from single-exe (dotnet/coreclr#27746)

* Port set of changes from single-exe branch

* Enable precompilation of marshalling IL stubs in crossgen2 dotnet/coreclr#26767
* P/invoke pregeneration fixes dotnet/coreclr#27389
* Fixes to array marshalling pregeneration dotnet/coreclr#27425
* Fix IsBlittableType dotnet/coreclr#27436

* Fix stack overflow issue and m_alignpad==0 assert

I've found that the changes from single-exe had issues - it was causing
stack overflow during compilation of a couple of runtime assemblies.
After I've fixed that, there was about 15 tests failing at runtime failing
with assert failure: m_alignpad == 0. This is a well known indication of a
problem where JIT and crossgen get different field offsets, resulting in
writing beyond the end of an object.
The problem was caused by incorrect usage of sequential layout for class
without LayoutSequential attribute.
I've added a commit with fix for those to this PR.

Commit migrated from https://github.com/dotnet/coreclr/commit/0e97c7389d70551ff4179b922b700d9ff41eded3

4 years agoCheck we don't marshal out parameters in SizeParamIndex test (dotnet/coreclr#27439)
Michal Strehovský [Thu, 7 Nov 2019 21:54:49 +0000 (22:54 +0100)]
Check we don't marshal out parameters in SizeParamIndex test (dotnet/coreclr#27439)

* Check we don't marshal out parameters in SizeParamIndex test

The test passes both uninitialized (null) and initialized values to native.

We can add a check to ensure the initialized value doesn't get marshalled to native.

Commit migrated from https://github.com/dotnet/coreclr/commit/3ef9c7b2503a84d12edbb7e8c58b8e395632e98d

4 years agoMake sure that we use a normalized struct type if applicable.
Carol Eidt [Thu, 7 Nov 2019 21:49:10 +0000 (13:49 -0800)]
Make sure that we use a normalized struct type if applicable.

Commit migrated from https://github.com/dotnet/coreclr/commit/a7d01c5480645aa85c90163beaf625d9425aada1

4 years agoUpdating NumberToFloatingPointBitsSlow to handle the remaining parsed fractional...
Tanner Gooding [Thu, 7 Nov 2019 21:06:32 +0000 (13:06 -0800)]
Updating NumberToFloatingPointBitsSlow to handle the remaining parsed fractional digits being zero. (dotnet/coreclr#27688)

Commit migrated from https://github.com/dotnet/coreclr/commit/460b97aa406f10cf9ab19e6398e1e1a72fc58b48

4 years agoFix dotnet-coreclr-perf pipeline (dotnet/coreclr#27685)
Tomáš Rylek [Thu, 7 Nov 2019 19:52:14 +0000 (11:52 -0800)]
Fix dotnet-coreclr-perf pipeline (dotnet/coreclr#27685)

Commit migrated from https://github.com/dotnet/coreclr/commit/9b2de2cbaaa6edf4a985a00088a3d655a688844d

4 years agoArm64: Add S.P.CoreLib for AddV. (dotnet/coreclr#27663)
Tamar Christina [Thu, 7 Nov 2019 17:58:35 +0000 (17:58 +0000)]
Arm64: Add S.P.CoreLib for AddV. (dotnet/coreclr#27663)

Commit migrated from https://github.com/dotnet/coreclr/commit/12b9ed40c7664cf7e338fb9070aab2a83771b4dd

4 years agoRemove root cross folder in favor of eng/common/cross (dotnet/coreclr#27727)
Viktor Hofer [Thu, 7 Nov 2019 11:41:46 +0000 (12:41 +0100)]
Remove root cross folder in favor of eng/common/cross (dotnet/coreclr#27727)

* Remove root cross folder in favor of common

* Manual darc upate from build '20191106.10'

* Update arm32_ci_script.sh

* Update Documentation/building/cross-building.md

Co-Authored-By: Jan Vorlicek <janvorli@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/f6089121cda64da8827a871a2407ff5e687196a8

4 years agoMinor cleanup in download-artifact-step / upload-artifact-step (dotnet/coreclr#27726)
Tomáš Rylek [Thu, 7 Nov 2019 10:00:44 +0000 (02:00 -0800)]
Minor cleanup in download-artifact-step / upload-artifact-step (dotnet/coreclr#27726)

I have noticed this some time ago. We don't actually need to
explicitly specify the "upload / download folder" as we can easily
synthesize them in the step templates.

Thanks

Tomas

Commit migrated from https://github.com/dotnet/coreclr/commit/dc537046d37e7fd9fd6c31d8224c2bd456a93b69

4 years agoUse preinstalled system dotnet if its version matches (dotnet/coreclr#27705)
Tomáš Rylek [Thu, 7 Nov 2019 09:10:46 +0000 (01:10 -0800)]
Use preinstalled system dotnet if its version matches (dotnet/coreclr#27705)

* Use preinstalled system dotnet if its version matches

According to standard Arcade logic, CoreCLR build should be using
preinstalled system dotnet if it's the same version as requested
by the CoreCLR build.

We were suppressing this logic in configure-toolset.ps1 by setting
$script:useInstalledDotNetCli = $false with reference to some
obsolete build tools logic that no longer exists.

I have replaced this with a simple function that calls
InitializeBuildTool from the tools.ps1 Arcade script and produces
the result in form of a one-line batch file setting the dotnet
path to an environment variable we can then use in dotnet.cmd.

I have modified the Linux script dotnet.sh to again consume the
dotnet path from InitializeBuildTool.

Thanks

Tomas

* Address Viktor's and Jan's PR feedback

Based on offline discussion with Viktor I have cleaned this up
as follows:

1) I have deleted both init-dotnet scripts;

2) The dotnet script directly calls powershell on the tools.ps1
script to call the function InitializeDotNetCli and use JanV's
trick to capture its return value in an auxiliary environment
variable that is subsequently used to launch dotnet.

3) In tests/build.proj, I applied Viktor's feedback by deleting
the custom code and switching it over to the standard Arcade
property DotNetTool.

Thanks

Tomas

* Remove explicit inclusion of configure-toolset.ps1

* Fix Linux version of the dotnet script; missing quotes in build.proj

* Fix variable name typo in the Linux dotnet.sh script

Commit migrated from https://github.com/dotnet/coreclr/commit/3f6ed5b833071b4ba71fac46ea4a06fd9ef3eb4d

4 years agoCrossgen2 node size relocation (dotnet/coreclr#27718)
Simon Nattress [Thu, 7 Nov 2019 08:16:56 +0000 (00:16 -0800)]
Crossgen2 node size relocation (dotnet/coreclr#27718)

* Crossgen2 node size relocation

* Add a new relocation (`IMAGE_REL_SYMBOL_SIZE`) to Crossgen2 which is fixed up with the size of the object node being relocated to.
* Crossgen2 needs to encode the size of another ObjectNode in several places
  * The COR header emits offset and size of the ready-to-run header
  * The ready-to-run header itself emits the sizes of the various data tables it points at
  * `ImportSectionsTable` points to the RVA / size of `ImportTable`
* Currently we call `Getdata().Data.Length` on the node we want to know the size of which is wasteful, causing us to regenerate data for all the header nodes multiple times.
* Fix some implicit node emission ordering dependencies we were unaware of. `MethodEntryPoint` table needs to be generated after the import section nodes since it encodes index and offsets of imports within their tables which are only finalized when the import tables are emitted.

* Fix comment typo

Commit migrated from https://github.com/dotnet/coreclr/commit/1e8650ab8c314e1c020a307ed26b5df98bd05cc8

4 years agoFix unquoted path parameters in Microsoft.NET.Sdk.IL.targets (dotnet/coreclr#27704)
Alexey Golub [Thu, 7 Nov 2019 05:43:49 +0000 (07:43 +0200)]
Fix unquoted path parameters in Microsoft.NET.Sdk.IL.targets (dotnet/coreclr#27704)

This fixes issues when running build.cmd in dotnet/corefx when there are spaces on the path.
Fixes dotnet/coreclr#27699

Commit migrated from https://github.com/dotnet/coreclr/commit/d15312228b941a03a752ba61e8d1b555bc4b15f2

4 years agoSupport custom modifier for method signature (dotnet/coreclr#27676)
Andrew Au [Thu, 7 Nov 2019 05:07:33 +0000 (21:07 -0800)]
Support custom modifier for method signature (dotnet/coreclr#27676)

Commit migrated from https://github.com/dotnet/coreclr/commit/6d56c7a1b64070b7f302c6083d6cf189692f7240

4 years agoAdd Mutex creation extension methods that take an ACL (dotnet/coreclr#42281)
Carlos Sanchez Lopez [Thu, 7 Nov 2019 01:05:31 +0000 (17:05 -0800)]
Add Mutex creation extension methods that take an ACL (dotnet/coreclr#42281)

Approved API Proposal: dotnet/coreclr#41662

Description
We don't currently have a way to create a Mutex with a given ACL in .NET Core. We can modify the ACL, but it would be more secure to have the proper ACL on the object from the start.

Customer impact
Before this change, customers had to create a Mutex, then set its ACLs. This presents a few problems:

Potential security hole as mutexes can be accessed between creation and modification.
Porting difficulties as there isn't a 1-1 API replacement
This change addresses those problems by adding a new extension method that allows creating a Mutex and ensuring the provided ACLs are set during creation.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/6a2de7eaa6fba965a90754beafb6a8f4ca81d460

4 years agoDelete some dead code from vm/threds.cpp/.h (dotnet/coreclr#27701)
Jan Kotas [Thu, 7 Nov 2019 01:40:03 +0000 (17:40 -0800)]
Delete some dead code from vm/threds.cpp/.h (dotnet/coreclr#27701)

Commit migrated from https://github.com/dotnet/coreclr/commit/4822669f2b10fdecbfd876fbf4399a8d9339b4e8

4 years agoMove tryrun to importing project (dotnet/coreclr#27717)
Viktor Hofer [Thu, 7 Nov 2019 01:19:34 +0000 (02:19 +0100)]
Move tryrun to importing project (dotnet/coreclr#27717)

Commit migrated from https://github.com/dotnet/coreclr/commit/c373d864c05fa4c4b68e764cf47d2a623c4b2baa

4 years agoChange the SSA def node to ASG (dotnet/coreclr#27445)
mikedn [Thu, 7 Nov 2019 01:10:47 +0000 (03:10 +0200)]
Change the SSA def node to ASG (dotnet/coreclr#27445)

SSA defs used to point at LHS of GT_ASG. Many clients immediately needed to walk up the tree to the parent to find the GT_ASG. So revise the SSA def to just be the GT_ASG.

Also, reject non-LCL_VAR definitions in RangeCheck. This matches the previous behavior that rejected LHS nodes that weren't the direct descendant of the ASG node - basically cases like ASG(IND(ADDR(LCL_VAR)), x). RangeCheck doesn't have the ability to follow such definitions.

This also happens to reject LCL_FLD nodes as LHS. The machinery required to follow definition chains involving struct copies and field access is quite a bit more complicated and RangeCheck certainly doesn't have it.

Commit migrated from https://github.com/dotnet/coreclr/commit/1b12053ffffc36ad73ad83f7ce111c891c4cf457

4 years agoFeature: dynamic expansion for generic dictionaries (dotnet/coreclr#26262)
Fadi Hanna [Wed, 6 Nov 2019 23:06:09 +0000 (15:06 -0800)]
Feature: dynamic expansion for generic dictionaries (dotnet/coreclr#26262)

* Feature: Dynamic Expansion for Generic Dictionaries

These changes introduce dynamic size expansion for generic dictionary layouts when we run out of slots.
The original implementation allowed for an expansion, but using a linked list structure, which made it impossible to use fast lookup slots once we were out of slots in the first bucket.

This new implementation allows for the usage of fast lookup slots always, for all generic lookups.

This also removes the constraint we had on R2R, where we disabled the usage of fast slots all-together.

* Add diagnostics slot with pointer to old dictionary

* Adding a chapter in the BOTR describing generic dictionaries

Commit migrated from https://github.com/dotnet/coreclr/commit/d840c759948d910da85cf8688a45c84d09f0ad5e

4 years ago[test] Improve diagnostics for failures in IPC/EventPipe tests (dotnet/coreclr#27567)
John Salem [Wed, 6 Nov 2019 22:37:06 +0000 (14:37 -0800)]
[test] Improve diagnostics for failures in IPC/EventPipe tests (dotnet/coreclr#27567)

* Add ProxyStream for diagnosing issues with EventPipeEventSource StreamReading
* Harden IpcTraceTest.cs against errors where the reader throws an exception before we await the task

Commit migrated from https://github.com/dotnet/coreclr/commit/89ad9a78cb76df1e7d22f40145588cf62e7c362f

4 years agoRemove silent catch (dotnet/coreclr#26732)
Filip Navara [Wed, 6 Nov 2019 21:48:40 +0000 (22:48 +0100)]
Remove silent catch (dotnet/coreclr#26732)

Remove silent catch for `SafeHandle`

Commit migrated from https://github.com/dotnet/coreclr/commit/f40219af9da8635d35158a947cc208acff316b8d

4 years agoFix VN for byrefx on x86. (dotnet/coreclr#27702)
Sergey Andreenko [Wed, 6 Nov 2019 21:31:31 +0000 (21:31 +0000)]
Fix VN for byrefx on x86. (dotnet/coreclr#27702)

* Add a repro test.

* Fix the bug.

* Extract code duplication into `VnForConst`.

* make the new method private.

Commit migrated from https://github.com/dotnet/coreclr/commit/6d1b188773c40661612eea98fce5287aa2455377

4 years agoImprove Math(F).FusedMultiplyAdd codegen (dotnet/coreclr#27060)
Egor Bogatov [Wed, 6 Nov 2019 20:27:35 +0000 (23:27 +0300)]
Improve Math(F).FusedMultiplyAdd codegen (dotnet/coreclr#27060)

* improve Math(F).FusedMultiplyAdd

* fix wrong order and clang formatting

* fix ordering again

* code formatting

* fix typos

* Move to Lower

* clean up

* Fix assert

* code formatting

* code formatting

* Address feedback

* Clean up

* Add an assert to make sure we only have 3 args

* Address feedback and add tests

* Address feedback

* update tests

* Fix CI failure

* Address feedback

* formatting

* Fix failures

Commit migrated from https://github.com/dotnet/coreclr/commit/d9272784d10f38991e3004c9b074d6aa444a39cb

4 years agoPopulate properties of AssemblyLoadStart/Stop events (dotnet/coreclr#27558)
Elinor Fung [Wed, 6 Nov 2019 20:17:49 +0000 (12:17 -0800)]
Populate properties of AssemblyLoadStart/Stop events (dotnet/coreclr#27558)

* Populate properties of AssemblyLoadStart/Stop events
* Add tests for basic start/stop binder tracing events
* Add property for ALC of requesting assembly

Commit migrated from https://github.com/dotnet/coreclr/commit/05cbf03037737c631534642f699cf7533a9ee250

4 years agoImplement comparisons for all ObjectNodes (dotnet/coreclr#27355)
Anubhav Srivastava [Wed, 6 Nov 2019 17:57:40 +0000 (09:57 -0800)]
Implement comparisons for all ObjectNodes (dotnet/coreclr#27355)

* Preparation to introduce parallelism into crossgen2

- Add comparison functions for all object nodes and sort object nodes before they are emitted to the PE.

- Sort ImportSection signatures based on their imports to keep them in sync.

- Add determinism test.

- Change dictionaries in ReadyToRunCodegenNodeFactory and ReadyToRunSymbolNodeFactory to NodeCaches (i.e. ConcurrentDictionary, at the moment)

- Add structs to act as keys for the above NodeCaches (MethodFixupKey, DynamicHelperKey, ReadyToRunHelperKey)

- Synchronize logger

- Update some Dictionaries to ConcurrentDictionary

- Sort GCRefMapNode methods and lock the add since AddImport might be called my multiple threads at once.

- Create RandomInsertStack to speed up randomization when using CoreRT_DeterminismSeed.

Commit migrated from https://github.com/dotnet/coreclr/commit/230117910d7c033eb1025ba350731163e80da9d6

4 years agoRevert changes to tryrun.cmake (dotnet/coreclr#27697)
Santiago Fernandez Madero [Wed, 6 Nov 2019 09:12:16 +0000 (01:12 -0800)]
Revert changes to tryrun.cmake (dotnet/coreclr#27697)

Commit migrated from https://github.com/dotnet/coreclr/commit/e303cb61058c82e5fa42225fb7f668b765da8ba8

4 years agoAdd Span.Sort, and make Array.Sort span-based (dotnet/coreclr#27700)
Stephen Toub [Wed, 6 Nov 2019 06:39:01 +0000 (01:39 -0500)]
Add Span.Sort, and make Array.Sort span-based (dotnet/coreclr#27700)

* Add Span<T>.Sort

Shares existing Array-based implementation by changing that implementation to be span based.

* Additional work to enable span-based sorts

- Cleans up changes from the previous commit, e.g. corrects nullable annotations, removes TODOs, using GetRawSzArrayData instead of GetRawArrayData, etc.
- Passes spans around rather than spans+lo+hi.
- Deletes the native TrySZSort, preferring to use the managed implementation in all cases.

Commit migrated from https://github.com/dotnet/coreclr/commit/50d73a21afcc8eaa3e7f459253314db8a5553333

4 years agoFix intermittent arm/arm64 Linux build failures (dotnet/coreclr#27698)
Jan Vorlicek [Wed, 6 Nov 2019 04:58:12 +0000 (05:58 +0100)]
Fix intermittent arm/arm64 Linux build failures (dotnet/coreclr#27698)

The arm/arm64 Linux builds were recently failing intermittently
with a weird error in macro expansion in one of the generated
eventing headers. It seems that the issue is caused by the fact
that we were not creating a custom_target to enable handling
dependencies on the generated header files and we were also
not marking the files as generated.
I've noticed that the message indicating that the headers are
being generated was printed twice in the build log. with this
fix, it occurs only once there.
So I believe that the issue was caused by the headers being
generated twice by two different threads and when that happened,
the files got corrupted.

Commit migrated from https://github.com/dotnet/coreclr/commit/7cf41c0fb1b916057aa5beeac57d6195878740cc

4 years agoAvoid memset in case of HENUMInternal (dotnet/coreclr#27690)
Adeel Mujahid [Wed, 6 Nov 2019 01:40:32 +0000 (03:40 +0200)]
Avoid memset in case of HENUMInternal (dotnet/coreclr#27690)

gcc9 complains:

```sh
/datadrive/projects/coreclr/src/md/runtime/mdinternalro.cpp: In member function virtual HRESULT MDInternalRO::EnumTypeDefInit(HENUMInternal*):
/datadrive/projects/coreclr/src/md/runtime/mdinternalro.cpp:202:44: error: void* memset(void*, int, size_t) clearing an object of non-trivial type struct HENUMInternal; use assignment or value-initialization instead [-Werror=class-memaccess]
  202 |     memset(phEnum, 0, sizeof(HENUMInternal));
      |                                            ^
In file included from /datadrive/projects/coreclr/src/inc/corpriv.h:21,
                 from /datadrive/projects/coreclr/src/md/runtime/stdafx.h:20,
                 from /datadrive/projects/coreclr/src/md/runtime/mdinternalro.cpp:12:
/datadrive/projects/coreclr/src/inc/metadata.h:87:8: note: struct HENUMInternal declared here
   87 | struct HENUMInternal
      |        ^~~~~~~~~~~~~
```

As it turned out, there already is a static helper defined on this type
with a comment to prefer it over memset, this patch just replaces the
usage.

Commit migrated from https://github.com/dotnet/coreclr/commit/91ee41b6701e1f7f8d3d1fba461a67e240c83c82

4 years agoContain block store addresses (dotnet/coreclr#21711)
Sergey Andreenko [Tue, 5 Nov 2019 23:01:41 +0000 (23:01 +0000)]
Contain block store addresses (dotnet/coreclr#21711)

Commit migrated from https://github.com/dotnet/coreclr/commit/d5729752866606686c7158d62bb033adf0f707dc

4 years agoMove p/invoke pregeneration out of single-exe branch (dotnet/coreclr#27673)
Fadi Hanna [Tue, 5 Nov 2019 22:51:35 +0000 (14:51 -0800)]
Move p/invoke pregeneration out of single-exe branch (dotnet/coreclr#27673)

* Move p/invoke pregeneration out of single-exe branch

This is just xcopy of the src/tools/crossgen2 directory in the single-exe branch with David's profile data changes omitted. I had to fix a `using` directive in one of the files because a `using` keyword the branch was using got deleted in master.

I don't know if there's a way to do this kind of selective merge in git, but I don't particularly care. Most of the interesting history for these files is on the CoreRT side anyway.

Also including the change to prestub.cpp that unlocks using the generated p/invokes.

* Disable ILStub emission for pinvokes until they are fixed to be non-shared

Commit migrated from https://github.com/dotnet/coreclr/commit/bee443dc0e8fc6a74a87bd207df63db3dfbd6f14

4 years agoEnable rejit feature on all cpu architectures (dotnet/coreclr#27576)
David Mason [Tue, 5 Nov 2019 21:36:22 +0000 (13:36 -0800)]
Enable rejit feature on all cpu architectures (dotnet/coreclr#27576)

Commit migrated from https://github.com/dotnet/coreclr/commit/6d06f54a6b2bf0ddcc69d12cfc11e09ddb6d4ec0

4 years agoAdd gcc9 config and remove ZeroInit macro (dotnet/coreclr#27605)
Adeel Mujahid [Tue, 5 Nov 2019 19:11:31 +0000 (21:11 +0200)]
Add gcc9 config and remove ZeroInit macro (dotnet/coreclr#27605)

* Add gcc9 config

* Remove ZeroInit definition and usage
Initialize dacprivate structs to 0 explicitly.

Commit migrated from https://github.com/dotnet/coreclr/commit/d2a8b55d4c944438df1599c9a78262bc48f07266

4 years agoFix gc-longrunning pipeline definition (dotnet/coreclr#27684)
Tomáš Rylek [Tue, 5 Nov 2019 18:46:29 +0000 (10:46 -0800)]
Fix gc-longrunning pipeline definition (dotnet/coreclr#27684)

Commit migrated from https://github.com/dotnet/coreclr/commit/d37ca4290cb1cc82f347475ab72d39252185d9f0

4 years agoUpdate Profiler Loading.md (dotnet/coreclr#23890)
eli-fin [Tue, 5 Nov 2019 18:33:38 +0000 (20:33 +0200)]
Update Profiler Loading.md (dotnet/coreclr#23890)

Minor fixes

Commit migrated from https://github.com/dotnet/coreclr/commit/c8a5570ed9b91e7c45f04496fa9c9122a7a65156

4 years agoPrevent DivideByZeroException in EventCounter.ToString() (dotnet/coreclr#27581)
JesperTreetop [Tue, 5 Nov 2019 18:33:18 +0000 (19:33 +0100)]
Prevent DivideByZeroException in EventCounter.ToString() (dotnet/coreclr#27581)

* Prevent DivideByZeroException in EventCounter.ToString()

Maybe it should print something other than 0. Maybe "Mean" should be excluded. But at least with this it doesn't divide by zero. Ternary operator in interpolated string is not super readable; didn't know if making the code more descriptive would have performance implications.

* Update src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventCounter.cs

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/a187c727956c8ed30635f75450e7dfc38f2ccf38

4 years agoSome follow up changes after the cast caching change (dotnet/coreclr#27571)
Vladimir Sadov [Tue, 5 Nov 2019 17:51:21 +0000 (09:51 -0800)]
Some follow up changes after the cast caching change (dotnet/coreclr#27571)

* Make array MT and element type always match.

* Remove TypeDesc duplication of ArrayIsInstanceOf and ArraySupportsBizarreInterface

* Removed `CanCastToNonVariantInterface`. It was used only in three places, one of which was an assert.

* Use `CanCastTo` in `MergeTypeHandlesToCommonParent` - it does a cache lookup and can be called in preemptive mode.

* Updated the comment on TypeHandle::GetMethodTable(). We can still get non-exact method tables for TypeDescs.

* Removed "Approx" in `GetApproxArrayElementTypeHandle`, `SetApproxArrayElementTypeHandle` and `GetApproxArrayElementTypeHandlePtr`

Commit migrated from https://github.com/dotnet/coreclr/commit/5aaa25b61aec244c39c2c9b5ce0800a9183df24e

4 years agoFixing the return type of the ArmBase.ReverseElementBits methods in the PlatformNotSu...
Tanner Gooding [Tue, 5 Nov 2019 17:30:07 +0000 (09:30 -0800)]
Fixing the return type of the ArmBase.ReverseElementBits methods in the PlatformNotSupported file (dotnet/coreclr#27672)

Commit migrated from https://github.com/dotnet/coreclr/commit/b2f98b9a29ce10178ab61fc14e11f17200e2d111