platform/upstream/coreclr.git
6 years agoMerge pull request #13597 from CarolEidt/InfoLinearScan
Carol Eidt [Mon, 28 Aug 2017 00:31:09 +0000 (17:31 -0700)]
Merge pull request #13597 from CarolEidt/InfoLinearScan

Move TreeNodeInfoInit to LinearScan

6 years agoMerge pull request #13581 from noahfalk/fix_corefx_testing
Noah Falk [Sun, 27 Aug 2017 22:46:53 +0000 (15:46 -0700)]
Merge pull request #13581 from noahfalk/fix_corefx_testing

Fix running corefx tests

6 years agoMerge pull request #13411 from pgavlin/RepriTests
Pat Gavlin [Sat, 26 Aug 2017 17:34:40 +0000 (10:34 -0700)]
Merge pull request #13411 from pgavlin/RepriTests

Reprioritize tests to improve inner-loop throughput.

6 years agoUse CreateFile2 instead of CreateFile2FromApp (#13595) (#13607)
Santiago Fernandez Madero [Sat, 26 Aug 2017 04:39:19 +0000 (23:39 -0500)]
Use CreateFile2 instead of CreateFile2FromApp (#13595) (#13607)

* Use CreateFile2 instead of CreateFile2FromApp

* Feedback fixes

6 years agoMerge pull request #13579 from CarolEidt/RemoveDupLowerBlockStore
Carol Eidt [Sat, 26 Aug 2017 00:05:10 +0000 (17:05 -0700)]
Merge pull request #13579 from CarolEidt/RemoveDupLowerBlockStore

Arm Containment Cleanup

6 years agoDelete superfluous check in funceval.cpp (#13598)
Jan Kotas [Fri, 25 Aug 2017 23:51:45 +0000 (16:51 -0700)]
Delete superfluous check in funceval.cpp (#13598)

Func-eval'ing BCL methods with the DynamicSecurityMethod attribute causes an ArgumentException.

6 years agoMinor performance infrastructure changes. (#13557)
José Rivero [Fri, 25 Aug 2017 23:26:45 +0000 (16:26 -0700)]
Minor performance infrastructure changes. (#13557)

- IlLink scenario will run on a VM (currently it is only measuring MSIL size)
- Updated the patterns of files to search for on scenario runs
- Updated the JitBench commit hash being used ()
- Disable min_opt from the PR correctness mode.
- String was not being interpolated.

6 years agoFix generic context passed to resolved constrained method calls (#13577)
Michal Strehovský [Fri, 25 Aug 2017 23:09:47 +0000 (16:09 -0700)]
Fix generic context passed to resolved constrained method calls (#13577)

If the EE was able to resolve a constrained call, the instantiating
parameter to use is the type by which the call was constrained with. We
embed pConstrainedResolvedToken as the extra argument because
pResolvedToken is an interface method and interface types make a poor
generic context.

The CLR doesn't hit this path because these types of constrained method
calls go through an instantiating stub. We don't do instantiating stubs
in CoreRT.

6 years ago[Arm64/Unix] Add JIT_Stelem_Ref helper (#13588)
Steve MacLean [Fri, 25 Aug 2017 22:10:50 +0000 (18:10 -0400)]
[Arm64/Unix] Add JIT_Stelem_Ref helper (#13588)

6 years agoCreate deep-dive-blog-posts.md (#13336)
Matt Warren [Fri, 25 Aug 2017 21:46:55 +0000 (22:46 +0100)]
Create deep-dive-blog-posts.md (#13336)

6 years agoPR Feedback and formatting
Carol Eidt [Fri, 25 Aug 2017 21:33:49 +0000 (14:33 -0700)]
PR Feedback and formatting

6 years agoMove TreeNodeInfoInit to LinearScan
Carol Eidt [Fri, 25 Aug 2017 20:36:43 +0000 (13:36 -0700)]
Move TreeNodeInfoInit to LinearScan

In preparation for computing the TreeNodeInfo on the fly, move all the TreeNodeInfoInit and related methods to the LinearScan class.

6 years agoDon't multiply YieldProcessor count by proc count (#13556)
Koundinya Veluri [Fri, 25 Aug 2017 20:14:59 +0000 (13:14 -0700)]
Don't multiply YieldProcessor count by proc count (#13556)

Related to issue mentioned in https://github.com/dotnet/coreclr/issues/13388
- Multipying the YieldProcessor count by proc count can cause excessive delays that are not fruitful on machines with a large number of procs. Even on a 12-proc machine (6-core), the heuristics as they are without the multiply seem to perform much better.
- The issue above also mentions that the delay of PAUSE on Intel Skylake+ processors have a significantly larger delay (140 cycles vs 10 cycles). Simulating that by multiplying the YieldProcessor count by 14 shows that in both tests tested, it begins crawling at low thread counts.
- I did most of the testing on ManualResetEventSlim, and since Task is using the same spin heuristics, applied the same change there as well.

6 years agoPR Feedback
Carol Eidt [Fri, 25 Aug 2017 18:10:32 +0000 (11:10 -0700)]
PR Feedback

6 years agoRemove Span(T[], int) ctor (#13575)
Ahson Ahmed Khan [Fri, 25 Aug 2017 17:29:31 +0000 (10:29 -0700)]
Remove Span(T[], int) ctor (#13575)

* Remove Span(T[], int) ctor - from issue #23471

6 years agoUse Span-based TryParse in several globalization types (#13582)
Stephen Toub [Fri, 25 Aug 2017 17:28:19 +0000 (13:28 -0400)]
Use Span-based TryParse in several globalization types (#13582)

6 years agoMerge pull request #13586 from parjong/fix/ClrStack_full
Bruce Forstall [Fri, 25 Aug 2017 17:20:34 +0000 (10:20 -0700)]
Merge pull request #13586 from parjong/fix/ClrStack_full

[ARM/Linux] Enable clrstack -f

6 years agoDo not devirtualize indirect calls (#13561)
Michal Strehovský [Fri, 25 Aug 2017 16:28:21 +0000 (09:28 -0700)]
Do not devirtualize indirect calls (#13561)

I'm seeing the affected code take the `impDevirtualizeCall` code path
with `CT_INDIRECT` calls. `gtCallMethHnd` is a `GenTreePtr` in that case
(it's a union) and passing that as as `CORINFO_METHOD_HANDLE` leads
to bad things.

6 years agoMerge pull request #13245 from pgavlin/NoExpandIndex
Pat Gavlin [Fri, 25 Aug 2017 16:18:30 +0000 (09:18 -0700)]
Merge pull request #13245 from pgavlin/NoExpandIndex

Use a smaller expansion of GT_INDEX in MinOpts.

6 years agoArm Containment Cleanup
Carol Eidt [Thu, 24 Aug 2017 20:21:28 +0000 (13:21 -0700)]
Arm Containment Cleanup

- Fix a couple of issues with TreeNodeInfoInit for struct arguments
- Remove duplicate calls to LowerBlockStore from TreeNodeInfoInit for arm and arm64
- Eliminate duplicative isMultiReg method from GenTree and fix condition for OperIsMultiRegOp()

6 years agoMerge pull request #13584 from wateret/fix-armel-treenodeinfoinit
Carol Eidt [Fri, 25 Aug 2017 14:46:09 +0000 (07:46 -0700)]
Merge pull request #13584 from wateret/fix-armel-treenodeinfoinit

[RyuJIT/armel] Fix ifdef block in TreeNodeInfoInit

6 years agoEnable clrstack -f in ARM/Linux
Jonghyun Park [Fri, 25 Aug 2017 07:42:44 +0000 (16:42 +0900)]
Enable clrstack -f in ARM/Linux

6 years ago[RyuJIT/armel] Fix ifdef block in TreeNodeInfoInit
Hanjoung Lee [Fri, 25 Aug 2017 06:49:38 +0000 (15:49 +0900)]
[RyuJIT/armel] Fix ifdef block in TreeNodeInfoInit

6 years agoMerge pull request #13506 from mikedn/switch-un
Carol Eidt [Fri, 25 Aug 2017 04:54:56 +0000 (21:54 -0700)]
Merge pull request #13506 from mikedn/switch-un

Fix switch unsigned cast

6 years agoRemove uses of the {RO}Span ctor that takes an array and offset (#13578)
Ahson Ahmed Khan [Fri, 25 Aug 2017 04:46:45 +0000 (21:46 -0700)]
Remove uses of the {RO}Span ctor that takes an array and offset (#13578)

6 years agoFix running corefx tests
noahfalk [Fri, 25 Aug 2017 04:02:41 +0000 (21:02 -0700)]
Fix running corefx tests

Running CoreFX tests was supposed to use a batch file (env_script) to run CoreFX tests under different environment configurations. However due to subtlties in how the command line is parsed none of the environment variables set by this script would actually persist for the execution of the tests. As best I can tell prior to this fix specifying a env_script had no effect whatsoever on windows, and our CI corefx test stress scenarios weren't actually testing the scenario they claimed to be testing.

cmd /c "Set.bat&&Check.bat" will propagate env vars set in Set.bat so that they are visible in Check.bat because both batch files execute within the context of the newly invoked cmd.exe process. However cmd /c Set.bat&&Check.bat (no quotes) will run Set.bat in its own cmd.exe process, then exit that process and run Check.bat in the parent shell process. The parent process does not have any environment variable changes that were made by Set.bat.

6 years agoRemove unnecessary buffer copy from EventPipe::WriteEvent pipeline (#13347)
Victor "Nate" Graf [Thu, 24 Aug 2017 22:13:49 +0000 (15:13 -0700)]
Remove unnecessary buffer copy from EventPipe::WriteEvent pipeline (#13347)

* [WIP] Eliminate extra buffer copy with new api path

* Copy blobs to a flat buffer is Rundown is on

* Refactor to use payload class and dedupe code

* Add contracts

* Fix many small errors

* Make names unambiguous

* Add EventPipe::WriteEventBlob to ecalllist.h

* Address code review

* Add test and fix a buffer copy bug

* Copy data instead of data pointer

* Add optional output file arg to tests

* Change failure return code

* Renamed variables for clarity

6 years agoMerge pull request #13573 from noahfalk/add_ci_logging
Noah Falk [Thu, 24 Aug 2017 21:47:18 +0000 (14:47 -0700)]
Merge pull request #13573 from noahfalk/add_ci_logging

Makes sure the CI archiving runs even on failure

6 years agoMakes sure the archiving runs even on failure
noahfalk [Thu, 24 Aug 2017 21:19:45 +0000 (14:19 -0700)]
Makes sure the archiving runs even on failure

6 years agoFix switch unsigned cast
Mike Danes [Mon, 21 Aug 2017 20:21:52 +0000 (23:21 +0300)]
Fix switch unsigned cast

6 years agoAddress PR feedback.
Pat Gavlin [Thu, 24 Aug 2017 19:25:08 +0000 (12:25 -0700)]
Address PR feedback.

6 years agomscorlib cache padding for 128 byte lines (#13102)
Steve MacLean [Thu, 24 Aug 2017 17:54:37 +0000 (13:54 -0400)]
mscorlib cache padding for 128 byte lines (#13102)

* mscorlib ConcurrentQueue pad for 128B cache lines

* Add Padding.cs

6 years agoMerge pull request #11589 from mikedn/gen-am
Carol Eidt [Thu, 24 Aug 2017 13:15:45 +0000 (06:15 -0700)]
Merge pull request #11589 from mikedn/gen-am

Fix improper handling of GenTreeAddrMode offset

6 years agoMerge pull request #13470 from CarolEidt/Fix13451
Carol Eidt [Thu, 24 Aug 2017 07:28:58 +0000 (00:28 -0700)]
Merge pull request #13470 from CarolEidt/Fix13451

Fix ARM issues with Containment

6 years agoFix improper handling of GenTreeAddrMode offset
Mike Danes [Sat, 10 Jun 2017 07:39:41 +0000 (10:39 +0300)]
Fix improper handling of GenTreeAddrMode offset

For unknown reasons GenTreeAddrMode::gtOffset is unsigned rather than
int. On 32 bit hosts this doesn't really matter but on 64 bit hosts we
end up zero extending instead of sign extending it, GetTreeIndir::Offset()
does that by casting from unsigned to size_t.

It doesn't appear possible for this to cause correctness issues (because
the address mode displacement is 32 bit anyway) but it's confusing and
hurts CQ because the emitter can't recognize small negative displacements
that can be encoded in a single byte.

It's worth noting that CodeGen::genCreateAddrMode uses ssize_t internally
to represent the offset but then returns it as unsigned the emitter works
with either int or ssize_t displacements (e.g. emitIns_R_ARX & co. have
int disp arguments, emitNewInstrAmd has ssize_t dsp argument).

Change steps:

Access GenTreeAddrMode's gtOffset via Offset() - Offset() returns the correct
type - int instead of unsigned. All non-legacy uses of gtOffset were replaced
with Offset() and casts were added where necessary. gtOffset was made private
in non-legacy builds to ensure it is not used directly.

Rename GenTreeIndir's Offset() to Address() - This function is problematic,
it returns size_t which is suitable for representing addresses but not
offsets. Rename it and then figure out where offsets are needed and where
addresses are needed.

Add back Offset() with the correct return type - All usages of
GenTreeIndir::Address() (e.g. emitNewInstrAmd) expect ssize_t, not size_t.

Fix the bug - GenTreeIndir::Offset() return ssize_t and
GenTreeAddrMode::Offset() returns int. It doesn't make sense to have a
cast to unsigned.

Fix ARM's handling of GenTreeAddrMode offset - Various pieces of code
(e.g. emitIns_valid_imm_for_ldst_offset) already treat the offset as
signed, they use int, INT64, ssize_t. More importantly, emitarm64's
emitInsLoadStoreOp treats the offset as signed while TreeNodeInfoInitIndir
treates it as unsigned. The later is wrong.

6 years agoAdd unwind info to core dumps. (#13547)
Mike McLaughlin [Thu, 24 Aug 2017 04:13:36 +0000 (21:13 -0700)]
Add unwind info to core dumps. (#13547)

The createdump utility now enumerates all the native stack frames (with
some help from the managed stack walker) for all the threads adding all
the ELF unwind info needed.

On a different machine and without any of the native modules loaded when
the crashdump was generated all the thread stacks can still be unwound
with lldb/gdb.

Change the PAL_VirtualUnwindOutOfProc read memory adapter in DAC
to add the memory to instances manager.

Some misc. cleanup.

6 years agoMerge pull request #13553 from tijoytom/master
Tijoy Tom [Thu, 24 Aug 2017 03:44:00 +0000 (20:44 -0700)]
Merge pull request #13553 from tijoytom/master

Revert incorrect change from commit 16fc300

6 years agoFix ARM issues with Containment
Carol Eidt [Fri, 18 Aug 2017 19:12:40 +0000 (12:12 -0700)]
Fix ARM issues with Containment

These are changes that should have been part of PR #13198:
- Correctly contain struct arguments
- Correctly get number of source registers
- Clear register assignments on `GT_FIELD_LIST` nodes (thanks @hseok-oh).
- Remove now-redundant `ContainCheck` methods for armarch targets.

6 years agoMerge pull request #13550 from pgavlin/DevDiv482577
Pat Gavlin [Thu, 24 Aug 2017 00:33:19 +0000 (17:33 -0700)]
Merge pull request #13550 from pgavlin/DevDiv482577

Type `lea [this + delegateObject]` as `TYP_BYREF`.

6 years agoMerge pull request #13529 from wtgodbe/ParameterizeRids
William Godbe [Thu, 24 Aug 2017 00:16:46 +0000 (17:16 -0700)]
Merge pull request #13529 from wtgodbe/ParameterizeRids

Parameterize RIDs for package restore

6 years agoMerge pull request #13559 from noahfalk/add_ci_logging
Noah Falk [Thu, 24 Aug 2017 00:15:15 +0000 (17:15 -0700)]
Merge pull request #13559 from noahfalk/add_ci_logging

Add more logging to corefx test CI runs

6 years agoAdd more logging to corefx test CI runs
noahfalk [Thu, 24 Aug 2017 00:08:36 +0000 (17:08 -0700)]
Add more logging to corefx test CI runs

6 years agoMerge pull request #13548 from rartemev/revert_12469_fix
Roman Artemev [Thu, 24 Aug 2017 00:01:44 +0000 (17:01 -0700)]
Merge pull request #13548 from rartemev/revert_12469_fix

Revert "Fixed misconception between FP register allocator and RyuJIT's CSE phase"

6 years agoMerge pull request #13533 from wtgodbe/buildNumber
William Godbe [Wed, 23 Aug 2017 23:23:10 +0000 (16:23 -0700)]
Merge pull request #13533 from wtgodbe/buildNumber

Disable default BuildNumberMajor

6 years agoThis reverts
tijoytk [Wed, 23 Aug 2017 22:40:13 +0000 (15:40 -0700)]
This reverts
https://github.com/dotnet/coreclr/commit/16fc3005c085212f6e700a0df8ff7f36c1ea535b
The PR was trying to fix an incorrect test , we should be passing
in !fForWinRT.See https://github.com/dotnet/coreclr/issues/13460#issuecomment-324456870
for more info.

6 years agoFixed Equals/GetHashCode bug for struct. (#13164)
Jim Ma [Wed, 23 Aug 2017 22:32:15 +0000 (10:32 +1200)]
Fixed Equals/GetHashCode bug for struct. (#13164)

Other than `ContainsPointers` and `IsNotTightlyPacked`, added two new conditions for checking whether a valuetype can go to fast path or not. Following are the details of these 2 conditions:

- Check whether a valuetype contains a Single/Double field. If it does, we cannot go to fast path. Floating point numbers have special `Equals` and `GetHashCode` implementation. We cannot simply compare floating point numbers via bits (e.g. +0.0 should equal to -0.0, but their underlying bits are different).

- Check whether an user-defined valuetype overrides `Equals` or `GetHashCode`. If it does, we cannot go to fast path. Because `Equals` or `GetHashCode` result may be different to bit comparison.

To find Single/Double fields and overridden `Equals`/`GetHashCode`, we start a DFS to go through the whole hierachy of the source valuetype, and cache the result to `MethodTable`.

Fix #11452

6 years agoAdd "long GC" jobs to the pri1 build set.
Pat Gavlin [Wed, 23 Aug 2017 21:45:49 +0000 (14:45 -0700)]
Add "long GC" jobs to the pri1 build set.

6 years agoType `lea [this + delegateObject]` as `TYP_BYREF`.
Pat Gavlin [Wed, 23 Aug 2017 20:31:39 +0000 (13:31 -0700)]
Type `lea [this + delegateObject]` as `TYP_BYREF`.

This node was incorrectly typed as `TYP_GCREF`, which was causing an
assertion during GC stress in internal testing.

Fixes VSO 482577.

6 years agoParameterize RIDs for package restore
wtgodbe [Tue, 22 Aug 2017 21:20:01 +0000 (14:20 -0700)]
Parameterize RIDs for package restore

6 years agoRevert "Fixed misconception between FP register allocator and RyuJIT's CSE phase"
Roman Artemev [Wed, 23 Aug 2017 19:49:50 +0000 (12:49 -0700)]
Revert "Fixed misconception between FP register allocator and RyuJIT's CSE phase"

This reverts commit 3f4ee3bed52291e592d7ab67da1fc0e39ee8a3b7.

6 years agoMerge pull request #13534 from dotnet-bot/from-tfs
Brian Sullivan [Wed, 23 Aug 2017 19:37:03 +0000 (12:37 -0700)]
Merge pull request #13534 from dotnet-bot/from-tfs

Merge changes from TFS

6 years agoImprove ReaderWriterLockSlim scalability (#13495)
Koundinya Veluri [Wed, 23 Aug 2017 18:01:31 +0000 (11:01 -0700)]
Improve ReaderWriterLockSlim scalability (#13495)

* Improve ReaderWriterLockSlim scalability

Subset of #13243, fixes #12780

- Prevented waking more than one waiter when only one of them may acquire the lock
- Limited spinning in some cases where it is very unlikely that spinning would help

The _myLock spin lock runs into some bad scalability issues. For example:
1. Readers can starve writers for an unreasonable amount of time. Typically there would be more readers than writers, and it doesn't take many readers to starve a writer. On my machine with 6 cores (12 logical processors with hyperthreading), 6 to 16 reader threads attempting to acquire the spin lock to acquire or release a read lock can starve one writer thread from acquiring the spin lock for several or many seconds. The issue magnifies with more reader threads.
2. Readers and especially writers that hold the RW lock can be starved from even releasing their lock. Releasing an RW lock requires acquiring the spin lock, so releasers are easliy starved by acquirers. How badly they are starved depends on how many acquirers there are, and it doesn't take many to show a very noticeable scalability issue. Often, these acquirers are those that would not be able to acquire the RW lock until one or more releasers release their lock, so the acquirers effectively starve themselves.

This PR does not solve (1), but solves (2) to a degree that could be considered sufficient. #13243 solves (1) and (2) and for (2) it is still better by order-of-magnitude compared with this PR in several cases that I believe are not extreme, but if the complexity of deprioritization is deemed excessive for the goals then of what I tried so far this is the perhaps simplest and most reasonable way to solve (2).

I believe this PR would also be a reasonably low-risk one to port back to .NET Framework.

6 years agoEnable overriding default stack size on Unix (#13517)
Jan Vorlicek [Wed, 23 Aug 2017 17:03:16 +0000 (19:03 +0200)]
Enable overriding default stack size on Unix (#13517)

Alpine Linux has a very small default stack size limit, about 80kB.
This is not enough for running coreclr apps.

This change enables overriding the default stack size using the
COMPlus_DefaultStackSize env variable. For Alpine, it also sets
the default stack size to the same value we use for Windows, which
is 1.5MB.

6 years agoMerge pull request #13540 from wateret/fix-13423
Bruce Forstall [Wed, 23 Aug 2017 16:44:48 +0000 (09:44 -0700)]
Merge pull request #13540 from wateret/fix-13423

[RyuJIT/arm32] Fix MultiReg flag setter

6 years agoJIT: refine types when creating arg temps to improve devirtualization (#13530)
Andy Ayers [Wed, 23 Aug 2017 16:16:07 +0000 (09:16 -0700)]
JIT: refine types when creating arg temps to improve devirtualization (#13530)

The jit will refine the types of temps used to pass arguments to inlinees
when it creates the assignments to these temps.

Unfortunately this is too late to drive devirtualization in the body of
the inlinee, as thes assignments are created after the inlinee body is
imported.

So, add similar refinement logic to the place where the temps are first
created.

Closes #13520.

6 years agoAdd a regression test for #13160 (#13531)
Jonghyun Park [Wed, 23 Aug 2017 15:39:13 +0000 (00:39 +0900)]
Add a regression test for #13160 (#13531)

6 years agoMerge pull request #13450 from sjsinju/genisvaliddoublereg
Carol Eidt [Wed, 23 Aug 2017 14:13:45 +0000 (07:13 -0700)]
Merge pull request #13450 from sjsinju/genisvaliddoublereg

[RyuJIT/ARM32] Remove unnecessary genIsValidDoubleReg() assertion

6 years agoMerge pull request #13528 from JosephTremoulet/Iterate
Joseph Tremoulet [Wed, 23 Aug 2017 13:49:24 +0000 (09:49 -0400)]
Merge pull request #13528 from JosephTremoulet/Iterate

Add InnerIterationCount to layout benchmarks

6 years ago[RyuJIT/arm32] Fix MultiReg flag setter
Hanjoung Lee [Wed, 23 Aug 2017 08:47:03 +0000 (17:47 +0900)]
[RyuJIT/arm32] Fix MultiReg flag setter

Bitwise operation fix in `SetRegSpillFlagByIdx()`.

Fix #13423

6 years agoRemove empty span check from Stream.Read/Write (#13536)
Stephen Toub [Wed, 23 Aug 2017 07:37:33 +0000 (03:37 -0400)]
Remove empty span check from Stream.Read/Write (#13536)

When I added the base Stream.Read/Write(span) default implementations, I added a special-case check for if the span is empty, in which case it made the operation a nop.  But various streams want to impose behavior even in the 0-byte case, e.g. throwing an ObjectDisposedException if the stream has been closed.  This commit just removes the check and allows Read/Write to delegate for all sized spans.

6 years agoMerge pull request #13535 from rartemev/issue_12467
Roman Artemev [Wed, 23 Aug 2017 06:54:26 +0000 (23:54 -0700)]
Merge pull request #13535 from rartemev/issue_12467

Fixed assertion failure in legacy backend

6 years agoMerge pull request #13522 from stephentoub/fsspan
Stephen Toub [Wed, 23 Aug 2017 03:40:10 +0000 (23:40 -0400)]
Merge pull request #13522 from stephentoub/fsspan

Override Span-based Read/Write on FileStream

6 years agoFixed assertion failure in legacy backend
Roman Artemev [Wed, 23 Aug 2017 00:57:45 +0000 (17:57 -0700)]
Fixed assertion failure in legacy backend

6 years agoJIT: don't self assign to temps (#13484)
Andy Ayers [Wed, 23 Aug 2017 00:04:02 +0000 (17:04 -0700)]
JIT: don't self assign to temps (#13484)

Modify gtNewTempAssign to more generally map self-assignment of temps
into nops.

We already were doing something similar over in `impAssignStruct`, and
now we catch non-struct cases too.

6 years agorollback Changeset 1671419: importCall
dotnet-bot [Tue, 22 Aug 2017 23:12:08 +0000 (16:12 -0700)]
rollback Changeset 1671419: importCall

[tfs-changeset: 1671421]

6 years agoimportCall
dotnet-bot [Tue, 22 Aug 2017 23:05:26 +0000 (16:05 -0700)]
importCall

[tfs-changeset: 1671419]

6 years agoDisable default BuildNumberMajor
wtgodbe [Tue, 22 Aug 2017 22:45:26 +0000 (15:45 -0700)]
Disable default BuildNumberMajor

6 years agoRemove macro definition checks that aren't useful and cause unnecessary build breaks...
Sean Gillespie [Tue, 22 Aug 2017 21:37:53 +0000 (14:37 -0700)]
Remove macro definition checks that aren't useful and cause unnecessary build breaks (#13523)

6 years agoFix inconsistency between GetHasCode and Equals (#13513)
Jonghyun Park [Tue, 22 Aug 2017 20:56:01 +0000 (05:56 +0900)]
Fix inconsistency between GetHasCode and Equals (#13513)

6 years agoAdd InnerIterationCount to layout benchmarks
Joseph Tremoulet [Tue, 22 Aug 2017 20:23:07 +0000 (16:23 -0400)]
Add InnerIterationCount to layout benchmarks

These tests were too short-running to measure effectively.  Add an inner
iteration count that makes the running time around 1 second (measured
locally).

6 years agoIntroduce COMPlus_GDBJitEmitDebugFrame (#13515)
Jonghyun Park [Tue, 22 Aug 2017 19:31:26 +0000 (04:31 +0900)]
Introduce COMPlus_GDBJitEmitDebugFrame (#13515)

* Introduce COMPlus_GDBJitEmitDebugFrame

* Use a proper #ifdef macro

6 years agoOverride Span-based Read/Write on FileStream
Stephen Toub [Tue, 22 Aug 2017 17:05:53 +0000 (13:05 -0400)]
Override Span-based Read/Write on FileStream

Adds overrides for the new Span-based Read/Write methods on FileStream.

A few notes:
- As with {Unmanaged}MemoryStream, FileStream isn't sealed, which means a derived type could have overridden all of the existing abstract/virtual methods, including Read(byte[],int,int).  If a consumer then switched to using that stream with Read(Span), because we now override Read(Span), the consumer should get the same behavior intended by the stream developer. As such, since we have no good/efficient way to check whether Read(byte[],int,int) is overridden, we check whether the current stream is a concrete FileStream (rather than a derived type), and if it isn't we use the default base behavior, which will call the Read(byte[],int,int) method.
- FileStream is odd in that it has a dual nature around whether it was initialized for sync vs async, a setting that on Windows ends up configuring the native handle to operate in async mode.  Sync operations on an async-configured FileStream end up delegating to the async methods and blocking, and async operations on a sync-configured FileStream end up using the synchronous behavior asynchronously.  There were some inconsistencies around how this was handled between Windows and Unix, in particular around the ReadByte method, and as part of adding these overloads, I changed that as well, as doing so made the code simpler with the new Span-based support.  Technically this is a breaking change on Unix, but it would be very niche, including calling ReadByte on an async stream while other async operations were in progress... in that case, the desktop and Windows core behavior was to allow direct access to any cached data in the buffer, whereas on Unix we would serialize the ReadByte call with other async operations in flight.

6 years ago[Arm64/Unix] Use portable MP optimized new/alloc (#12333)
Steve MacLean [Tue, 22 Aug 2017 18:58:30 +0000 (14:58 -0400)]
[Arm64/Unix] Use portable MP optimized new/alloc (#12333)

6 years ago[Arm64] Fix RecycledListsWrapper cache guard (#13397)
Steve MacLean [Tue, 22 Aug 2017 18:58:04 +0000 (14:58 -0400)]
[Arm64] Fix RecycledListsWrapper cache guard (#13397)

6 years agoMerge pull request #12216 from ellismg/fix-warnings
William Godbe [Tue, 22 Aug 2017 18:36:09 +0000 (11:36 -0700)]
Merge pull request #12216 from ellismg/fix-warnings

Fix warnings when building SOS.NETCore.csproj

6 years ago[Local GC] Enable building the GC as a shared library (#13137)
Sean Gillespie [Tue, 22 Aug 2017 17:20:36 +0000 (10:20 -0700)]
[Local GC] Enable building the GC as a shared library (#13137)

* [Local GC] Build the GC using system headers

* Disable features to get the GC to build

* Get rid of the separate 'GC PAL' build

* Remove unused stuff

* Don't build gcenv.os.cpp when linking in a standalone gc

* Stub out CPUGroupInfo and NumaNodeInfo

* Stub out IsGCThread and friends

* Build the GC as a shared library :tada:

* Build, link, and run! :tada:

* Fix standalone GC build break

* Fixes where the GC's MethodTable and VM's MethodTable classes disagree

* Integrate a standalone GC into the CoreCLR build system (so it gets copied to the output folder). Re-enable some ifdef-ed out includes that are required for a non-standalone build of the GC.

* Bring changes to Unix and fix the Unix build. Implement some compiler intrinsic wrappers and alignment functions expected by the GC.

* Fix the Windows build

* 1. Code review feedback: use standard types for BitScanForward and
   BitScanForward64
2. Delete FEATURE_COM stuff from the build system, not needed for this
PR
3. Fix the Unix build

* Fix the Windows x86 build - the _BitScanForward64 intrinsic is not available when targeting 32-bit platforms

* Remove a number of things from gcenv.base.h that are not used

* Remove a linker workaround now that we are not linking a standalone GC into the runtime

* Remove dead code, make the lack of GC_PROFILING for standalone gc not break profiling on the non-standalone build

* Code review feedback - use add_library_clr and other cmake-related fixes

* Fix include indentation

* Remove some extraneous parameters to cmake functions (cmake is remarkably lenient...)

6 years agoMerge pull request #13461 from JosephTremoulet/TodoUpdate
Joseph Tremoulet [Tue, 22 Aug 2017 17:04:42 +0000 (13:04 -0400)]
Merge pull request #13461 from JosephTremoulet/TodoUpdate

Update JitOptimizerTodoAssessment.md

6 years agoFollow-up: Add enforce PGO to official builds (#13437)
Victor "Nate" Graf [Tue, 22 Aug 2017 17:02:51 +0000 (10:02 -0700)]
Follow-up: Add enforce PGO to official builds (#13437)

* Add variables to pipeline to enable enforcepgo for Release

* Address review

6 years agoMerge pull request #13487 from mikedn/switch-temp-type
Joseph Tremoulet [Tue, 22 Aug 2017 16:39:54 +0000 (12:39 -0400)]
Merge pull request #13487 from mikedn/switch-temp-type

Fix incorrect switch temp lcl type

6 years agoDelete some dead PAL code (#13469)
Justin Van Patten [Tue, 22 Aug 2017 14:09:08 +0000 (07:09 -0700)]
Delete some dead PAL code (#13469)

* Delete some dead PAL code

GetComputerName and GetUserName are not used.

* HAVE_GETPWUID_R can now be deleted

6 years agoRemove empty try's (#13493)
Dan Moseley [Tue, 22 Aug 2017 05:25:35 +0000 (22:25 -0700)]
Remove empty try's (#13493)

* Remove empty try's

* Remove some dead comments

* more

6 years agoUndo a few JIT layout workarounds (#13505)
Joseph Tremoulet [Tue, 22 Aug 2017 04:14:17 +0000 (00:14 -0400)]
Undo a few JIT layout workarounds (#13505)

Remove some `goto`s that were added to work around #9692 (poor code
layout for loop exit paths) -- the JIT's layout decisions were improved
in #13314, and these particular `goto`s are no longer needed; crossgen
of System.Private.CoreLib now produces the same machine code with or
without this change.

Part of #13466.

6 years agoThreadPool minimalistic thread request cap (#13431)
Steve MacLean [Tue, 22 Aug 2017 03:10:01 +0000 (23:10 -0400)]
ThreadPool minimalistic thread request cap (#13431)

Cap ThreadPool thread requests minimalistically

- Only request an additional thread on dequeue if enqueue request was suppressed, and if there are any work items left in the queues
- ThreadPool pad hot cache line
- Add ideas from #13408

6 years agofix JitConfig initialize and destoy (#13477)
Sergey Andreenko [Tue, 22 Aug 2017 01:04:29 +0000 (18:04 -0700)]
fix JitConfig initialize and destoy (#13477)

fix JitConfig initialize and destoy.

6 years agoMerge pull request #13496 from justinvp/version_parse
Stephen Toub [Tue, 22 Aug 2017 00:27:13 +0000 (20:27 -0400)]
Merge pull request #13496 from justinvp/version_parse

Avoid unnecessary intermediate Version allocation

6 years agoFixing wcsstr function to account for cases where search string is longer than remain...
Mike Kaufman [Mon, 21 Aug 2017 23:30:34 +0000 (16:30 -0700)]
Fixing wcsstr function to account for cases where search string is longer than remaining target string. (#13504)

6 years agoUse CreateFile2FromApp if available (#13410)
Jeremy Kuhne [Mon, 21 Aug 2017 22:45:57 +0000 (15:45 -0700)]
Use CreateFile2FromApp if available (#13410)

* Use CreateFile2FromApp if available

This is needed for F5 UAP brokering scenarios.

Remove check for handle type. Overzealous, doesn't apply to UAP scenarios.

* Address feedback

- Use CreateFile2 if Win8 or higher
- Always use CreateFile2FromApp if Appx
- Make DisableMediaInsertionPrompt a struct
- Push CreateFile2FromApp down to avoid JIT

* More feedback

Always use FromApp for WinRT.

* Conditionalize IsWindows8OrAbove check

* Always use FromApp if in AppX

* Address more feedback

- Fix Unix build by moving LoadString to shared
- Break out CREATEFILE2 struct
- Condition CreateFile2FromApp usage

* Move include

6 years agoClean up VS experience for s.p.corelib.csproj (#13481)
Dan Moseley [Mon, 21 Aug 2017 22:18:28 +0000 (15:18 -0700)]
Clean up VS experience for s.p.corelib.csproj (#13481)

* Remove bogus assembly warnings in VS

* Fix warnings about sharing files within the project tree

* Remove bogus lines

* Remove lines showing up as bogus source files

* Remove overridden target

* feedback

6 years agoMerge pull request #13482 from rartemev/issue_12469
Roman Artemev [Mon, 21 Aug 2017 19:30:36 +0000 (12:30 -0700)]
Merge pull request #13482 from rartemev/issue_12469

Fixed misconception between FP register allocator and RyuJIT's CSE phase

6 years agoMerge pull request #13424 from stephentoub/versionspan
Stephen Toub [Mon, 21 Aug 2017 19:04:17 +0000 (15:04 -0400)]
Merge pull request #13424 from stephentoub/versionspan

Add span-based Version methods

6 years agoSupport docker cgroup limits (#13488)
Tom Deseyn [Mon, 21 Aug 2017 18:56:32 +0000 (20:56 +0200)]
Support docker cgroup limits (#13488)

* Fix cgroup mountinfo parsing

The parsing would find the wrong '-' in lines like this:
354 347 0:28 /system.slice/docker-654dd7b6b8bbfe1739ae3309b471e95ccc82b3a3f56b7879f0a811d68b5c4e1d.scope /sys/fs/cgroup/cpuacct,cpu ro,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct,cpu

* cgroup: don't append cgroup relative path for reading docker limits

6 years agoMerge pull request #13497 from noahfalk/tiered_jit_fix_tests
Noah Falk [Mon, 21 Aug 2017 17:45:32 +0000 (10:45 -0700)]
Merge pull request #13497 from noahfalk/tiered_jit_fix_tests

Enable by-request tiered compilation testing in CI

6 years agoMerge pull request #13483 from dotnet-maestro-bot/master-UpdateDependencies
Stephen Toub [Mon, 21 Aug 2017 17:38:32 +0000 (13:38 -0400)]
Merge pull request #13483 from dotnet-maestro-bot/master-UpdateDependencies

Update CoreClr, CoreFx to preview2-25621-02, preview2-25621-02, respectively (master)

6 years agoUse a smaller expansion of `GT_INDEX` in MinOpts.
Pat Gavlin [Sat, 5 Aug 2017 18:43:40 +0000 (11:43 -0700)]
Use a smaller expansion of `GT_INDEX` in MinOpts.

We currently expand `GT_INDEX` nodes during morph into an explicit
bounds check followed by a load. For example, this tree:

```
[000059] ------------       /--*  LCL_VAR   int    V09 loc6
[000060] R--XG-------    /--*  INDEX     ref
[000058] ------------    |  \--*  LCL_VAR   ref    V00 arg0
[000062] -A-XG-------    *  ASG       ref
[000061] D------N----    \--*  LCL_VAR   ref    V10 loc7
```

is expanded into this tree:

```
[000060] R--XG+------       /--*  IND       ref
[000491] -----+------       |  |  /--*  CNS_INT   long   16 Fseq[#FirstElem]
[000492] -----+------       |  \--*  ADD       byref
[000488] -----+-N----       |     |     /--*  CNS_INT   long   3
[000489] -----+------       |     |  /--*  LSH       long
[000487] -----+------       |     |  |  \--*  CAST      long <- int
[000484] i----+------       |     |  |     \--*  LCL_VAR   int    V09 loc6
[000490] -----+------       |     \--*  ADD       byref
[000483] -----+------       |        \--*  LCL_VAR   ref    V00 arg0
[000493] ---XG+------    /--*  COMMA     ref
[000486] ---X-+------    |  \--*  ARR_BOUNDS_CHECK_Rng void
[000059] -----+------    |     +--*  LCL_VAR   int    V09 loc6
[000485] ---X-+------    |     \--*  ARR_LENGTH int
[000058] -----+------    |        \--*  LCL_VAR   ref    V00 arg0
[000062] -A-XG+------    *  ASG       ref
[000061] D----+-N----    \--*  LCL_VAR   ref    V10 loc7

```

Even in this simple case where both the array object and the index are
lclVars, this represents a rather large increase in the size of the IR.
In the worst case, the JIT introduces and additional lclVar for both the
array object and the index, adding several additional nodes to the tree.
When optimizing, exposing the structure of the array access may be
helpful, as it may allow the compiler to better analyze the program.
When we are not optimizing, however, the expansion serves little purpose
besides constraining the IR shapes that must be handled by the backend.
Due to its need for lclVars in the worst case, this expansion may even
bloat the size of the generated code, as all lclVar references are
generated as loads/stores from/to the stack when we are not optimizing.
In the case above, the expanded tree generates the following x64
assembly:

```
IN0018: 000092 mov      rdi, gword ptr [V00 rbp-10H]
IN0019: 000096 mov      edi, dword ptr [rdi+8]
IN001a: 000099 cmp      dword ptr [V09 rbp-48H], edi
IN001b: 00009C jae      G_M5106_IG38
IN001c: 0000A2 mov      rdi, gword ptr [V00 rbp-10H]
IN001d: 0000A6 mov      esi, dword ptr [V09 rbp-48H]
IN001e: 0000A9 movsxd   rsi, esi
IN001f: 0000AC mov      rdi, gword ptr [rdi+8*rsi+16]
IN0020: 0000B1 mov      gword ptr [V10 rbp-50H], rdi
```

Inspired by other recent experiments (e.g. #13188), this change
introduces a new node that replaces the above expansion in MinOpts. This
node, `GT_INDEX_ADDR`, represents the bounds check and address
computation involved in an array access, and returns the address of the
element that is to be loaded or stored. Using this node, the example
tree given above expands to the following:

```
[000489] a--XG+------    /--*  IND       ref
[000059] -----+------    |  |  /--*  LCL_VAR   int    V09 loc6
[000060] R--XG+--R---    |  \--*  INDEX_ADDR byref
[000058] -----+------    |     \--*  LCL_VAR   ref    V00 arg0
[000062] -A-XG+------    *  ASG       ref
[000061] D----+-N----    \--*  LCL_VAR   ref    V10 loc7
```

This expansion requires only the addition of the `GT_IND` node that
represents the memory access itself. This savings in IR size translates
to about a 2% decrease in instructions retired during non-optimizing
compilation. Furthermore, this expansion tends to generate smaller
code; for example, the tree given above is generated in 29 rather than
35 bytes:

```
IN0018: 000092 mov      edi, dword ptr [V09 rbp-48H]
IN0019: 000095 mov      rsi, gword ptr [V00 rbp-10H]
IN001a: 000099 cmp      rdi, qword ptr [rsi+8]
IN001b: 00009D jae      G_M5106_IG38
IN001c: 0000A3 lea      rsi, bword ptr [rsi+8*rdi+16]
IN001d: 0000A8 mov      rdi, gword ptr [rsi]
IN001e: 0000AB mov      gword ptr [V10 rbp-50H], rdi
```

6 years agoMerge pull request #12489 from jashook/unix_x64_and_arm64_fasttailcall_fix
Jarret Shook [Mon, 21 Aug 2017 16:10:57 +0000 (09:10 -0700)]
Merge pull request #12489 from jashook/unix_x64_and_arm64_fasttailcall_fix

[Unix x64|Arm64] Correct canfastTailCall decisions

6 years agoUpdate CoreClr, CoreFx to preview2-25621-02, preview2-25621-02, respectively
dotnet-maestro-bot [Mon, 21 Aug 2017 13:32:54 +0000 (06:32 -0700)]
Update CoreClr, CoreFx to preview2-25621-02, preview2-25621-02, respectively

6 years agoChange the position of unassignPhysReg()
sjsujinkim [Mon, 21 Aug 2017 01:57:23 +0000 (10:57 +0900)]
Change the position of unassignPhysReg()

6 years agoFixing assert in groovy
noahfalk [Mon, 21 Aug 2017 00:21:57 +0000 (17:21 -0700)]
Fixing assert in groovy

6 years agoEnable by-request tiered compilation testing in CI
noahfalk [Sun, 20 Aug 2017 23:43:23 +0000 (16:43 -0700)]
Enable by-request tiered compilation testing in CI

6 years agoAvoid unnecessary intermediate Version allocation
Justin Van Patten [Sun, 20 Aug 2017 19:37:18 +0000 (12:37 -0700)]
Avoid unnecessary intermediate Version allocation

`Version..ctor(string)` is implemented by calling `Version.Parse`, which
allocates an intermediate `Version` instance. Avoid the unnecessary
intermediate allocation by using `Version.Parse` directly.