platform/upstream/dotnet/runtime.git
4 years agoRemove allocations from Dns.* (dotnet/corefxdotnet/coreclr#41061)
Stephen Toub [Tue, 17 Sep 2019 12:20:14 +0000 (08:20 -0400)]
Remove allocations from Dns.* (dotnet/corefxdotnet/coreclr#41061)

This started as an effort to reduce the size of System.Net.NameResolution.dll when publishing a trimmed app.  It's not that big to begin with, but it's carrying around a copy of all of the IAsyncResult helper types, because the Get*Async methods are currently wrappers for the Begin/End* methods.

This PR inverts that, wrapping the Begin/End* methods instead around the Get*Async methods, using the same TaskToApm helper we use in other places in corefx for the same purpose.  This makes the Get*Async methods faster and lighterweight, but it does increase the number/amount of allocation in the Begin/End* APIs.  Since these are considered legacy, I normally would consider that a good trade, however we still use these Begin/End methods in a few places in System.Net.Sockets, and I didn't want to regress those use cases.

So, this also then trims some additional fat, which helps the Get*Async cases even further, and gets the Begin/End* to be even better than before the change.  This includes not allocating an IPHostEntry when we're just going to unwrap it and return its addresses, computing the exact IPAddress[] size we need rather than using a List<> to grow it and ToArray to create the actual array, avoiding creating the HostName if we don't need it, and avoiding an unnecessary SafeHandle allocation.

As part of this, I also noticed that we had some bugs in how some of our interop structures on Windows were defined.  In particular, fields that in the native types were size_t were defined as int rather than IntPtr in the managed code.  It appears we were saved by padding, but I fixed it regardless.

And as long as I was changing pretty much everything else, where I was touching code I also cleaned up some legacy style stuff.

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

4 years agoFix ceeInfoGetCallInfo by incorporating Fadi's commit https://github.com/dotnet/corec...
Tomáš Rylek [Tue, 17 Sep 2019 10:30:30 +0000 (03:30 -0700)]
Fix ceeInfoGetCallInfo by incorporating Fadi's commit https://github.com/dotnet/coreclr/pull/24383 (dotnet/coreclr#26722)

After merging in Jan Vorlicek's fundamental PInvoke transition frame
size fix, I took a look at some of the remaining failures. During
debugging of the test

baseservices/threading/generics/syncdelegate/GCThread16

I noticed a JIT codegen difference I tracked down to Fadi's PR

https://github.com/dotnet/coreclr/pull/24383/files

not present in the Crossgen2 source code. Thankfully the method
is today a line-by-line rewrite of its legacy Crossgen counterpart
so it was pretty trivial to spot this one new bit.

Thanks

Tomas

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

4 years agoFix R2RDump to correctly parse array lower bounds (dotnet/coreclr#26743)
Jan Vorlicek [Tue, 17 Sep 2019 07:55:20 +0000 (09:55 +0200)]
Fix R2RDump to correctly parse array lower bounds (dotnet/coreclr#26743)

There is a an incorrect size (likely a typo) used to create lower bounds
array when parsing signatures. This results in `Index was outside the
bounds of the array.` being printed inside of the array signature
string.

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

4 years agoAdd crossgen2 smoke test
Michal Strehovský [Mon, 9 Sep 2019 11:33:50 +0000 (13:33 +0200)]
Add crossgen2 smoke test

This is the DevUnitTest from the CoreRT repo.

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

4 years agoFix publishing crossgen2 on macOS
Michal Strehovský [Tue, 10 Sep 2019 14:36:48 +0000 (16:36 +0200)]
Fix publishing crossgen2 on macOS

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

4 years agoIBC fixes (dotnet/coreclr#26738)
David Wrighton [Tue, 17 Sep 2019 01:53:47 +0000 (18:53 -0700)]
IBC fixes (dotnet/coreclr#26738)

* IBC fixes
- Support IntPtr and UIntPtr element types in IBC data
- More defensive coding against structurally incorrect IBC data
- Skip compilation of open method definitions
- Generate IBC data without crashing when the first logged item is an InstantiatedMethod and not a token
- Safely shutdown and emit IBC data from a thread that hasn't been given a Thread object

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

4 years agoEnable minidumps on all helix runs. (dotnet/coreclr#26455)
Jeremy Koritzinsky [Mon, 16 Sep 2019 21:45:46 +0000 (14:45 -0700)]
Enable minidumps on all helix runs. (dotnet/coreclr#26455)

* Set COMPlus_DbgEnableMiniDump on all helix test runs.

* Set dump output path for *nix builds.

* Enable collecting dumps for timed-out tests on Windows.

* Enable xunit wrapper to get dumps for timed-out tests on non-Windows.

* Use sudo for createdump

* Update coredump-on-crash pattern to use the $HELIX_WORKITEM_UPLOAD_ROOT environment variable.

* Implement linux-specific path for finding a child process by name.

* Use HELIX_DUMP_FOLDER instead of HELIX_WORKITEM_UPLOAD_ROOT

* Remove empty entries in childrenPidAsStrings.

* Look up createdump in Core_Root

* Implement timeout macOS crash dumps.

* Add ulimit -c unlimited to the Helix script on MacOS.

* Get MacOS timeout dumps working (and enable assert/exception dumps)

* Copy OSX aborted test dumps to crash dump folder.

* Add missing return true.

* Allow overwriting dump files on copy (on macOS).

* Fix accidental shadow.

* Allow multiple spaces in ps output.

* Fix dump on windows hitting an assert on checked coreclr.

* TEMPORARY: Add more logging in macOS case.

* Fix change.

* Fix macOS timeout crash dump creation (at least locally).

* Fix Windows timeout dump collection.

* Explicitly use WChar structures.

* TEMPORARY: Test OSX dumps on 10.14 queue.

* Fix __CrashDumpFolder on OSX

* Don't try to copy the dump if it doesn't exist (10.13 Helix queue doesn't support it yet).

* Remove temporary OSX 10.14 queue usage in prs.

* Add tracking issue for empty HELIX_DUMP_FOLDER env var on OSX.

* PR Feedback

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

4 years agoRemove unused flags on ArrayMarshalInfo only used for type lib… (dotnet/coreclr#26734)
Jeremy Koritzinsky [Mon, 16 Sep 2019 21:22:42 +0000 (14:22 -0700)]
Remove unused flags on ArrayMarshalInfo only used for type lib… (dotnet/coreclr#26734)

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

4 years agoUpdate typo in comment in CultureInfo.cs
Stephen Toub [Mon, 16 Sep 2019 19:39:40 +0000 (15:39 -0400)]
Update typo in comment in CultureInfo.cs

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

4 years agoFix calendar instance inside the culture after cloning (dotnet/coreclr#26721)
Tarek Mahmoud Sayed [Mon, 16 Sep 2019 19:18:17 +0000 (12:18 -0700)]
Fix calendar instance inside the culture after cloning (dotnet/coreclr#26721)

When creating a new culture, we’ll have the equality CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar be true. After cloning such culture, this equality would not be true. The fix here is to ensure if the equality is true before cloning then should be true after cloning.

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

4 years agoImprove jit tailcall decision reporting (dotnet/coreclr#26149)
Jakob Botsch Nielsen [Mon, 16 Sep 2019 16:36:58 +0000 (09:36 -0700)]
Improve jit tailcall decision reporting (dotnet/coreclr#26149)

* Improve jit decision reporting

On platforms with unsupported helper, report the reason why we did not
do a fast tailcall instead of the fact that no copy args thunk is
available.

* Remove an unnecessary check

* Revert an incorrect change

* Fix formatting

* Actually fix conflict

* Fix build

* [master] Update dependencies from dotnet/core-setup (dotnet/coreclr#26486)

* Update dependencies from https://github.com/dotnet/core-setup build 20190904.1

- Microsoft.NETCore.App - 5.0.0-alpha1.19454.1

* Fix print when failing to load coredistools. (dotnet/coreclr#26473)

* Restore partial Corelib build support in VS (dotnet/coreclr#26511)

* Fix formatting

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

4 years agoMore SuperIlc fixes and improvements (dotnet/coreclr#26719)
Tomáš Rylek [Mon, 16 Sep 2019 12:07:05 +0000 (05:07 -0700)]
More SuperIlc fixes and improvements (dotnet/coreclr#26719)

1) Set OutputFileName to the same value as InputFileName for
execution runs. This lets use the output file name as a common
test key for both phases.

2) Exclude Core_Root subtree in compile-subtree - this is needed
to avoid compiling Crossgen2.

3) As Anubhav pointed out, I messed up one of my previous
refactorings so that running the legacy Crossgen was no longer
optional based on the --crossgen switch.

4) I removed an unnecessary formatting string I randomly noticed.

5) Add one more classification case to execution bucketing.

Thanks

Tomas

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

4 years agoMerge pull request dotnet/coreclr#26717 from dotnet/darc-master-3fc25abf-8a12-476c...
Matt Mitchell [Sun, 15 Sep 2019 15:43:32 +0000 (08:43 -0700)]
Merge pull request dotnet/coreclr#26717 from dotnet/darc-master-3fc25abf-8a12-476c-aa6d-42a6aa19d865

[master] Update dependencies from dotnet/corefx

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

4 years agoMerge pull request dotnet/coreclr#26720 from dotnet/darc-master-235c35b1-7984-4aa9...
Matt Mitchell [Sun, 15 Sep 2019 15:42:18 +0000 (08:42 -0700)]
Merge pull request dotnet/coreclr#26720 from dotnet/darc-master-235c35b1-7984-4aa9-934a-e66ba37b92a6

[master] Update dependencies from dotnet/core-setup

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

4 years agoFixing a simple typo (dotnet/coreclr#26707)
Andrew Au [Sun, 15 Sep 2019 12:50:03 +0000 (05:50 -0700)]
Fixing a simple typo (dotnet/coreclr#26707)

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

4 years agoMark remaining counter tests as JIT sensitive (dotnet/coreclr#26708)
Sung Yoon Whang [Sun, 15 Sep 2019 08:31:08 +0000 (01:31 -0700)]
Mark remaining counter tests as JIT sensitive (dotnet/coreclr#26708)

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

4 years agoRemove some boxing from tuples with >= 8 elements (dotnet/coreclr#26584)
Stephen Toub [Sun, 15 Sep 2019 01:37:28 +0000 (21:37 -0400)]
Remove some boxing from tuples with >= 8 elements (dotnet/coreclr#26584)

Take advantage of https://github.com/dotnet/coreclr/pull/14698 to avoid boxing the TRest argument and improve devirtualization.

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

4 years agoFix watson bucketing/broken triage dumps (dotnet/coreclr#26714)
Mike McLaughlin [Sat, 14 Sep 2019 14:00:00 +0000 (07:00 -0700)]
Fix watson bucketing/broken triage dumps (dotnet/coreclr#26714)

The DAC EnumMemoryRegions needs to include some missing code version
manager memory.

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

4 years agoFix PInvoke transition frame in CPAOT (dotnet/coreclr#26706)
Tomáš Rylek [Sat, 14 Sep 2019 12:31:39 +0000 (05:31 -0700)]
Fix PInvoke transition frame in CPAOT (dotnet/coreclr#26706)

During investigation of Linux CPAOT failures Jan Vorlicek discovered
that we were using the wrong constant for the PInvoke transition
frame. I have verified that the change fixes all tests under
JIT\methodical\explicit\basic I was previously seeing; I am running
the complete Pridotnet/coreclr#1 test suite to get an overall picture.

Thanks

Tomas

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

4 years agoAdd coverage of shared code in pointer casting test (dotnet/coreclr#26715)
Michal Strehovský [Sat, 14 Sep 2019 10:52:09 +0000 (12:52 +0200)]
Add coverage of shared code in pointer casting test (dotnet/coreclr#26715)

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

4 years agoContinue cleaning GenTreeStmt. (dotnet/coreclr#26668)
Sergey Andreenko [Sat, 14 Sep 2019 07:36:09 +0000 (00:36 -0700)]
Continue cleaning GenTreeStmt. (dotnet/coreclr#26668)

* Rename `GenTreeStmt` to `Statement`.

* Move `Statements::IsPhiDefnStmt` implementation to the header.

* Add iterators for statements.

So we have less places where we access Statement's fields.

* Add a header for `fgInsertStmtListAfter`,

# Conflicts:
# src/jit/flowgraph.cpp

* Change `fgInsertStmtAtBeg` not to return a value.

and add headers for `fgInsertStmtAtBeg` and `fgNewStmtAtBeg`.

* Change `fgInsertStmtBefore` and `fgInsertStmtAfter` not to return.

* Change `fgInsertStmtNearEnd` not to return.

* Change `fgInsertStmtAtEnd` not to return.

# Conflicts:
# src/jit/flowgraph.cpp

* Fix comments.

* Add a header for `gtDispBlockStmts`.

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

4 years agoMore PAL cleanup (dotnet/coreclr#26709)
Jan Kotas [Sat, 14 Sep 2019 01:04:16 +0000 (18:04 -0700)]
More PAL cleanup (dotnet/coreclr#26709)

* Delete more unused methods from PAL

* Delete PAL_EntryPoint

* Delete always defined FEATURE_PAL_SXS and related code

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

4 years agoDelete wchar_t redefinition in the PAL (dotnet/coreclr#26705)
Jan Kotas [Fri, 13 Sep 2019 23:12:10 +0000 (16:12 -0700)]
Delete wchar_t redefinition in the PAL (dotnet/coreclr#26705)

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

4 years agoUpdate first-class-structs.md
Carol Eidt [Fri, 13 Sep 2019 21:41:47 +0000 (14:41 -0700)]
Update first-class-structs.md

Add a link to issue dotnet/coreclr#26710 in the relevant section.

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

4 years agoRe-enable incremental linking (dotnet/coreclr#26704)
Michal Strehovský [Fri, 13 Sep 2019 20:58:46 +0000 (22:58 +0200)]
Re-enable incremental linking (dotnet/coreclr#26704)

This was disabled due to a linker bug that was fixed in 2017. Maybe it's time to re-enable this.

Fixes dotnet/coreclr#13344.

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

4 years agoMatching doc update
Jan Kotas [Fri, 13 Sep 2019 16:51:01 +0000 (09:51 -0700)]
Matching doc update

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

4 years agoGet rid of unnecessary ilproj entries
Michal Strehovský [Fri, 13 Sep 2019 16:17:26 +0000 (18:17 +0200)]
Get rid of unnecessary ilproj entries

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

4 years ago[JIT/x86] Fix LinearScan::allocateRegisters (dotnet/coreclr#26649)
Konstantin Baladurin [Fri, 13 Sep 2019 17:28:08 +0000 (20:28 +0300)]
[JIT/x86] Fix LinearScan::allocateRegisters (dotnet/coreclr#26649)

Check for `lvLRACandidate` instead of `!lvDoNotEnregister` when checking whether `this` may be enregistered and has an Interval.

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

4 years agoAdd test coverage for casting to pointers (dotnet/coreclr#26698)
Michal Strehovský [Fri, 13 Sep 2019 15:47:03 +0000 (17:47 +0200)]
Add test coverage for casting to pointers (dotnet/coreclr#26698)

I was fixing a customer-reported bug related to this in .NET Native and decided to check whether there's any test coverage for this in CoreCLR. There isn't, so adding a test.

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

4 years agoImprove LclVar sorting throughput (dotnet/coreclr#23234)
mikedn [Fri, 13 Sep 2019 14:45:05 +0000 (17:45 +0300)]
Improve LclVar sorting throughput (dotnet/coreclr#23234)

* Add tracked variable accessor functions

* Delete bogus lvaSortByRefCount call

There's no need to sort at the end of lvaMarkLocalVars. Tracked variables aren't needed until liveness and that does its own sort call.

* Replace qsort with (jit)std::sort

qsort is rather cumbersome to use and inefficient. It's not a template
so it operates with void pointers that can make swapping problematic.
The comparison callback is unnecessarily complex because it has to return
-1,0,+1 when "less" style comparison functions only return true/false.
It's also impossible to inline the callback, even if it's a trivial
"return a < b;" function.

* Get rid of lvaRefSorted

While it could be slightly faster than lvaTrackedToVarNum because it stores
pointers rather than indices, it also uses more memory and it's not safe to
use beyond sorting. If new variables are added the variable table may have
to be resized and that invalidates the stored pointers.

At the same time, stop sorting untracked variables, nothing in the JIT needs
that. Collect only tracked variables in lvaTrackedToVarNum, sort them and
then "untrack" the ones that exceed the lclMAX_TRACKED limit.

* Remove bogus lvRegister checks

Variables are not sorted after LSRA has ran so these checks are not needed.

* Turn RefCntCmp/WtdRefCntCmp into real "less"

* Use functors rather than lambdas

It's too much code to put it all in the lambda so we might as well go the other way and get rid of the lambda.

* Add some comments to sort functions

* Fix comments

* Change to the real insertion sort

* Fix comments

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

4 years agoDelete dead code in PAL related to locale handling (dotnet/coreclr#26693)
Jan Kotas [Fri, 13 Sep 2019 11:33:42 +0000 (04:33 -0700)]
Delete dead code in PAL related to locale handling (dotnet/coreclr#26693)

* Delete dead code in PAL related to locale handling

* Fix build break

* Delete PAL_ACP

* Delete HAVE_COREFOUNDATION

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

4 years agoSome SuperIlc cleanup and improvements (dotnet/coreclr#26690)
Tomáš Rylek [Fri, 13 Sep 2019 08:02:41 +0000 (01:02 -0700)]
Some SuperIlc cleanup and improvements (dotnet/coreclr#26690)

1) Remove the parameter -cpaot as it's no longer needed now that
Crossgen2 also resides under Core_Root.

2) Add new parameter --exe to only execute the tests without
compilation. JanV specifically asked for this to speed up his
inner testing loop on Linux.

3) Don't pass /largeversionbubble to the [legacy] Crossgen
compilation of System.Private.CoreLib as it apparently crashes
on Linux and we are no longer interested in fixing that.

Thanks

Tomas

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

4 years agoRemove unused code in marshalnative. (dotnet/coreclr#26689)
Jeremy Koritzinsky [Fri, 13 Sep 2019 01:31:53 +0000 (18:31 -0700)]
Remove unused code in marshalnative. (dotnet/coreclr#26689)

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

4 years agoModernize Array constructor (dotnet/coreclr#26684)
Next Turn [Thu, 12 Sep 2019 19:04:57 +0000 (03:04 +0800)]
Modernize Array constructor (dotnet/coreclr#26684)

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

4 years agoRemove CLR_CMAKE_TARGET_UBUNTU_LINUX and CLR_CMAKE_PLATFORM_UBUNTU_LINUX (dotnet...
Omair Majid [Thu, 12 Sep 2019 19:03:45 +0000 (15:03 -0400)]
Remove CLR_CMAKE_TARGET_UBUNTU_LINUX and CLR_CMAKE_PLATFORM_UBUNTU_LINUX (dotnet/coreclr#26663)

They are unused. Nothing ever checks for either of them.

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

4 years agoFix SuperIlc build in CoreCLR
Tomas [Thu, 12 Sep 2019 09:36:15 +0000 (11:36 +0200)]
Fix SuperIlc build in CoreCLR

I'm not sure about the dotnetcore3.0 version but that lets me run
"dotnet blahblahblah/ReadyToRun.SuperIlc.dll and actually launch the
app. Please help me figure out what else needs fixing. I should
probably add a test at some point but I don't yet know how it should
work, I'll look into it as part of my work on the CPAOT pipeline.

Thanks

Tomas

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

4 years agoMove the ReadyToRun.SuperIlc tool to CoreCLR
dotnet-bot [Wed, 11 Sep 2019 13:40:40 +0000 (15:40 +0200)]
Move the ReadyToRun.SuperIlc tool to CoreCLR

After Michal moved the Crossgen2 compiler source code to CoreCLR,
this testing tool is the last bit that only exists in CoreRT so
I'm moving it too. This initial commit amounts to a straightforward
copy of SuperIlc source code from the CoreRT repo.

Thanks

Tomas

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

4 years agoMark counter tests as JITStress incompatible (dotnet/coreclr#26666)
Sung Yoon Whang [Thu, 12 Sep 2019 07:08:49 +0000 (00:08 -0700)]
Mark counter tests as JITStress incompatible (dotnet/coreclr#26666)

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

4 years agoImprove the performance of Environment.WorkingSet in Windows (dotnet/coreclr#26522)
Sung Yoon Whang [Thu, 12 Sep 2019 01:28:35 +0000 (18:28 -0700)]
Improve the performance of Environment.WorkingSet in Windows (dotnet/coreclr#26522)

* Use win32 api directly for workingset counter

* Fix build warnings

* Removing useless code

* more cleanup

* remove size annotation

* remove useless comment

* Move all the changes to Environment.WorkingSet and remove it from RuntimeEventSourceHelper

* removing useless usings

* Use kernel32.dll instead of psapi.dll

* Code review feedback

* Remove newline change

* More code review nits

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

4 years agoOnly check out the GIT repo twice and reuse for the entire pipeline (dotnet/coreclr...
Tomáš Rylek [Wed, 11 Sep 2019 18:21:41 +0000 (11:21 -0700)]
Only check out the GIT repo twice and reuse for the entire pipeline (dotnet/coreclr#26480)

The purpose of this change is to increase the throughput and
reliability of CoreCLR CI pipelines by only performing one GIT
checkout for Windows and Unix, zip them up and reuse for all
subsequent phases / jobs in the pipeline.

Thanks

Tomas

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

4 years agoChange Vector<T> to use more compact code using S.R.CS.Unsafe (dotnet/coreclr#26637)
Jan Kotas [Wed, 11 Sep 2019 14:02:21 +0000 (07:02 -0700)]
Change Vector<T> to use more compact code using S.R.CS.Unsafe (dotnet/coreclr#26637)

S.R.CS.Unsafe is used in number of places in Vector<T> already. This change modifies more places to use it to make the code more compact.

Updated Vector.tt template to match while I was on it

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

4 years agoReturn a missed field init to `GenTreeILOffset`. (dotnet/coreclr#26646)
Sergey Andreenko [Wed, 11 Sep 2019 04:35:18 +0000 (21:35 -0700)]
Return a missed field init to `GenTreeILOffset`. (dotnet/coreclr#26646)

That field is used only in dumping logic inside `genCodeForBBlist`, for some reason `gtDispTree` doesn't print it.

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

4 years agoRemove unused Memcpy methods from shared Buffer implementation (dotnet/coreclr#26586)
Marek Safar [Wed, 11 Sep 2019 00:16:06 +0000 (02:16 +0200)]
Remove unused Memcpy methods from shared Buffer implementation (dotnet/coreclr#26586)

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

4 years agoResource writing for crossgen2 (dotnet/coreclr#26639)
David Wrighton [Tue, 10 Sep 2019 23:18:02 +0000 (16:18 -0700)]
Resource writing for crossgen2 (dotnet/coreclr#26639)

- Refactor the win32 resource reading code to use more natural managed data structures
- Build a Win32 resource emitter on top of refactored data structures
- Replace resource section copy logic with new node to generate win32 resources

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

4 years agoManually marshal parameters for EventPipeInternal.Enable. (dotnet/coreclr#26496)
Jeremy Koritzinsky [Tue, 10 Sep 2019 22:33:38 +0000 (15:33 -0700)]
Manually marshal parameters for EventPipeInternal.Enable. (dotnet/coreclr#26496)

* Manually marshal parameters for EventPipeInternal.Enable.

* Update src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipe.cs

Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/db04a9afd990091e2b6b7bbeb938ed731fbcdba5

4 years ago[test] Mark EventPipe tests JITStress Incompatible and Partially GC Stress Incompatib...
John Salem [Tue, 10 Sep 2019 22:17:09 +0000 (15:17 -0700)]
[test] Mark EventPipe tests JITStress Incompatible and Partially GC Stress Incompatible (dotnet/coreclr#26606)

* Mark all EventPipe tests as JitOptimizationSensitive
* Mark EventPipe GC tests as GCStressIncompatible
* Reduce number of GCs triggered for EventPipe GC tests to make them more diagnosable in the event of failure

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

4 years agoImprove logging for EventSource.WriteEvent parameter mismatch (dotnet/coreclr#25533)
obligaron [Tue, 10 Sep 2019 20:22:53 +0000 (22:22 +0200)]
Improve logging for EventSource.WriteEvent parameter mismatch (dotnet/coreclr#25533)

* improve logging for EventSource.WriteEvent

* Fix IndexOutOfRangeException in SerializeEventArgs when incorrect arguments got passed

* simplify arg-check; remove nullable-todo

* switch from Debugger.Log to ReportOutOfBandMessage

* Remove unused flush-Paramater from ReportOutOfBandMessage

* fix parameter type nullable-check for reference-types

* fix parameter type nullable-check for nullable-types

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

4 years agoRefactor osGroup / osIdentifier pairs to osGroup / osSubgroup (dotnet/coreclr#26583)
Tomáš Rylek [Tue, 10 Sep 2019 19:52:28 +0000 (12:52 -0700)]
Refactor osGroup / osIdentifier pairs to osGroup / osSubgroup (dotnet/coreclr#26583)

Refactor osGroup / osIdentifier pairs to osGroup / osSubgroup

This simple cleanup removes the duplication between osGroup and
osIdentifier by switching over to use the pair osGroup and osSubgroup
such that the final OS identifier is a plain concatenation of osGroup
and osSubgroup. As the only currently supported OS flavors using
OS subgroups are Linux_musl and Linux_rhel6, this simplifies the
platform-matrix.yml and related scripts overall.

Thanks

Tomas

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

4 years agoFix Running .NET Core Under Windows App Compat Shim (dotnet/coreclr#26605)
Tarek Mahmoud Sayed [Tue, 10 Sep 2019 18:42:25 +0000 (11:42 -0700)]
Fix Running .NET Core Under Windows App Compat Shim (dotnet/coreclr#26605)

* Fix Running .NET Core Under Winndows App Compat Shim

.NET Core uses Windows features called sort handles for perf reason to speed up the collation operations (e.g. string comparisons). When enabling Windows app compat shim (e.g. Windows 7 compatibility mode), the calls uses sort handles will fail which cause all collation operations to fail.
The fix here is to detect if the sort handles work before using it to ensure successful run.

* Address the feedback

* More feedback addressing

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

4 years agoDelete dead code and fix issues found by static analysis tools (dotnet/coreclr#26604)
Jan Kotas [Tue, 10 Sep 2019 03:52:10 +0000 (20:52 -0700)]
Delete dead code and fix issues found by static analysis tools (dotnet/coreclr#26604)

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

4 years agoRemove use of WeakReference from corelib (dotnet/coreclr#26597)
Stephen Toub [Tue, 10 Sep 2019 01:10:07 +0000 (21:10 -0400)]
Remove use of WeakReference from corelib (dotnet/coreclr#26597)

Only remaining use is the one place it shows up in public API, in GC.GetGeneration(WeakReference).

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

4 years agoMake StringComparer.Create throw ArgumentNullException (dotnet/coreclr#26570)
Tyler Brinkley [Tue, 10 Sep 2019 01:08:53 +0000 (20:08 -0500)]
Make StringComparer.Create throw ArgumentNullException (dotnet/coreclr#26570)

* Make StringComparer.Create throw ArgumentNullException

Throws proper exception.

* Update CoreFX.issues.rsp

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

4 years agoRemove remaining ToLower() use from corelib (dotnet/coreclr#26602)
Stephen Toub [Tue, 10 Sep 2019 01:07:56 +0000 (21:07 -0400)]
Remove remaining ToLower() use from corelib (dotnet/coreclr#26602)

Also happens to save a string allocation, but that's a drop in the bucket in this function.

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

4 years agoRemove sub-array allocation from GetManifestResourceNamesList (dotnet/coreclr#26601)
Stephen Toub [Tue, 10 Sep 2019 01:07:44 +0000 (21:07 -0400)]
Remove sub-array allocation from GetManifestResourceNamesList (dotnet/coreclr#26601)

Also removes dependency on System.Range and RuntimeHelpers.GetSubArray in a simple console app such that they can be trimmed away.

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

4 years agoRemove Lazy/LazyInitializer from mscorlib.h (dotnet/coreclr#26603)
Stephen Toub [Tue, 10 Sep 2019 01:07:33 +0000 (21:07 -0400)]
Remove Lazy/LazyInitializer from mscorlib.h (dotnet/coreclr#26603)

We do not need to special-case these types for reflection invocation, and doing so is currently keeping them from being trimmed when not otherwise used.

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

4 years agoAbort FuncEval on unaligned SP (dotnet/coreclr#26572)
Steve MacLean [Mon, 9 Sep 2019 23:43:27 +0000 (19:43 -0400)]
Abort FuncEval on unaligned SP (dotnet/coreclr#26572)

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

4 years agoFix the loop iterator in `CheckNoTransformableIndirectCallsRemain`. (dotnet/coreclr...
Sergey Andreenko [Mon, 9 Sep 2019 23:36:06 +0000 (16:36 -0700)]
Fix the loop iterator in `CheckNoTransformableIndirectCallsRemain`. (dotnet/coreclr#26599)

The error was made in 2017 https://github.com/dotnet/coreclr/commit/dotnet/coreclr@654fed28001085adc162de1ea3207e9a22230235.

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

4 years agoAdd a check to ensure that there are not any zombied Diagnostics IPC sockets on Linux...
John Salem [Mon, 9 Sep 2019 18:32:48 +0000 (11:32 -0700)]
Add a check to ensure that there are not any zombied Diagnostics IPC sockets on Linux and error in a readable manner if we are unable to clean them up before running the test (dotnet/coreclr#26573)

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

4 years agoRemove unused CMake command to build native test assets as par… (dotnet/coreclr#26454)
Jeremy Koritzinsky [Mon, 9 Sep 2019 18:14:48 +0000 (11:14 -0700)]
Remove unused CMake command to build native test assets as par… (dotnet/coreclr#26454)

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

4 years agoStop using LIST nodes for CALL arg lists (dotnet/coreclr#26392)
mikedn [Mon, 9 Sep 2019 17:09:17 +0000 (20:09 +0300)]
Stop using LIST nodes for CALL arg lists (dotnet/coreclr#26392)

* Stop using GT_LIST in GenTreeCall

* Clarify optAssertionGenJtrue code

* Cleanup optCreateAssertion

* Cleanup AddHiddenArgument

* Cleanup impInlineIsGuaranteedThisDerefBeforeAnySideEffects

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

4 years agoMove TypedReference::SetTypedReference exception throw to managed (dotnet/coreclr...
Marek Safar [Mon, 9 Sep 2019 16:58:25 +0000 (18:58 +0200)]
Move TypedReference::SetTypedReference exception throw to managed (dotnet/coreclr#26596)

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

4 years agoAdd project files
Michal Strehovský [Wed, 4 Sep 2019 16:03:14 +0000 (18:03 +0200)]
Add project files

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

4 years agoDo not precompile crossgen2
Michal Strehovský [Fri, 6 Sep 2019 14:48:52 +0000 (16:48 +0200)]
Do not precompile crossgen2

build-test.cmd limits precompilation to things that are directly in CORE_ROOT. We should do the same on Unix.

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

4 years agoExclude crossgen2 from CoreCLR test dependencies
Tomas [Sat, 7 Sep 2019 18:10:33 +0000 (20:10 +0200)]
Exclude crossgen2 from CoreCLR test dependencies

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

4 years agoInitial population of crossgen2 sources from CoreRT repo as of commit dotnet/coreclr...
dotnet-bot [Mon, 9 Sep 2019 08:37:58 +0000 (10:37 +0200)]
Initial population of crossgen2 sources from CoreRT repo as of commit dotnet/coreclr@48b4932a57a8aa3a2be45560ac9cac51003dd8b3

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

4 years agoLinux/x86: fix build (dotnet/coreclr#26594)
Konstantin Baladurin [Mon, 9 Sep 2019 15:40:14 +0000 (00:40 +0900)]
Linux/x86: fix build (dotnet/coreclr#26594)

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

4 years agoReplace HashHelpers.Combine with HashCode.Combine (dotnet/coreclr#26589)
Stephen Toub [Mon, 9 Sep 2019 13:50:16 +0000 (09:50 -0400)]
Replace HashHelpers.Combine with HashCode.Combine (dotnet/coreclr#26589)

* Replace HashHelpers.Combine with HashCode.Combine

* Address PR feedback

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

4 years agoMark unsafe intrinsics as reflection blocked
Michal Strehovský [Sun, 8 Sep 2019 20:00:18 +0000 (22:00 +0200)]
Mark unsafe intrinsics as reflection blocked

Keeping these reflection enabled pulls in quite a bit of junk (generic dictionaries, standalone method bodies, bookkeeping) that adds up to 1.5% of the size of Hello World...

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

4 years agoFix race conditions in CultureInfo.GetCultureInfoHelper (dotnet/coreclr#26567)
Stephen Toub [Sat, 7 Sep 2019 14:47:49 +0000 (10:47 -0400)]
Fix race conditions in CultureInfo.GetCultureInfoHelper (dotnet/coreclr#26567)

The implementation reads the current value of the static cache field and then later overwrites that field with the originally read value.  If ClearCachedData was called in the interim to clear the cached data, this will end up effectively undoing part of that clearing, as it'll end up restoring the previous cache. The fix is to write back the new reference only when we need to, which we could do when we detect it's null.

There's a secondary race condition this fixes as well.  When a name and an altname are used with CultureInfo.GetCurrentCulture(string, string), the implementation was publishig the newly created instance into the dictionary under the lock, but then after the lock was released, it was setting that TextInfo to be read-only.  That provides a window where another thread could see it as non-read-only and mutate it.  The fix is to ensure it's marked as read-only fully before it's published.

As I was doing this, it struck me that the implementation was overly complicated, trying to merge three different code paths for three different callers, presumably to share code, but most of the code ended up not being shared anyway, which just made the code harder to follow for little gain.  So, I split it back out into the three calling functions and removed the helper.

I also changed the locking mechanism.  It had been using a single shared lock to protect all state, but the purpose of the lock is really just to synchronize access to an individual dictionary, so we can just lock on the relevant dictionary.

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

4 years agoAdd a repro for GitHub_26311. (dotnet/coreclr#26553)
Sergey Andreenko [Sat, 7 Sep 2019 08:35:59 +0000 (01:35 -0700)]
Add a repro for GitHub_26311. (dotnet/coreclr#26553)

* Add a repro for GitHub_26311.

Add an IL test that reproduces GitHub_26311 without using external functions and stress modes.
The test uses tail call opcode to force tail call to VSD over generic class via a slow helper.

* Exclude the test for windows x64.

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

4 years agoFix IDE0026 (use expression-bodied members for indexers)
Stephen Toub [Thu, 5 Sep 2019 21:15:13 +0000 (17:15 -0400)]
Fix IDE0026 (use expression-bodied members for indexers)

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

4 years agoUse null coalescing assignment operator in more places
Stephen Toub [Thu, 5 Sep 2019 14:12:31 +0000 (10:12 -0400)]
Use null coalescing assignment operator in more places

There's currently no auto-fix for this, so the fixes were done manually.

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

4 years agoRemove stale SuppressMessage attributes (dotnet/coreclr#26501)
Stephen Toub [Fri, 6 Sep 2019 13:08:45 +0000 (09:08 -0400)]
Remove stale SuppressMessage attributes (dotnet/coreclr#26501)

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

4 years agoRemove unnecessary file handle parameter in PEImageLayout methods (dotnet/coreclr...
Vitek Karas [Fri, 6 Sep 2019 10:59:09 +0000 (03:59 -0700)]
Remove unnecessary file handle parameter in PEImageLayout methods (dotnet/coreclr#26530)

The handle is always the owner's PEImage->GetFileHandle, and so the PEImageLayout can call that instead of passing it around through parameters.

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

4 years agoFix broken float compare mapping to VNFunc (dotnet/coreclr#20782)
mikedn [Thu, 5 Sep 2019 19:35:32 +0000 (22:35 +0300)]
Fix broken float compare mapping to VNFunc (dotnet/coreclr#20782)

* Fix broken float compare mapping to VNFunc

The existing code uses GTF_UNSIGNED instead of GTF_RELOP_NAN_UN to select unordered VN funcs.

* Rename relopFuncs

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

4 years agoPull struct type info out of GenTreeObj (dotnet/coreclr#21705)
mikedn [Thu, 5 Sep 2019 18:10:30 +0000 (21:10 +0300)]
Pull struct type info out of GenTreeObj (dotnet/coreclr#21705)

* Introduce ClassLayout

* Delete unused getStructGcPtrsFromOp

* Use ClassLayout in GenTreeObj/Blk

* Use ClassLayout in LclVarDsc

* Remove layout info from GenTreePutArgStk

* Always initialze ClassLayout GC layout

* Make ClassLayout::GetGCPtrs private

* Restore genAdjustStackForPutArgStk asserts

* Comments

* Put layout related code in new files

* More comments and small tweaks

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

4 years agoFixes around the GetModuleIfLoaded and related APIs (dotnet/coreclr#26516)
Fadi Hanna [Thu, 5 Sep 2019 17:35:04 +0000 (10:35 -0700)]
Fixes around the GetModuleIfLoaded and related APIs (dotnet/coreclr#26516)

* Enabling precompiled generics to be loaded from the root entrypoint R2R module.

Include R2RDump tool changes that match the CoreRT cross module signatures in the instantiations table

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

4 years agoAdd 3 EventPipe tests about GC (dotnet/coreclr#26429)
jiangzeng01 [Thu, 5 Sep 2019 16:29:30 +0000 (00:29 +0800)]
Add 3 EventPipe tests about GC (dotnet/coreclr#26429)

* Add 3 EventPipe tests about GC

* Set eventpipe tests priority to 1

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

4 years agoGC long running tests (dotnet/coreclr#26489)
Vladimir Sadov [Thu, 5 Sep 2019 13:17:25 +0000 (06:17 -0700)]
GC long running tests (dotnet/coreclr#26489)

* - add gc-longrunning   pipeline to run GC long running tests.
- make GC reliability framework one of GC long running tests.

* Temporarily enable Win10.ARM64  helix queue - for this PR only

* increase timeouts

* fewer inner cycles per one iteration in slower tests.

* Final touches - increase GC reliability Framework timeout to 60min.
remove Windows.10.Arm64.Open from the platform matrix (was added temporarily just to test this PR)

* Disable ARM for now.

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

4 years agoAdd regularly scheduled runs for additional pipelines (dotnet/coreclr#26515)
Bruce Forstall [Thu, 5 Sep 2019 00:37:13 +0000 (17:37 -0700)]
Add regularly scheduled runs for additional pipelines (dotnet/coreclr#26515)

Pipelines: jitstress-isas-arm, jitstress-isas-x86, jitstressregs-x86.

Only once per week currently, on weekends.

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

4 years agoImprove eventcounter test (dotnet/coreclr#26517)
Sung Yoon Whang [Thu, 5 Sep 2019 00:16:06 +0000 (17:16 -0700)]
Improve eventcounter test (dotnet/coreclr#26517)

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

4 years agoDon't use code rejitted at tier 1 when the JIT falls back to min-opts due to method...
Koundinya Veluri [Wed, 4 Sep 2019 18:23:37 +0000 (11:23 -0700)]
Don't use code rejitted at tier 1 when the JIT falls back to min-opts due to method size/complexity (dotnet/coreclr#26503)

Fixes https://github.com/dotnet/coreclr/issues/26419

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

4 years agoRemove unnecessary !s for [DoesNotReturn] (dotnet/coreclr#26512)
Next Turn [Wed, 4 Sep 2019 18:22:25 +0000 (02:22 +0800)]
Remove unnecessary !s for [DoesNotReturn] (dotnet/coreclr#26512)

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

4 years agoFix StyleCop tuple warnings (dotnet/coreclr#26514)
Stephen Toub [Wed, 4 Sep 2019 17:57:13 +0000 (13:57 -0400)]
Fix StyleCop tuple warnings (dotnet/coreclr#26514)

A few PRs crossed such that PR validation passed but master is issuing lots of warnings-as-errors.

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

4 years agoRestore partial Corelib build support in VS (dotnet/coreclr#26511)
Stephen Toub [Wed, 4 Sep 2019 17:16:07 +0000 (13:16 -0400)]
Restore partial Corelib build support in VS (dotnet/coreclr#26511)

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

4 years agoFix print when failing to load coredistools. (dotnet/coreclr#26473)
Austin Wise [Wed, 4 Sep 2019 17:04:23 +0000 (10:04 -0700)]
Fix print when failing to load coredistools. (dotnet/coreclr#26473)

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

4 years agoRefactor tailcall decisions out of fgMorphCall (dotnet/coreclr#26158)
Jakob Botsch Nielsen [Wed, 4 Sep 2019 16:32:41 +0000 (09:32 -0700)]
Refactor tailcall decisions out of fgMorphCall (dotnet/coreclr#26158)

* Refactor tailcall decisions out of fgMorphCall

Introduce fgMorphPotentialTailCall to simplify the control flow of
tailcall morph.

* Fix formatting

* Some minor fixes including build break fix

* Set tailcalls to void return type again

Missed change during the refactoring

* Fix formatting again

* Fix formatting again again

* Add some helpful comments

* Return new node for finished morph instead

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

5 years agoFix several recently added StyleCop tuple rules (dotnet/corefxdotnet/coreclr#40794)
Stephen Toub [Wed, 4 Sep 2019 03:51:50 +0000 (23:51 -0400)]
Fix several recently added StyleCop tuple rules (dotnet/corefxdotnet/coreclr#40794)

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

5 years agoRemove `readonly` from GCHandle field on Gen2GcCallback (dotnet/coreclr#26509)
Stephen Toub [Wed, 4 Sep 2019 15:58:36 +0000 (11:58 -0400)]
Remove `readonly` from GCHandle field on Gen2GcCallback (dotnet/coreclr#26509)

GCHandle is mutable, and this type does call Free on the handle, but with it marked as readonly, the mutations performed by Free will be done on a copy rather than on the original.

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

5 years agoUse expression-bodied members in more places (dotnet/coreclr#26500)
Stephen Toub [Wed, 4 Sep 2019 15:21:59 +0000 (11:21 -0400)]
Use expression-bodied members in more places (dotnet/coreclr#26500)

* Fix IDE0027 (use expression body for accessors)

* Fix IDE0023 / IDE0024 (use expression body for operators)

* Apply suggestions from code review

Co-Authored-By: Adam Sitnik <adam.sitnik@gmail.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/7b9509e01b9e1f840b990c56f5b4dfce33002896

5 years agoImproveComments - making sure the comment is accurately describing the code (dotnet...
Andrew Au [Wed, 4 Sep 2019 14:27:23 +0000 (07:27 -0700)]
ImproveComments - making sure the comment is accurately describing the code (dotnet/coreclr#26442)

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

5 years agoUpdate StyleCop.Analyzers to same verison used by corefx (dotnet/coreclr#26499)
Stephen Toub [Wed, 4 Sep 2019 13:19:57 +0000 (09:19 -0400)]
Update StyleCop.Analyzers to same verison used by corefx (dotnet/coreclr#26499)

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

5 years agoUpdate analyzer versions (dotnet/corefxdotnet/coreclr#40778)
Stephen Toub [Tue, 3 Sep 2019 22:07:33 +0000 (18:07 -0400)]
Update analyzer versions (dotnet/corefxdotnet/coreclr#40778)

In particular to pick up StyleCop fixes related to C# 8 and nullability.

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

5 years agoAvoid some unnecessary initialization in DateTimeParse (dotnet/coreclr#26487)
Stephen Toub [Tue, 3 Sep 2019 21:07:30 +0000 (17:07 -0400)]
Avoid some unnecessary initialization in DateTimeParse (dotnet/coreclr#26487)

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

5 years agoRemove unnecessary parens from `return (true);` and `return (false);` (dotnet/coreclr...
Stephen Toub [Tue, 3 Sep 2019 21:01:52 +0000 (17:01 -0400)]
Remove unnecessary parens from `return (true);` and `return (false);` (dotnet/coreclr#26488)

Just a search and replace.

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

5 years agoRefactor BinaryReader.ReadChars using Span (dotnet/coreclr#26325)
Jan Kotas [Tue, 3 Sep 2019 21:00:45 +0000 (14:00 -0700)]
Refactor BinaryReader.ReadChars using Span (dotnet/coreclr#26325)

Avoids unsafe code and makes the code simpler

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

5 years agoRefactor call counting for tiering and some other things (dotnet/coreclr#26393)
Koundinya Veluri [Tue, 3 Sep 2019 17:38:01 +0000 (10:38 -0700)]
Refactor call counting for tiering and some other things (dotnet/coreclr#26393)

Refactor call counting for tiering and some other things

- Moved call counting to after jitting is done, when the tier of the code becomes clear. Passed info back about whether the method should be recorded for call counting through the `PrepareCodeConfig` to avoid some more expensive rechecks.
- Moved checks for aggressive optimization and QuickJit to the point when JIT flags are determined
- Specialized `PublishVersionalbeCodeIfNecessary` for methods versionable with and without a jump stamp
- Added fast paths for cases operating on the default native code version to avoid code versioning overhead during startup
- Methods are not counted on first call, only recorded for counting later. First call to a method is determined by whether the thread generated or loaded code for the method. Threads that wait for jitting to complete don't count calls either. Once the method already has native code and goes through the prestub, its calls are counted.
- Overall, time spent in DoPrestub decreased noticeably when tiering is enabled, almost the same as with tiering disabled typically. Small improvement to startup time, seems to decrease by a few milliseconds.
- Fixed a bug where, when call counting for a method stops due to the tiering delay being activated, it was extending the delay as though it were the first call to the method
  - This was noticably increasing time taken to reach steady-state perf by keeping the delay active for longer than necessary. After the fix, steady-state perf is reached sooner without any noticeable overhead in-between.
  - A fix creates a potential race between thread A recording a method to be counted later, thread B resetting the method's entry point for counting calls, then thread A setting the tier 0 code as the entry point, and the method would not be tiered up. For now I decided to stop call counting only when a flag that would extend the delay timer is set, with other planned work this code and issue would go away.
- Miscellaneous small changes

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

5 years agoModify amd64walker to use table based decode (dotnet/coreclr#25958)
Steve MacLean [Tue, 3 Sep 2019 16:31:54 +0000 (12:31 -0400)]
Modify amd64walker to use table based decode (dotnet/coreclr#25958)

* Modify amd64walker to use table based decode

Use tables for NativeWalker::DecodeInstructionForPatchSkip()
Also files used to generate the decode tables in doc folder.

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

5 years agoKeep tokenScope consistent during devirtualization (dotnet/coreclr#26453)
Tomáš Rylek [Mon, 2 Sep 2019 20:35:32 +0000 (22:35 +0200)]
Keep tokenScope consistent during devirtualization (dotnet/coreclr#26453)

Previously, when we were constructing the CORINFO_RESOLVED_TOKEN
to represent a devirtualized method, we reused the previous
tokenScope so that the tokenScope effectively went out of sync
with the token value.

Based on Andy's advice I have changed this logic to update the
tokenScope by calling the JIT interface method getMethodModule
for the resolved virtual method. I have verified locally that
(with a bit of counterpart CPAOT changes) this logic fixes the
bug I was previously hitting due to this inconsistency.

Thanks

Tomas

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

5 years ago[master] Update dependencies from dotnet/corefx (dotnet/coreclr#26446)
dotnet-maestro[bot] [Sun, 1 Sep 2019 10:37:25 +0000 (03:37 -0700)]
[master] Update dependencies from dotnet/corefx (dotnet/coreclr#26446)

* Update dependencies from https://github.com/dotnet/corefx build 20190831.1

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19431.1
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19431.1

* 3.0 -> 5.0

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