platform/upstream/coreclr.git
8 years agoMerge pull request #6731 from weshaggard/FixSerializationPackageVersion
Wes Haggard [Sat, 13 Aug 2016 07:05:33 +0000 (00:05 -0700)]
Merge pull request #6731 from weshaggard/FixSerializationPackageVersion

Update version of S.R.Serialization.Primitives to version 4.1.1

8 years agoMerge pull request #6728 from rahku/typeloaderHang
Rahul Kumar [Sat, 13 Aug 2016 06:09:19 +0000 (23:09 -0700)]
Merge pull request #6728 from rahku/typeloaderHang

Issue: If two threads try to load the same type it can cause clr to h…

8 years agoMerge pull request #6726 from rahku/fixes
Rahul Kumar [Sat, 13 Aug 2016 06:08:18 +0000 (23:08 -0700)]
Merge pull request #6726 from rahku/fixes

In intGCShadow() first reserve memory before committing

8 years agoUpdate version of S.R.Serialization.Primitives to version 4.1.1
Wes Haggard [Sat, 13 Aug 2016 04:51:07 +0000 (21:51 -0700)]
Update version of S.R.Serialization.Primitives to version 4.1.1

8 years agoMerge pull request #6729 from pgavlin/Reformat
Pat Gavlin [Sat, 13 Aug 2016 02:11:09 +0000 (19:11 -0700)]
Merge pull request #6729 from pgavlin/Reformat

Re-reformat the JIT sources.

8 years agoreview fixes
Rahul Kumar [Sat, 13 Aug 2016 00:41:03 +0000 (17:41 -0700)]
review fixes

8 years agoIn intGCShadow() first reserve memory before committing. VirtualCommit does not accep...
Rahul Kumar [Sat, 13 Aug 2016 00:29:02 +0000 (17:29 -0700)]
In intGCShadow() first reserve memory before committing. VirtualCommit does not accept NULL as input address

8 years agoReformat the JIT sources.
Pat Gavlin [Fri, 12 Aug 2016 23:51:22 +0000 (16:51 -0700)]
Reformat the JIT sources.

The sources were formatted using jit-format on Windows with the
following command lines in the following order:

    `jit-format.cmd -o Windows -b Checked -a x64 -f`
    `jit-format.cmd -o Windows -b Debug -a x64 -f`
    `jit-format.cmd -o Windows -b Release -a x64 -f`

The versions of clang-format and clang-tidy that were invoked by
jit-format were:

    clang-format version 3.8.1 (branches/release_38)

    LLVM (http://llvm.org/):
      LLVM version 3.8.1
      Optimized build with assertions.
      Built Jun 22 2016 (12:19:56).
      Default target: x86_64-pc-windows-msvc
      Host CPU: sandybridge

8 years agoMassage the code a bit for jit-format w/ Clang 3.8.
Pat Gavlin [Fri, 12 Aug 2016 23:34:18 +0000 (16:34 -0700)]
Massage the code a bit for jit-format w/ Clang 3.8.

Manually insert a few braces that would otherwise have been inserted
in the wrong place.

8 years agoRevert #6686.
Pat Gavlin [Fri, 12 Aug 2016 22:10:30 +0000 (15:10 -0700)]
Revert #6686.

The code was accidentally formatted with Clang 3.9. It will be reformatted
with Clang 3.8 and a new PR submitted.

8 years agoIssue: If two threads try to load the same type it can cause clr to hang if the first...
Rahul Kumar [Fri, 12 Aug 2016 23:47:47 +0000 (16:47 -0700)]
Issue: If two threads try to load the same type it can cause clr to hang if the first thread to start the load happens to be a background thread. Background thread would create PendingTypeLoadEntry  and insert it into unresolvedClassHash. Second thread (having normal priority) would block on PendingTypeLoadEntry->m_crst waiting for the background thread to unblock it. After doing partial load of type background thread periodically checks if there are other threads waiting for type to get loaded. In this case it does find a thread waiting so it unblocks thread. However, background thread has not removed PendingTypeLoadEntry  from unresolvedClassHash. This causes the second thread to continue spinning and so not allowing background thread to get any processor cycles to remove PendingTypeLoadEntry  from unresolvedClassHash. This cause app to be seem like it has hung. It is possible that this may not repro on multi-proc machine where the background thread can get scheduled on another processor when second thread continues to spin on another processor.

Fix: First remove the PendingTypeLoadEntry  from unresolvedClassHash and then unblock the waiting threads.

8 years agoMerge pull request #6721 from jashook/disable_jit32_tests
Jarret Shook [Fri, 12 Aug 2016 22:00:47 +0000 (15:00 -0700)]
Merge pull request #6721 from jashook/disable_jit32_tests

Disable tests to get jit32 jobs green

8 years agoMerge pull request #6685 from RussKeldorph/test-native-log
Russ Keldorph [Fri, 12 Aug 2016 21:58:10 +0000 (14:58 -0700)]
Merge pull request #6685 from RussKeldorph/test-native-log

Re-enable creating Tests_Native* log files

8 years agoFix exception filter getter for native frames (#6723)
Sasha Semennikov [Fri, 12 Aug 2016 21:34:57 +0000 (14:34 -0700)]
Fix exception filter getter for native frames (#6723)

8 years agoFixing priority on tests (making tests P1) (#6706)
Fadi Hanna [Fri, 12 Aug 2016 19:54:24 +0000 (12:54 -0700)]
Fixing priority on tests (making tests P1) (#6706)

8 years agoMerge pull request #6722 from dotnet-bot/from-tfs
Jan Kotas [Fri, 12 Aug 2016 19:50:37 +0000 (12:50 -0700)]
Merge pull request #6722 from dotnet-bot/from-tfs

Merge changes from TFS

8 years agoMore fixes for unreachable code warnings with older compiler
Jan Kotas [Fri, 12 Aug 2016 17:51:58 +0000 (10:51 -0700)]
More fixes for unreachable code warnings with older compiler

[tfs-changeset: 1622213]

8 years agoDisable tests to get jit32 jobs green
jashoo [Fri, 12 Aug 2016 17:25:09 +0000 (10:25 -0700)]
Disable tests to get jit32 jobs green

See issues #6720, #6718, #6714 for more information

8 years agoMerge pull request #6712 from dotnet-bot/from-tfs
Jan Kotas [Fri, 12 Aug 2016 15:02:48 +0000 (08:02 -0700)]
Merge pull request #6712 from dotnet-bot/from-tfs

Merge changes from TFS

8 years agoEnable FEATURE_STUBS_AS_IL for ARM/Linux (#6500)
Jonghyun Park [Fri, 12 Aug 2016 15:02:22 +0000 (00:02 +0900)]
Enable FEATURE_STUBS_AS_IL for ARM/Linux (#6500)

This commit enables FEATURE_STUBS_AS_IL for ARM/Linux. This commit
tries to fix #6452.

8 years agoFix unreachable code warnings with MSVC++ 18.10
Jan Kotas [Fri, 12 Aug 2016 06:36:12 +0000 (23:36 -0700)]
Fix unreachable code warnings with MSVC++ 18.10

[tfs-changeset: 1622176]

8 years agoMerge pull request #6690 from wtgodbe/regioninfo
William Godbe [Thu, 11 Aug 2016 21:48:38 +0000 (14:48 -0700)]
Merge pull request #6690 from wtgodbe/regioninfo

Fix region info test on Debian

8 years agoFix region info test on Debian
wtgodbe [Wed, 10 Aug 2016 21:16:48 +0000 (14:16 -0700)]
Fix region info test on Debian

8 years agoMerge pull request #6686 from adiaaida/formatted
Michelle McDaniel [Thu, 11 Aug 2016 20:39:22 +0000 (13:39 -0700)]
Merge pull request #6686 from adiaaida/formatted

Reformat jit source base using clang-format and clang-tidy

8 years agoMerge pull request #6701 from dotnet-bot/from-tfs
Brian Sullivan [Thu, 11 Aug 2016 20:12:40 +0000 (13:12 -0700)]
Merge pull request #6701 from dotnet-bot/from-tfs

Merge changes from TFS

8 years agoMerge pull request #6704 from dotnet/wtgodbe-patch-1
William Godbe [Thu, 11 Aug 2016 19:13:32 +0000 (12:13 -0700)]
Merge pull request #6704 from dotnet/wtgodbe-patch-1

Update unix test instructions

8 years agoUpdate unix test instructions
William Godbe [Thu, 11 Aug 2016 19:13:19 +0000 (12:13 -0700)]
Update unix test instructions

8 years agoMerge pull request #6702 from dotnet/RunTestDocumentation
William Godbe [Thu, 11 Aug 2016 18:59:47 +0000 (11:59 -0700)]
Merge pull request #6702 from dotnet/RunTestDocumentation

Fix linux test running documentation

8 years agoFix linux test running documentation
William Godbe [Thu, 11 Aug 2016 18:59:35 +0000 (11:59 -0700)]
Fix linux test running documentation

We should specify that corefx will be from a Debug build, not a Release build.

8 years agoMerge pull request #6637 from smile21prc/coreclr-perf
smile21prc [Thu, 11 Aug 2016 17:45:10 +0000 (10:45 -0700)]
Merge pull request #6637 from smile21prc/coreclr-perf

Automate the perf data collection for JIT CodeQuality benchmarks on Windows.

8 years agoAdd missing security annotation
Jan Kotas [Thu, 11 Aug 2016 17:32:59 +0000 (10:32 -0700)]
Add missing security annotation

[tfs-changeset: 1622038]

8 years agoReformat jit sources with clang-tidy and format
Michelle McDaniel [Tue, 9 Aug 2016 20:15:05 +0000 (13:15 -0700)]
Reformat jit sources with clang-tidy and format

This change is the result of running clang-tidy and clang-format on jit
sources.

8 years agoPrepare jit source for clang-tidy
Michelle McDaniel [Tue, 9 Aug 2016 16:59:01 +0000 (09:59 -0700)]
Prepare jit source for clang-tidy

In templates, clang-tidy will replace 0 with nullptr, but this is illegal
for primitive types. This change replaces 0 in two templated functions
with ZERO, which is defined to be 0 to avoid this issue.

Additioanlly, we need to conditionally define some macros for running
under __clang__ so they are found by clang-tidy.

8 years agoMerge pull request #6657 from gkhanna79/UpdateVer
Gaurav Khanna [Thu, 11 Aug 2016 16:27:01 +0000 (09:27 -0700)]
Merge pull request #6657 from gkhanna79/UpdateVer

Update package versions to 1.1.0

8 years agoARM: disable stack unwinding using DWARF (#6700)
hqueue [Thu, 11 Aug 2016 16:21:41 +0000 (01:21 +0900)]
ARM: disable stack unwinding using DWARF (#6700)

libunwind for ARM does not interpret ARM vfpv3/NEON
registers in DWARF format correctly.

Signed-off-by: Hyung-Kyu Choi <hk0110.choi@samsung.com>
8 years agoMerge pull request #6699 from dotnet-bot/UpdateDependencies20160811052348
Gaurav Khanna [Thu, 11 Aug 2016 13:43:38 +0000 (06:43 -0700)]
Merge pull request #6699 from dotnet-bot/UpdateDependencies20160811052348

Updating External dependencies to beta-24411-00

8 years agoMerge pull request #6691 from ramarag/ResolveWorkerChainLookupAsmStubFix
Rama krishnan Raghupathy [Thu, 11 Aug 2016 08:26:51 +0000 (01:26 -0700)]
Merge pull request #6691 from ramarag/ResolveWorkerChainLookupAsmStubFix

Preserving ResolveCacheElem in X9

8 years agoUpdating External dependencies to beta-24411-00
dotnet-bot [Thu, 11 Aug 2016 05:23:48 +0000 (05:23 +0000)]
Updating External dependencies to beta-24411-00

8 years agoMerge pull request #6285 from JosephTremoulet/LenProp
Joseph Tremoulet [Thu, 11 Aug 2016 00:16:31 +0000 (20:16 -0400)]
Merge pull request #6285 from JosephTremoulet/LenProp

Propagate known array lengths to more places

8 years agoPreserving ResolveCacheElem in X9
Rama Krishnan Raghupathy [Wed, 10 Aug 2016 22:02:35 +0000 (15:02 -0700)]
Preserving ResolveCacheElem in X9

8 years agoUpdate Arm32 package version reference
Gaurav Khanna [Wed, 10 Aug 2016 21:58:00 +0000 (14:58 -0700)]
Update Arm32 package version reference

8 years agoAutomate the perf data collection for JIT CodeQuality benchmarks on Windows.
Smile Wei [Wed, 3 Aug 2016 22:20:15 +0000 (15:20 -0700)]
Automate the perf data collection for JIT CodeQuality benchmarks on Windows.

Fix a quote.

8 years agoPropagate known array lengths to more places
Joseph Tremoulet [Thu, 23 Jun 2016 20:21:13 +0000 (16:21 -0400)]
Propagate known array lengths to more places

Earlyprop limits its propagation of array lengths to blocks marked
BBF_HAS_INDX, for throughput reasons.  The importer sets that flag on
blocks that store/load array elements, but not blocks that simply extract
an array's length.  This change renames the flag to BBF_HAS_IDX_LEN, and
updates the importer to set it also on blocks with ldlen operations.  This
change also updates fgOptWhileLoop to propagate the flag when it
copies such an expression as part of a zero-trip test.

Fixes #2325.

8 years agoMerge pull request #6682 from JosephTremoulet/ConstantIndex
Joseph Tremoulet [Wed, 10 Aug 2016 20:30:53 +0000 (16:30 -0400)]
Merge pull request #6682 from JosephTremoulet/ConstantIndex

Update FieldSeq annotations in EarlyProp

8 years agoMerge pull request #6671 from gkhanna79/FixLFAN
Gaurav Khanna [Wed, 10 Aug 2016 19:24:33 +0000 (12:24 -0700)]
Merge pull request #6671 from gkhanna79/FixLFAN

Fix LoadFromAssemblyName to invoke fallback context

8 years agoMerge pull request #6606 from rahku/arm64todo
Rahul Kumar [Wed, 10 Aug 2016 18:47:47 +0000 (11:47 -0700)]
Merge pull request #6606 from rahku/arm64todo

ARM64: Fix for ARM64TODO

8 years agoARM64: Fix for ARM64TODO
Rahul Kumar [Thu, 4 Aug 2016 18:43:21 +0000 (11:43 -0700)]
ARM64: Fix for ARM64TODO

8 years agoMerge pull request #6683 from jashook/remove_unreachable_code
Jarret Shook [Wed, 10 Aug 2016 17:48:49 +0000 (10:48 -0700)]
Merge pull request #6683 from jashook/remove_unreachable_code

Fix unreachable code in flowgraph

8 years agoRe-enable creating Tests_Native* log files
Russ Keldorph [Wed, 10 Aug 2016 17:22:19 +0000 (10:22 -0700)]
Re-enable creating Tests_Native* log files

Recently we seem to have lost the ability to generate Tests_Native logs.
Currently, there are many build warnings that don't appear in any of the
logs because the native test build output is going to the console only.

The lines I'm adding are already duplicated other times in the same file,
so they are a candidate for refactoring, but I'll leave that for others.

8 years agoAdd StackCrawl reference marker to each of the Assembly.Load implementations.
Gaurav Khanna [Wed, 10 Aug 2016 16:26:04 +0000 (09:26 -0700)]
Add StackCrawl reference marker to each of the Assembly.Load implementations.

8 years agoFix unreachable code in flowgraph
jashoo [Wed, 10 Aug 2016 16:19:53 +0000 (09:19 -0700)]
Fix unreachable code in flowgraph

There is debugging information that is expected to be printed; however,
unreachable because the function returns before printing under debug.

Fixed by moved the return past the debug log.

8 years agoImprove Enum.ToString performance (#6645)
Ben Adams [Wed, 10 Aug 2016 15:17:37 +0000 (16:17 +0100)]
Improve Enum.ToString performance (#6645)

Reduces allocations by 66%; increases performance by 600% (x7)

With these changes ToString no longer boxes the value and doesn't create an empty array for `CustomAttributeRecords` when the enum is not flagged; also caches whether the enum is flagged.

It still boxes the enum to Enum to make the ToString virtual call however.

Using the @jkotas enummark :wink:

```csharp
enum MyEnum { One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten };
public static void Main(string[] args)
{
    (MyEnum.Seven).ToString();
    int start = Environment.TickCount;
    for (int i = 0; i < 10000000; i++)
    {
        (MyEnum.Seven).ToString();
    }
    int end = Environment.TickCount;
    Console.WriteLine((end - start).ToString());
}
```
Pre: 5828ms, 5828ms, 5829ms (1.7M/s)
Post: 828ms, 828ms, 828ms (12.1M/s)

8 years agoMerge pull request #6678 from dotnet-bot/UpdateDependencies20160810052139
Gaurav Khanna [Wed, 10 Aug 2016 14:32:05 +0000 (07:32 -0700)]
Merge pull request #6678 from dotnet-bot/UpdateDependencies20160810052139

Updating External dependencies to beta-24410-00

8 years agoFix for VCR 190024210 and Win SDK 10.0.14393.0 (#6674)
Peter Jas [Wed, 10 Aug 2016 06:12:51 +0000 (09:12 +0300)]
Fix for VCR 190024210 and Win SDK 10.0.14393.0 (#6674)

8 years agoUpdating External dependencies to beta-24410-00
dotnet-bot [Wed, 10 Aug 2016 05:21:39 +0000 (05:21 +0000)]
Updating External dependencies to beta-24410-00

8 years agoMerge pull request #6653 from echesakov/StackAllocation
Egor Chesakov [Tue, 9 Aug 2016 22:25:45 +0000 (15:25 -0700)]
Merge pull request #6653 from echesakov/StackAllocation

Work towards objects stack allocation

8 years agoTypeSystem generics test cases (#6663)
Fadi Hanna [Tue, 9 Aug 2016 20:08:02 +0000 (13:08 -0700)]
TypeSystem generics test cases (#6663)

TypeSystem generics test cases (TypeGenerator tests)

8 years agoFix LoadFromAssemblyName to invoke fallback context (analogous to static assembly...
Gaurav Khanna [Mon, 1 Aug 2016 19:03:26 +0000 (12:03 -0700)]
Fix LoadFromAssemblyName to invoke fallback context (analogous to static assembly loads within the context)

8 years agoUpdate FieldSeq annotations in EarlyProp
Joseph Tremoulet [Fri, 5 Aug 2016 18:01:35 +0000 (14:01 -0400)]
Update FieldSeq annotations in EarlyProp

When morph expands `ldelem`s, it annotates local vars and int constants
that contribute linearly to the index.  When value-numbering runs,
ParseArrayAddress must still be able to discover annotations.  EarlyProp
runs between morph and value-numbering, and might replace a `ldlen` that
happens to be in an array index expression with a constant.  This change
updates EarlyProp to call LabelIndex in such cases to annotate the
constants appropriately for their new context.

In order to ensure that EarlyProp can determine whether a replacement is
in an array index context or not, this change also adds a new flag
`GTF_ARRLEN_ARR_IDX`, which LabelIndex sets on GT_ARR_LENGTH nodes and
EarlyProp can subsequently check.

Fixes #6649.

8 years agoThe call to LOG expects a pointer argument, but the actual argument was of class...
vinnyrom [Tue, 9 Aug 2016 13:21:11 +0000 (06:21 -0700)]
The call to LOG expects a pointer argument, but the actual argument was of class type 'ComCallWrapperPtr'. (#6665)

8 years agoMerge pull request #6668 from dotnet-bot/UpdateDependencies20160809052353
Gaurav Khanna [Tue, 9 Aug 2016 06:46:52 +0000 (23:46 -0700)]
Merge pull request #6668 from dotnet-bot/UpdateDependencies20160809052353

Updating External dependencies to beta-24409-00

8 years agoUpdating External dependencies to beta-24409-00
dotnet-bot [Tue, 9 Aug 2016 05:23:53 +0000 (05:23 +0000)]
Updating External dependencies to beta-24409-00

8 years agoWork towards objects stack allocation: moved allocation part of newobj-lowering into...
Egor Chesakov [Thu, 21 Jul 2016 22:37:41 +0000 (15:37 -0700)]
Work towards objects stack allocation: moved allocation part of newobj-lowering into separate phase

1. Introduced `GT_ALLOCOBJ` node to mark places where object allocation happens
2. In `importer.cpp` changed lowering of allocation part of newobj instruction from an allocation helper call to a `GT_ALLOCOBJ` node creation
3. Created new phase `ObjectAllocator` (`PHASE_ALLOCATE_OBJECTS`) and put it right after dominator computing (we will need the information for escape analysis)
4. Current implementation of ObjectAllocator walks over all basic blocks having flag `BBF_HAS_NEWOBJ` set and replaces `GT_ALLOCOBJ` with  an allocation helper call

8 years agoMerge pull request #6662 from rahku/disabletransparencychecks
Rahul Kumar [Tue, 9 Aug 2016 00:50:14 +0000 (17:50 -0700)]
Merge pull request #6662 from rahku/disabletransparencychecks

Disable few more transparency checks for .net core

8 years agoMerge pull request #6660 from rahku/stackwalkerFix
Rahul Kumar [Tue, 9 Aug 2016 00:01:30 +0000 (17:01 -0700)]
Merge pull request #6660 from rahku/stackwalkerFix

Port CS#1596330 from netfxdev1 (bug#119959)

8 years agoMerge pull request #6659 from rahku/warning
Rahul Kumar [Mon, 8 Aug 2016 23:39:10 +0000 (16:39 -0700)]
Merge pull request #6659 from rahku/warning

Fix compiler warnings

8 years agoDisable few more transparency checks for .net core
Rahul Kumar [Mon, 8 Aug 2016 22:50:15 +0000 (15:50 -0700)]
Disable few more transparency checks for .net core

8 years agoMerge pull request #6656 from jashook/arm_link_fix
Jarret Shook [Mon, 8 Aug 2016 22:50:13 +0000 (15:50 -0700)]
Merge pull request #6656 from jashook/arm_link_fix

Fix for missing symbol OnHijackTripThread

8 years agoMerge pull request #6652 from JohnChen0/crossgen-createpdb
John Chen [Mon, 8 Aug 2016 22:37:35 +0000 (15:37 -0700)]
Merge pull request #6652 from JohnChen0/crossgen-createpdb

Modify "crossgen -createpdb" to skip loading clrjit.dll (#6607)

8 years agoFix compiler warnings
Rahul Kumar [Mon, 8 Aug 2016 21:35:40 +0000 (14:35 -0700)]
Fix compiler warnings

8 years agoPort CS#1596330 from netfxdev1 (bug#119959)
Rahul Kumar [Mon, 8 Aug 2016 22:06:30 +0000 (15:06 -0700)]
Port CS#1596330 from netfxdev1 (bug#119959)

8 years agoRefresh mscorlib reference assembly based on what is in S.P.C (#6655)
Wes Haggard [Mon, 8 Aug 2016 21:40:41 +0000 (14:40 -0700)]
Refresh mscorlib reference assembly based on what is in S.P.C (#6655)

Split mscorlib.cs into mscorlib.manual.cs for the internal
members we needed to expose. Used the genapi tool from
https://github.com/dotnet/buildtools/tree/master/src/GenAPI.Desktop
to generate mscorlib.cs. It doesn't exactly match due to some
much easier just by running genapi against S.P.CoreLib.

8 years agoUpdate package versions to 1.1.0
Gaurav Khanna [Thu, 4 Aug 2016 19:27:34 +0000 (12:27 -0700)]
Update package versions to 1.1.0

8 years agoModify "crossgen -createpdb" to skip loading clrjit.dll (#6607)
John Chen (CLR) [Fri, 5 Aug 2016 23:08:18 +0000 (16:08 -0700)]
Modify "crossgen -createpdb" to skip loading clrjit.dll (#6607)

The -JITPath option doesn't work properly when CrossGen is used to
create a PDB file (issue #6607). Since clrjit.dll isn't really
needed for creating PDB files, the issue is fixed by modifying
CrossGen to skip loading clrjit.dll when -createpdb option is given.

Also following suggestion from issue #6607, added a new switch
-diasymreaderPath to CrossGen, to allow loading diasymreader.dll
from an alternative path.

8 years agoFix for missing symbol OnHijackTripThread
jashoo [Mon, 8 Aug 2016 17:07:15 +0000 (10:07 -0700)]
Fix for missing symbol OnHijackTripThread

PR #6522 changed from OnHijackScalarTripThread to OnHijackTripThread; however,
missed changing this definition for arm windows.

8 years agoAdd Title (so that web searches work better) (#6654)
Vance Morrison [Mon, 8 Aug 2016 20:18:12 +0000 (13:18 -0700)]
Add Title (so that web searches work better) (#6654)

Also added a very short description

8 years agoMerge pull request #6582 from alsemenn/fixrefreg
Sasha Semennikov [Mon, 8 Aug 2016 19:08:00 +0000 (12:08 -0700)]
Merge pull request #6582 from alsemenn/fixrefreg

For helper method frame DAC doesn't read register pointers. So set them to NULL to not use "wrong" data.

8 years agoCheck PAL_VirtualUnwind failure during GC (#6598)
Jonghyun Park [Mon, 8 Aug 2016 01:35:54 +0000 (10:35 +0900)]
Check PAL_VirtualUnwind failure during GC (#6598)

As discussed in #6525, PAL_VirtualUnwind sometimes fails during GC.

This GC failure leads to very unpredicatble behavior (which is very hard to
analyze).

This commit tries to stop the execution at the point where error
happens.

8 years agoDon't overwrite crossgen log in build.cmd script (#6639)
James Ko [Sun, 7 Aug 2016 15:21:30 +0000 (11:21 -0400)]
Don't overwrite crossgen log in build.cmd script (#6639)

8 years agoFix compile error (#6641)
Guo Xiao [Sun, 7 Aug 2016 15:20:52 +0000 (10:20 -0500)]
Fix compile error (#6641)

error: cannot initialize return object of type 'void *' with an lvalue
of type 'void ()'

8 years agoMerge pull request #6619 from BruceForstall/Fix6517
Bruce Forstall [Sat, 6 Aug 2016 17:39:06 +0000 (10:39 -0700)]
Merge pull request #6619 from BruceForstall/Fix6517

Fix #6517

8 years agoMerge pull request #6630 from dotnet-bot/UpdateDependencies20160805073043
Gaurav Khanna [Sat, 6 Aug 2016 02:33:50 +0000 (19:33 -0700)]
Merge pull request #6630 from dotnet-bot/UpdateDependencies20160805073043

Updating External dependencies to beta-24405-00

8 years agoMerge pull request #6631 from erozenfeld/NullCheckFolding
Eugene Rozenfeld [Sat, 6 Aug 2016 02:09:04 +0000 (19:09 -0700)]
Merge pull request #6631 from erozenfeld/NullCheckFolding

Null check folding.

8 years agoDecrease writes to local variables in Buffer.MemoryCopy (#6627)
James Ko [Sat, 6 Aug 2016 02:06:59 +0000 (22:06 -0400)]
Decrease writes to local variables in Buffer.MemoryCopy (#6627)

In `Buffer.MemoryCopy` currently we are making 4 writes every time we copy some data; 1 to update `*dest`, 1 to update `dest`, 1 to update `src` and 1 to update `len`. I've decreased it to 2; one to update a new local variable `i`, which keeps track of how many bytes we are into the buffer. All writes are now made using

```cs
*(dest + i + x) = *(src + i + x)
```

which has no additional overhead since they're converted to using memory addressing operands by the jit.

Another change I made was to add a few extra cases for the switch-case at the beginning that does copying for small sizes without any branches. It now covers sizes 0-22. This is beneficial to the main codepath, since we can convert the unrolled loop to a `do..while` loop and save an extra branch at the beginning. (max 7 bytes for alignment, 16 for 1 iteration of the loop, so the min bytes we can copy without checking whether we should stop is 23.) This adds

This PR increases the performance of `MemoryCopy` by 10-20% for most buffer sizes on x86; you can see the performance test/results (and the generated assembly for each version) [here](https://gist.github.com/jamesqo/337852c8ce09205a8289ce1f1b9b5382). (Note that this codepath is also used by `wstrcpy` at the moment, so this directly affects many common String operations.)

8 years agoMerge pull request #6636 from AndyAyersMS/MoreObservations
Andy Ayers [Sat, 6 Aug 2016 02:03:53 +0000 (19:03 -0700)]
Merge pull request #6636 from AndyAyersMS/MoreObservations

Inliner: add a few more observations

8 years agoFix #6517
Bruce Forstall [Fri, 5 Aug 2016 06:52:25 +0000 (23:52 -0700)]
Fix #6517

My previous change #6342 to implement tailcall-via-helper for RyuJIT/x86
also changed non-x86 for Delegate Invoke calls, to avoid creating a
temp where we already had a local. However, this temp is needed if the
local is a field (with an offset). Even if it is not a field, I saw it
needed in a JitStressRegs case. So I'm returning it to the previous logic
for non-x86, non-tailcall cases. It is still required for tailcall cases
to preserve some delicate ordering constraints on the special tailcall
argument values.

8 years agoInliner: add a few more observations
Andy Ayers [Fri, 5 Aug 2016 21:49:02 +0000 (14:49 -0700)]
Inliner: add a few more observations

Now that we can trust `optMethodFlags`, note if the root caller has
newarr or newobj. We can't yet tell if these operations might feed
a particular call's arguments but their presence in the root method
alone might be enough to build correlations with performance changes.

Count number of returns in the callee. Note if callee has same this
as the (root) caller. Note when callee is a class constructor.

Add code to dump out the new observations. No policies act on these yet.

8 years agoMerge pull request #6522 from swaroop-sridhar/gcinfov2
Swaroop Sridhar [Fri, 5 Aug 2016 22:48:42 +0000 (15:48 -0700)]
Merge pull request #6522 from swaroop-sridhar/gcinfov2

Implement GcInfo v2

8 years agoNull check folding.
Eugene Rozenfeld [Fri, 5 Aug 2016 20:14:58 +0000 (13:14 -0700)]
Null check folding.

1. Added a null check folding optimization to early prop. The optimization tries to fold
GT_NULLCHECK(y) nodes  into GT_IND(x) nodes where x=y+const
in the same block (where const is sufficiently small). The algorithm uses SSA use-def info
to go from x to its def and then tries to match the pattern x = COMMA(NULLCHECK(y), ADD(y, const))).
If such a pattern is found, the algorithm checks the trees and statements that are between the use
and the def in execution order to see if they have unsafe side effects: calls, exception sources, and
assignments (all assignment if we are in a try and assignments to global memory if we are not).
If there are no nodes with unsafe side effects, the null check is removed.

2. Made several improvements to null check elimination in assertion propagation.
..* Added a new kind for op1: O1K_VALUE_NUMBER
..* Non-null assertions can now be made about arbitrary value numbers, not just locals
..* Fixed code that was trying to find a ref given a byref: the code now handles an arbitrary number of
    offsets and checks whether the total offsetof is small enough.
..* Added similar code that tries to find a ref VN given a byref VN

This addresses part of the suboptimal code generated for #1226: null check is no longer emitted.

Correctness: ran full desktop and CoreCLR testing.

Throughput: no measurable throughput impact (verified by running internal CQNgenTP several times).

Code size in CoreCLR:

Framework assemblies:

Total bytes of diff: -805 (-0.01 % of base)
    diff is an improvement.
Total byte diff includes 0 bytes from reconciling methods
        Base had    0 unique methods,        0 unique bytes
        Diff had    0 unique methods,        0 unique bytes
Top file improvements by size (bytes):
        -352 : System.Private.CoreLib.dasm (-0.01 % of base)
        -306 : Microsoft.CodeAnalysis.CSharp.dasm (-0.01 % of base)
         -58 : Microsoft.CodeAnalysis.dasm (-0.01 % of base)
         -48 : System.Numerics.Vectors.dasm (-0.08 % of base)
         -14 : System.Xml.XmlDocument.dasm (-0.01 % of base)
7 total files with size differences.
Top method improvements by size (bytes):
         -30 : System.Numerics.Vectors.dasm - System.Numerics.Matrix4x4:ToString():ref:this
         -30 : System.Private.CoreLib.dasm - System.DateTimeParse:ParseByFormat(byref,byref,byref,ref,byref):bool
         -24 : Microsoft.CodeAnalysis.CSharp.dasm - <GetMethodsToEmit>d__68:MoveNext():bool:this
         -18 : System.Private.CoreLib.dasm - System.DateTimeParse:Lex(int,byref,byref,byref,byref,byref,int):bool
         -18 : System.Private.CoreLib.dasm - System.DateTimeParse:ProcessDateTimeSuffix(byref,byref,byref):bool
243 total methods with size differences.

JIT Code quality benchmarks in CoreCLR:

Total bytes of diff: -29 (-0.01 % of base)
    diff is an improvement.
Total byte diff includes 0 bytes from reconciling methods
        Base had    0 unique methods,        0 unique bytes
        Diff had    0 unique methods,        0 unique bytes
Top file improvements by size (bytes):
         -25 : Bytemark\Bytemark\Bytemark.dasm (-0.03 % of base)
          -4 : BenchmarksGame\pidigits\pi-digits\pi-digits.dasm (-0.21 % of base)
2 total files with size differences.
Top method improvements by size (bytes):
          -9 : Bytemark\Bytemark\Bytemark.dasm - AssignJagged:second_assignments(ref,ref)
          -6 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:MultiplyInternalFPF(byref,byref,byref)
          -4 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:AddSubInternalFPF(ubyte,byref,byref,byref)
          -2 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:denormalize(byref,int)
          -2 : Bytemark\Bytemark\Bytemark.dasm - EMFloat:DivideInternalFPF(byref,byref,byref)
8 total methods with size differences.

In internal SPMI:

3915 methods with diffs, almost everything -- code size improvements
13,715 bytes code size reduction overall 0.51% on affected methods

CQ_Perf: 85 methods with diffs, 84 code size improvements, no regressions
Benchmarks with code size diffs:
Roslyn 59
TrueTypeBench 19
mono-pi-digits 2
mono-chameneos-redux 2
ByteMark\assign_jagged 1
Json_Serialize 1
SharpChess 1
BenchI\mulmtx 1

Internal CQPerf didn't report any runtime wins for these benchmarks.

8 years agoImplement GcInfo v2
Swaroop Sridhar [Wed, 20 Jul 2016 23:50:22 +0000 (16:50 -0700)]
Implement GcInfo v2
Ref #4379

This change implements GcInfo version 2 for all platforms that use the
GcInfo library (all architectures other than X86).

Changes are:
1) Defines ReturnKind enumeration for all platforms
2) Change the GcInfo encoder library to encode the ReturnKind and ReversePInvokeFrame slot
3) Change the CM's GcInfo decoder to encode the ReturnKind and ReversePInvokeFrame slot for GCINFO_VERSION 2
4) Some corrections to GCINFO_MEASUREments
5) Changes to RYU Jit to provide the correct information to the encoder
6) Changes to the VM to use the ReturnKind information while hijacking a thread
   - If ReturnKind is available from GcInfo, new hijack routines are used
   - Otherwise, fall back to old method (for compatibility)
7) Rework and simplify the thread hijack routines by scanning HijackFrames directly for gcroots
8) Supporting code to implement the above features.

Returning Structs in multiple registers

Hijacking for StructInRegs is currently only implemented for
Unix SystemV ABI Multi-reg struct returns. However, the hijack-workers that use
ReturnKind are ready to handle other platforms (ex: ARM/ARM64 Windows)
once the corresponding HijackTripThread() assembly routines are defined.

The New feature flag: FEATURE_MULTIREG_RETURN is set for platforms where a struct value
can be returned in multiple registers [ex: Windows/Unix ARM/ARM64, Unix-AMD64]
FEATURE_UNIX_AMD64_STRUCT_PASSING is a specific kind of FEATURE_MULTIREG_RETURN
specified by SystemV ABI for AMD64

Compatibility with other JITs

- All new GCInfo generated by RYU Jit is in GcInfo version 2
- All Ngen images must be regenerated with the new GcInfo version.
- Ready-to-run images with old GcInfo will continue to work.
- Jit64/X64 uses the GcInfo library, so it generates GcInfo version 2.
  However, it doesn't (yet) provide the data to encode the correct ReturnKind
  Similar is the case for ARM32 code running on JIT32, and any other JITs
  that may be using GcInfo library but not yet modified to use the new API.
  So, compatibility is achived using RT_Unset flag.

When ReturnKind is RT_Unset, it means that the JIT did not set
the ReturnKind in the GCInfo, and therefore the VM cannot rely on it,
and must use other mechanisms (similar to GcInfo ver 1) to determine
the Return type's GC information.

Implement GC root scanning for Hijack-frames

This change implements GCScanRoots() method for Hijacke-frames
based on the ReturnKind information available from the GcInfo.
If the exact ReturnKind is not available in the GcInfo, the
thread-suspension logic will compute the ReturnKind based on
the method-signature.

As a result of this change, several hijack-helpers in the VM
are cleaned up. There's only one implementation of HijackWorker()
to handle all returnKinds.

This change also simplifies the thread-hijack logic by using a
single assembly helper OnHijackTripThread() in most cases.
The only other helper used is for X86 floating point return values
for save/restoring the top of the FP stack.

ARM64

Only GcIndfo v2 is reliably supported for ARM64 platform.
The changes to thread-hijack mechanism fixes #6494 for ARM64.

No measurable change in JIT throughput, performance or native-image
size from this change.

8 years agoFor helper method frame DAC doesn't read register pointers. So set them to NULL to...
Sasha Semennikov [Tue, 2 Aug 2016 23:45:21 +0000 (16:45 -0700)]
For helper method frame DAC doesn't read register pointers. So set them to NULL to not user "wrong" data.

Moved context pointers NULL assignment to gmsamd64.cpp

Squash commits

8 years agoMerge pull request #6629 from JosephTremoulet/DeadFlag
Joseph Tremoulet [Fri, 5 Aug 2016 20:06:09 +0000 (16:06 -0400)]
Merge pull request #6629 from JosephTremoulet/DeadFlag

Remove GTF_REDINDEX_CHECK

8 years agoUpdating External dependencies to beta-24405-00
dotnet-bot [Fri, 5 Aug 2016 19:30:43 +0000 (19:30 +0000)]
Updating External dependencies to beta-24405-00

8 years agoMerge pull request #6628 from vancem/WCF_ExplictChannels
Vance Morrison [Fri, 5 Aug 2016 18:53:13 +0000 (11:53 -0700)]
Merge pull request #6628 from vancem/WCF_ExplictChannels

Wcf explict channels

8 years agoMerge pull request #6495 from briansull/cleanup
Brian Sullivan [Fri, 5 Aug 2016 18:44:20 +0000 (11:44 -0700)]
Merge pull request #6495 from briansull/cleanup

Followup work from codereview feedback

8 years agoMerge pull request #6617 from adityamandaleeka/fix_sos
Aditya Mandaleeka [Fri, 5 Aug 2016 18:04:45 +0000 (11:04 -0700)]
Merge pull request #6617 from adityamandaleeka/fix_sos

Fix bug in SymbolReader initialization in SOS

8 years agoMerge pull request #6620 from hqueue/fix/typo_20160805
Aditya Mandaleeka [Fri, 5 Aug 2016 18:04:00 +0000 (11:04 -0700)]
Merge pull request #6620 from hqueue/fix/typo_20160805

Fix misleading comment in codegenlegacy.cpp

8 years agoRemove GTF_REDINDEX_CHECK
Joseph Tremoulet [Fri, 5 Aug 2016 17:41:30 +0000 (13:41 -0400)]
Remove GTF_REDINDEX_CHECK

This flag is unused.  Its description also sounds like it's redundant with
the GTF_ARR_BOUND_INBND flag, so the latter flag could be used if a new
need to convey this information arises in the future.

Preserving GTF_ARR_BOUND_INBND and removing GTF_REDINDEX_CHECK makes more
sense than the other way around since GTF_ARR_BOUND_INBND is specific to
the relevant opcode.

8 years agoMerge pull request #6577 from lukasztomczyk/threadpool-spinwaitconfig
Koundinya Veluri [Fri, 5 Aug 2016 17:37:02 +0000 (10:37 -0700)]
Merge pull request #6577 from lukasztomczyk/threadpool-spinwaitconfig

Expose ThreadPool_UnfairSemaphoreSpinLimit config

8 years agoMerge pull request #6609 from AndyAyersMS/InlineSummaryData
Andy Ayers [Fri, 5 Aug 2016 16:48:48 +0000 (09:48 -0700)]
Merge pull request #6609 from AndyAyersMS/InlineSummaryData

Inliner: gather summary stats and dump to Jit CSV log