platform/upstream/dotnet/runtime.git
4 years agoFix format job; build with the same dotnet CLI that jitutils uses (dotnet/coreclr...
Bruce Forstall [Thu, 14 Nov 2019 02:38:59 +0000 (18:38 -0800)]
Fix format job; build with the same dotnet CLI that jitutils uses (dotnet/coreclr#27871)

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

4 years agoUnifying the type used for number of heaps/locks/threads (dotnet/coreclr#27846)
Vladimir Sadov [Thu, 14 Nov 2019 02:22:27 +0000 (18:22 -0800)]
Unifying the type used for  number of heaps/locks/threads (dotnet/coreclr#27846)

Unifying the type used for number of heaps/locks/threads
It is the same small number and should be just int.

NOTE: Initial number of allocated blocks per generation is also the same as number of heaps.

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

4 years agoReturn compGetTieringName printing. (dotnet/coreclr#27873)
Sergey Andreenko [Thu, 14 Nov 2019 01:15:18 +0000 (01:15 +0000)]
Return compGetTieringName printing. (dotnet/coreclr#27873)

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

4 years agoAdd ability to patch corefx binaries from a locally built enlistment for coreclr...
David Mason [Thu, 14 Nov 2019 00:47:10 +0000 (16:47 -0800)]
Add ability to patch corefx binaries from a locally built enlistment for coreclr tests (dotnet/coreclr#27422)

Adds the "localcorefxpath" argument to build-test.cmd

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

4 years agoAdd generatelayoutonly build-test.cmd (dotnet/coreclr#27861)
Jarret Shook [Thu, 14 Nov 2019 00:16:44 +0000 (16:16 -0800)]
Add generatelayoutonly build-test.cmd (dotnet/coreclr#27861)

* Add generatelayoutonly build-test.cmd

* address feedback

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

4 years agoImprove dominator tree building & walking (dotnet/coreclr#27282)
mikedn [Wed, 13 Nov 2019 23:50:08 +0000 (01:50 +0200)]
Improve dominator tree building & walking (dotnet/coreclr#27282)

* Delete unused SsaBuilder code

* Delete BasicBlock::bbDfsNum

bbPostOrderNum serves the same purpose

* Improve dominator tree building & walking
- Change the dominator tree data structure to a simple array of nodes
- Adapt fgBuildDomTree so it can be used by SsaBuilder
- Add a dominator tree visitor class
- Reuse the dominator tree built by SsaBuilder for copy propagation

* Move bbNatLoopNum to fill a padding hole

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

4 years agoARM32 compilation fixes with GCC (dotnet/coreclr#27795)
Sinan Kaya [Wed, 13 Nov 2019 23:44:53 +0000 (18:44 -0500)]
ARM32 compilation fixes with GCC (dotnet/coreclr#27795)

* Suppress on clang only

* Fix integer conversion

* Extra qualifier

* Suppress warning

* Extra qualifier

* Signedness issues

* Correct offsetof

* Offsetof doesn't support non-constant values

* Conversion errors

* Move the comment too

* Fix assembly warning

* size is not constant

* Fix comment type

* Fix endmacro name

* Use OFFSET_NONE constant

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

4 years agoAdding tests for the new apis to convert between S.Numerics and S.R.Intrinsic vectors...
Tanner Gooding [Wed, 13 Nov 2019 23:41:01 +0000 (15:41 -0800)]
Adding tests for the new apis to convert between S.Numerics and S.R.Intrinsic vectors (dotnet/coreclr#27481)

* Updating Vector128.AsVector3 to have a functioning implementation

* Adding test template metadata covering the new methods for converting between S.Numerics and S.R.Intrinsics

* Regenerating the existing tests

* Generating the new Vector conversion tests

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

4 years agoFix naming in AssemblyLoadFromResolveHandlerInvoked user data template (dotnet/corecl...
Elinor Fung [Wed, 13 Nov 2019 23:32:21 +0000 (15:32 -0800)]
Fix naming in AssemblyLoadFromResolveHandlerInvoked user data template (dotnet/coreclr#27859)

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

4 years agoBgc suspension fixes (dotnet/coreclr#27729)
Peter Sollich [Wed, 13 Nov 2019 23:24:20 +0000 (00:24 +0100)]
Bgc suspension fixes (dotnet/coreclr#27729)

* Changes to set gen0 bricks always. This reduces the time spent in find_first_object when finding the start of objects for marking interior pointers.

* Revert "Changes to set gen0 bricks always. This reduces the time spent in find_first_object when finding the start of objects for marking interior pointers."

This reverts commit dotnet/coreclr@9d53ff910ceb5482c67350a88e6687b8f94d5634.

* Two fixes to speed up suspension for foreground GCs while background GC is in progress:

- In background_mark_simple1, check g_fSuspensionPending and if it is set, save the state of the work and restart the loop - this will call allow_fgc() and thus allow a foreground GC to take place.

- In revisit_written_page, call allow_fgc() at the end - this allow a foreground GC to happen whenever we are done with revisiting a written page.

* Addressed code review feedback - use counter instead of testing g_fSuspensionPending directly.

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

4 years agoFix RHEL6 build (dotnet/coreclr#27863)
Jeremy Koritzinsky [Wed, 13 Nov 2019 22:14:57 +0000 (14:14 -0800)]
Fix RHEL6 build (dotnet/coreclr#27863)

* Make stripping symbols overridable at install_clr invocation to avoid double-stripping symbols.

* Add SKIP_STRIP option to install_clr parameter list comment

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

4 years agoRemove exclusion of two runtime assemblies from build in SuperILC (dotnet/coreclr...
Jan Vorlicek [Wed, 13 Nov 2019 21:05:06 +0000 (22:05 +0100)]
Remove exclusion of two runtime assemblies from build in SuperILC (dotnet/coreclr#27857)

The System.Private.CoreLib builds fine using crossgen2 now (I've been
building it locally for a couple of weeks already).
I've also tried to remove exclusion of the
Microsoft.Diagnostics.Tracing.TraceEvent and it is passing now as well.

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

4 years agoAdd span-based CopyTo and CopyToAsync methods (dotnet/coreclr#27639)
Emmanuel André [Wed, 13 Nov 2019 19:47:18 +0000 (20:47 +0100)]
Add span-based CopyTo and CopyToAsync methods (dotnet/coreclr#27639)

* Add span-based CopyTo and CopyToAsync methods

* Update according to feedback

* Add span-based CopyTo overrides for MemoryStream

* Improve span-based CopyTo arguments validation

To avoid code duplication

* Update according to second review

Stream API is changed

* Resolve InternalReadSpan/Memory inlining

* Refactor ValidateCopyToArgs

* Update according to third review

* Update after fourth review

* Override span CopyTo for UnmanagedMemoryStream

* Apply suggestions from code review

Co-Authored-By: Stephen Toub <stoub@microsoft.com>
* Update after fifth review

* Add cross sync/async support for span-based CopyTo

* Call sync action directly in async context

* Rework cross sync/async support for span-based CopyTo

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

4 years agoUpdate CoreLib sources path and import runtime (dotnet/coreclr#27858)
Viktor Hofer [Wed, 13 Nov 2019 19:46:54 +0000 (20:46 +0100)]
Update CoreLib sources path and import runtime (dotnet/coreclr#27858)

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

4 years agoFix SIMD intrinsics handling in crossgen2 (dotnet/coreclr#27853)
Jan Vorlicek [Wed, 13 Nov 2019 19:40:58 +0000 (20:40 +0100)]
Fix SIMD intrinsics handling in crossgen2 (dotnet/coreclr#27853)

* Fix SIMD intrinsics handling in crossgen2

Crossgen2 was compiling methods that call SIMD intrinsics
(System.Numerics.Vector<T>). This is not correct, as the size of the
vector is a runtime specific detail - e.g. when running on devices
without SSE2 support, the size is 4 and when running on devices with
SSE2 support, the size is 8.
This fixes runtime errors in 6 coreclr pri 0 tests.

* Reflect PR feedback

Create a IsVectorOfT method and use it at all places where we were
previously checking the namespace and type name of Vector<T>

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

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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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

5 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