platform/upstream/coreclr.git
7 years agoMake GetCurrentProcessorNumber an FCall
Stephen Toub [Fri, 25 Nov 2016 04:39:15 +0000 (23:39 -0500)]
Make GetCurrentProcessorNumber an FCall

7 years agoCache result of GetCurrentProcessorNumber
Stephen Toub [Wed, 23 Nov 2016 01:48:53 +0000 (20:48 -0500)]
Cache result of GetCurrentProcessorNumber

7 years agoImprove ArrayPool performance
Stephen Toub [Tue, 22 Nov 2016 18:44:44 +0000 (13:44 -0500)]
Improve ArrayPool performance

- Renames DefaultArrayPool to ConfigurableArrayPool, which remains unchanged.
- Adds a new TlsOverPerCoreLockedStacksArrayPool, which is used as the shared pool for byte[] and char[].  The pool is tiered, with a small per-thread TLS cache, followed by a global cache.  The global cache is split into effectively per-core buckets, although threads are able to check other buckets if their assigned bucket is empty/full for rents/returns, respectively.

7 years agoSupports to build PAL tests under x86/Linux (#8292)
Jonghyun Park [Thu, 24 Nov 2016 10:07:42 +0000 (19:07 +0900)]
Supports to build PAL tests under x86/Linux (#8292)

7 years ago[x86/Linux] Fix unsupported architecture in seh-unwind.cpp (#8262)
SaeHie Park [Thu, 24 Nov 2016 09:43:00 +0000 (18:43 +0900)]
[x86/Linux] Fix unsupported architecture in seh-unwind.cpp (#8262)

Fix compile error for x86/Linux
- add ASSIGN_UNWIND_REGS in seh-unwind.cpp for x86
- add CONTEXT_EXCEPTION_ACTIVE in pal.h for x86
- add CONTEXT_XSTATE in pal.h for x86

7 years agoMerge pull request #8295 from RussKeldorph/nopr
Russ Keldorph [Thu, 24 Nov 2016 05:18:49 +0000 (21:18 -0800)]
Merge pull request #8295 from RussKeldorph/nopr

Remove non-RyuJIT default x86 PR triggers

7 years agoRemove non-RyuJIT default PR triggers
Russ Keldorph [Thu, 24 Nov 2016 04:54:36 +0000 (20:54 -0800)]
Remove non-RyuJIT default PR triggers

These jobs are failing and shouldn't be triggered on PRs

7 years agoMerge pull request #8260 from BruceForstall/SwitchX86ToRyuJit
Bruce Forstall [Thu, 24 Nov 2016 00:24:32 +0000 (16:24 -0800)]
Merge pull request #8260 from BruceForstall/SwitchX86ToRyuJit

Make RyuJIT/x86 the default x86 JIT

7 years agoRemoves non-existent target files from override.targets (#8264)
Jonghyun Park [Wed, 23 Nov 2016 23:48:06 +0000 (08:48 +0900)]
Removes non-existent target files from override.targets (#8264)

This commit revises override.targets not to import ``mono.targets`` and
``roslyn.xplat.targets`` which do not exist in Tools/

7 years agoAdd String.Join overloads accepting a char separator (#7942)
James Ko [Wed, 23 Nov 2016 23:25:28 +0000 (18:25 -0500)]
Add String.Join overloads accepting a char separator (#7942)

* Add String.Join overloads that accept char separators

7 years agoMake RyuJIT/x86 the default x86 JIT
Bruce Forstall [Wed, 23 Nov 2016 00:42:57 +0000 (16:42 -0800)]
Make RyuJIT/x86 the default x86 JIT

JIT32 becomes compatjit.dll and RyuJIT LEGACY_BACKEND becomes legacyjit.dll
(and is an altjit).

If JIT32 is not being built, then RyuJIT LEGACY_BACKEND becomes compatjit.dll
and is a normal jit (not an altjit).

Both clrjit.dll and compatjit.dll are added to the JIT NuGet package.

7 years agoMerge pull request #8284 from pgavlin/gh8258
Pat Gavlin [Wed, 23 Nov 2016 22:16:06 +0000 (14:16 -0800)]
Merge pull request #8284 from pgavlin/gh8258

Increment lclVar refCounts in fgMorphBlockStmt.

7 years agoMerge pull request #8281 from sbomer/dasm_automation
Sven Boemer [Wed, 23 Nov 2016 22:04:05 +0000 (14:04 -0800)]
Merge pull request #8281 from sbomer/dasm_automation

Fix archiving for jitdiff windows build only jobs

7 years agoMerge pull request #7847 from CarolEidt/Fix278375
Carol Eidt [Wed, 23 Nov 2016 21:52:22 +0000 (13:52 -0800)]
Merge pull request #7847 from CarolEidt/Fix278375

x86: not all fields of promoted struct need regs

7 years agoFormat code.
Pat Gavlin [Wed, 23 Nov 2016 21:51:50 +0000 (13:51 -0800)]
Format code.

7 years agoMerge pull request #8259 from pgavlin/ByrefGcrefKillSet
Pat Gavlin [Wed, 23 Nov 2016 21:39:10 +0000 (13:39 -0800)]
Merge pull request #8259 from pgavlin/ByrefGcrefKillSet

Fix the byref/gcref kill set for ASSIGN_BYREF.

7 years agoFix the no-GC kill set for ASSIGN_BYREF on x86.
Pat Gavlin [Wed, 23 Nov 2016 20:02:55 +0000 (12:02 -0800)]
Fix the no-GC kill set for ASSIGN_BYREF on x86.

This helper only kills ECX.

7 years agoIncrement lclVar refCounts in fgMorphBlockStmt.
Pat Gavlin [Wed, 23 Nov 2016 19:41:04 +0000 (11:41 -0800)]
Increment lclVar refCounts in fgMorphBlockStmt.

`fgMorphTree` may introduce additional lclVar references. Call
`lvaRecursiveIncRefCounts` in `fgMorphBlockStmt` to ensure that ref
counts are conservatively correct.

Fixes #8258.

7 years agoMerge pull request #8137 from jamesqo/array.fill
Dan Moseley [Wed, 23 Nov 2016 18:55:11 +0000 (10:55 -0800)]
Merge pull request #8137 from jamesqo/array.fill

Add Array.Fill apis

7 years agoMerge pull request #8229 from mikedn/sse-eq
Sivarv [Wed, 23 Nov 2016 18:36:46 +0000 (10:36 -0800)]
Merge pull request #8229 from mikedn/sse-eq

Change vector equality to use pmovmskb

7 years agoMerge pull request #8282 from ianhays/api_lockfix
Ian Hays [Wed, 23 Nov 2016 17:46:22 +0000 (09:46 -0800)]
Merge pull request #8282 from ianhays/api_lockfix

Fix Typo in Unix Lock/Unlock PAL

7 years agoFix Typo in Unix Lock/Unlock PAL
Ian Hays [Wed, 23 Nov 2016 17:35:08 +0000 (09:35 -0800)]
Fix Typo in Unix Lock/Unlock PAL

7 years agoAccount for a reload of umod op2
Carol Eidt [Wed, 23 Nov 2016 17:24:41 +0000 (09:24 -0800)]
Account for a reload of umod op2

7 years agoFix archiving for jitdiff windows build only jobs
Sven Boemer [Wed, 23 Nov 2016 17:14:03 +0000 (09:14 -0800)]
Fix archiving for jitdiff windows build only jobs

The dasm archiving was enabled for all jitdiff scenarios, including the
build set up for the ubuntu/osx flow jobs. The dasm artifacts don't
exist in build-only scenarios, and this was preventing archiving of
the build.

7 years ago[x86/linux] Fix redefined DISPATCHER_CONTEXT compile error (#8246)
SaeHie Park [Wed, 23 Nov 2016 10:18:43 +0000 (19:18 +0900)]
[x86/linux] Fix redefined DISPATCHER_CONTEXT compile error (#8246)

WIP, fix compile error for x86/Linux
- add directive WIN32 to current DISPATCHER_CONTEXT in clrnt.h
- add DISPATCHER_CONTEXT for x86 in palrt.h

7 years ago[GDBJIT] Fix thunk symbol generation for ARM (#8205)
Andrey Kvochko [Wed, 23 Nov 2016 10:17:05 +0000 (13:17 +0300)]
[GDBJIT] Fix thunk symbol generation for ARM (#8205)

* Fix thunk symbol generation for ARM

* Add PINSTRToPCODE macro to raise the THUMB bit on ARM

7 years ago[x86/Linux] Fix compile error with exception handling (#8269)
SaeHie Park [Wed, 23 Nov 2016 10:14:59 +0000 (19:14 +0900)]
[x86/Linux] Fix compile error with exception handling (#8269)

Fix compile error for x86/Linux
- fix unknown type name 'EHWatsonBucketTracker'
- fix field has incomplete type 'EXCEPTION_REGISTRATION_RECORD'
- fix for FaultingExceptionFrame class

7 years ago[x86/Linux] Fix unknown type name 'ExInfo' (#8274)
SaeHie Park [Wed, 23 Nov 2016 10:12:18 +0000 (19:12 +0900)]
[x86/Linux] Fix unknown type name 'ExInfo' (#8274)

Fix compile error for x86/Linux
- need to undefine ELIMINATE_FEF by adding !defined(FEATURE_PAL)

7 years ago[x86/Linux] Fix comparison of two values with different enumeration types (#8273)
SaeHie Park [Wed, 23 Nov 2016 10:10:24 +0000 (19:10 +0900)]
[x86/Linux] Fix comparison of two values with different enumeration types (#8273)

Fix compile error for x86/Linux
- convert to int type for 'ReturnKind' and 'infoHdrAdjustConstants'

7 years ago[x86/Linux] Fix SEH '__try' is not supported on this target (#8271)
SaeHie Park [Wed, 23 Nov 2016 09:39:33 +0000 (18:39 +0900)]
[x86/Linux] Fix SEH '__try' is not supported on this target (#8271)

Fix compile error for x86/Linux
- add check !FEATURE_PAL

7 years ago[x86/Linux] Fix no matching function for call to 'InternalCreateThread' (#8265)
SaeHie Park [Wed, 23 Nov 2016 09:38:26 +0000 (18:38 +0900)]
[x86/Linux] Fix no matching function for call to 'InternalCreateThread' (#8265)

Fix compile error for x86/Linux
- fix calling convention by adding PALAPI to TerminationRequestHandlingRoutine

7 years agoChange vector equality to use pmovmskb
Mike Danes [Mon, 21 Nov 2016 18:30:28 +0000 (20:30 +0200)]
Change vector equality to use pmovmskb

This change replaces the rather long shuffle based compare sequence with
pmovmskb which is available in SSE2 and AVX2. The following code is now
generated:

C4E16D76D1           vpcmpeqd ymm2, ymm1
C4E17DD7C2           vpmovmskbeax, ymm2
83F8FF               cmp      eax, -1
0F94C0               sete     al
0FB6C0               movzx    rax, al

7 years agoFix ThreadPool.SetMaxThreads to not allow having zero available threads (#8256)
Koundinya Veluri [Wed, 23 Nov 2016 03:14:13 +0000 (19:14 -0800)]
Fix ThreadPool.SetMaxThreads to not allow having zero available threads (#8256)

There is an assertion checking for this, so allowing zero is probably not intentional.

Related to #8236

7 years ago[x86/Linux] Fix compile error redifinition RUNTIME_FUNCTION (#8249)
SaeHie Park [Wed, 23 Nov 2016 02:04:39 +0000 (11:04 +0900)]
[x86/Linux] Fix compile error redifinition RUNTIME_FUNCTION (#8249)

Add !FEATURE_PAL directive for x86 as RUNTIME_FUNCTION is defined in pal

7 years agoChange argument order.
James Ko [Wed, 23 Nov 2016 01:57:09 +0000 (20:57 -0500)]
Change argument order.

7 years agox86: not all fields of promoted struct need regs
Carol Eidt [Thu, 27 Oct 2016 16:37:40 +0000 (09:37 -0700)]
x86: not all fields of promoted struct need regs

This fixes DevDiv bug 278375, and includes a test case. It also improves the code generation for the general case of promoted structs, though tuning is still needed.
The bug was a case where, after decomposing the long fields, we had 7 entries in the GT_FIELD_LIST, each of which was requesting a register.
Since Lowering won't know which fields may be in registers, it must be prepared to handle fields in memory. Also, if the fields are not register candidates, we should make them contained and push them directly, for which we may need a temporary register.
LSRA is changed to allow RegOptional spills that are used at the same location of the register being allocated. This exposed an issue with a spilled constant being treated as a contained constant (causing an assert because it is not encodable).
Change codegen to use push for promoted structs (they are generally small-ish, and pushes of lclVars and constants are cheaper than loading into a register).
This could be optimized for consecutive float or double fields.
In the process of running jitStressRegs, I found that a test was throwing an exception but reporting success. I fixed the issue causing the exception and also changed the test to report failure if an exception is thrown.
Also, on x86, GT_UMOD requires op2 to be in a register, so Lowering must not mark it as RegOptional.

7 years ago[x86/Linux] Fix stdcall calling convention ignored on variadic function (#8252)
SaeHie Park [Tue, 22 Nov 2016 23:24:20 +0000 (08:24 +0900)]
[x86/Linux] Fix stdcall calling convention ignored on variadic function (#8252)

WIP, fix compile error for x86/Linux
- fix to use STDMETHODVCALLTYPE

7 years agoAdd missing Path methods to model.xml (#8257)
Jeremy Kuhne [Tue, 22 Nov 2016 23:23:59 +0000 (15:23 -0800)]
Add missing Path methods to model.xml (#8257)

7 years agoMerge pull request #8244 from seanshpark/x86pal01
Gaurav Khanna [Tue, 22 Nov 2016 23:04:50 +0000 (15:04 -0800)]
Merge pull request #8244 from seanshpark/x86pal01

[x86/Linux] Fix compilation in pal and context header

7 years agoRespond to feedback
James Ko [Tue, 22 Nov 2016 22:20:46 +0000 (17:20 -0500)]
Respond to feedback

7 years agoMerge pull request #8254 from pgavlin/FixTestBuild
Pat Gavlin [Tue, 22 Nov 2016 19:42:53 +0000 (11:42 -0800)]
Merge pull request #8254 from pgavlin/FixTestBuild

Fix the test build.

7 years agoFix the test build.
Pat Gavlin [Tue, 22 Nov 2016 18:05:58 +0000 (10:05 -0800)]
Fix the test build.

PR #8032 disabled the test build for all but one test. This change fixes
this oversight.

7 years agoMerge pull request #8253 from JosephTremoulet/SwitchCopy
Pat Gavlin [Tue, 22 Nov 2016 17:43:44 +0000 (09:43 -0800)]
Merge pull request #8253 from JosephTremoulet/SwitchCopy

Remove bogus "fast path" in unroller branch update

7 years agoMerge pull request #8210 from mikedn/warn-test
Pat Gavlin [Tue, 22 Nov 2016 17:36:08 +0000 (09:36 -0800)]
Merge pull request #8210 from mikedn/warn-test

Fix warnings in native test code

7 years agoMerge pull request #8242 from pgavlin/gh8232
Pat Gavlin [Tue, 22 Nov 2016 17:35:13 +0000 (09:35 -0800)]
Merge pull request #8242 from pgavlin/gh8232

Always nullcheck VSD tail calls on x86.

7 years agoRemove bogus "fast path" in unroller branch update
Joseph Tremoulet [Tue, 22 Nov 2016 16:59:29 +0000 (08:59 -0800)]
Remove bogus "fast path" in unroller branch update

BasicBlocks whose `bbJumpKind` doesn't make use of `bbJumpDest` may have
arbitrary garbage in their `bbJumpDest` field, so remove the code from
loop unrolling that was expecting such blocks to have null `bbJumpDest`s,
and instead always defer to the `optCopyBlkDest`/`optRedirectBlock`
helpers that check the jump kind before checking the jump dest.

Fixes #8231.

7 years agoMerge pull request #8233 from ianhays/api_lockunlock
Ian Hays [Tue, 22 Nov 2016 16:38:12 +0000 (08:38 -0800)]
Merge pull request #8233 from ianhays/api_lockunlock

Add Unix FileStream Lock/Unlock code.

7 years agoMerge pull request #8247 from CarolEidt/Fix288222
Carol Eidt [Tue, 22 Nov 2016 16:17:24 +0000 (08:17 -0800)]
Merge pull request #8247 from CarolEidt/Fix288222

Set the size of SIMD this pointer

7 years agoPR feedback.
Pat Gavlin [Tue, 22 Nov 2016 16:12:17 +0000 (08:12 -0800)]
PR feedback.

7 years agoMerge pull request #8032 from sbomer/dasm_automation
Sven Boemer [Tue, 22 Nov 2016 15:32:33 +0000 (07:32 -0800)]
Merge pull request #8032 from sbomer/dasm_automation

Jit-diff automation

7 years ago[x86/Linux] fix and add for x86 cmake configuration (#8219)
SaeHie Park [Tue, 22 Nov 2016 12:55:26 +0000 (21:55 +0900)]
[x86/Linux] fix and add for x86 cmake configuration (#8219)

This patch will add x86 part for cross build
- add x86 in build-rootfs and related cross files
- add x86 parts in CMakeLists.txt to pass configuration
- add required source files to pass configuration

7 years ago[x86/Linux] Fix compilation in pal
SaeHie Park [Tue, 22 Nov 2016 02:22:16 +0000 (11:22 +0900)]
[x86/Linux] Fix compilation in pal

WIP, fix compile error for x86/Linux
- add KNONVOLATILE_CONTEXT_POINTERS
- add _X86_ codes in pal/context.h

7 years agoSet the size of SIMD this pointer
Carol Eidt [Tue, 22 Nov 2016 02:58:40 +0000 (18:58 -0800)]
Set the size of SIMD this pointer

When setting the SIMD type of a "this" pointer,
we need to capture the size of the SIMD type.
This was previously being set in a method in simd.cpp,
but when the SIMD type recognition was moved
earlier in the JIT, it was omitted.
This caused an assert in the case where a fixed-size
SIMD type is handled by `fgMorphCombineSIMDFieldAssignments()`.

Fixes bug 288222

7 years agoMerge pull request #8213 from mikedn/assert-dup-produce
Pat Gavlin [Tue, 22 Nov 2016 00:53:59 +0000 (16:53 -0800)]
Merge pull request #8213 from mikedn/assert-dup-produce

Detect duplicate calls to genProduceReg

7 years agoMerge pull request #8206 from pgavlin/DivModLowerAndNewTempAssignIssues
Pat Gavlin [Tue, 22 Nov 2016 00:48:04 +0000 (16:48 -0800)]
Merge pull request #8206 from pgavlin/DivModLowerAndNewTempAssignIssues

Fix two bugs revealed during internal testing.

7 years agoAlways nullcheck VSD tail calls on x86.
Pat Gavlin [Tue, 22 Nov 2016 00:39:21 +0000 (16:39 -0800)]
Always nullcheck VSD tail calls on x86.

This is a requirement of the runtime ABI: failing to perform this check
causes the runtime to AV in the virtual dispatch stub and crash.

7 years agoMerge pull request #8235 from pgavlin/VSO280127
Pat Gavlin [Tue, 22 Nov 2016 00:23:37 +0000 (16:23 -0800)]
Merge pull request #8235 from pgavlin/VSO280127

Do not treat certain calls as intrinsics for RyuJIT/x86.

7 years agoMerge pull request #8185 from JosephTremoulet/ReturnAsplode
Joseph Tremoulet [Tue, 22 Nov 2016 00:09:22 +0000 (19:09 -0500)]
Merge pull request #8185 from JosephTremoulet/ReturnAsplode

Curtail loop unroller epliog generation

7 years agoMerge pull request #8122 from alsemenn/add_debuggertests_build
Sasha Semennikov [Mon, 21 Nov 2016 23:46:08 +0000 (15:46 -0800)]
Merge pull request #8122 from alsemenn/add_debuggertests_build

Add debuggertests build

7 years agoEnable jit disasm in test scripts
Sven Boemer [Fri, 28 Oct 2016 19:55:57 +0000 (12:55 -0700)]
Enable jit disasm in test scripts

This change adds a section to the generated bash/cmd scripts for each
test that will run jit-dasm on the test dll when runtests is invoked
with the jitdasm flag.

Also begin updating netci.groovy to support jit-diff scenario.

Other minor fixes:
- Add corefxlab feed for System.CommandLine test dependency

  Without this, restoring the test dependencies retrieved an obsolete
  package of the same name from nuget.org.

- Skip jit-diff job generation for arm

  This fixes an assert that was checking that we are in the default
  scenario on arm.

- Fix an assert in netci.groovy

- Add branch that skips non-checked configurations for jitdiff scenario.

- Fix some dasm failures and a typo in dasm job name

- Some jit-dasm runs were failing because the dependencies in the
  current directory wasn't included in the arguments.

- Escape argument to jit-dasm

- increase timeout for jit-diff job

- Put PR job under a trigger, and some temporary changes for testing

- Make PR trigger look for comment

- Update Newtonsoft.Json version for compatibility with cijobs

- Update cijobs version for retrieving job by commit

- Temporarily run only one test

- Archive raw dasm output instead of zip

- Remove pr-specific logic, enable framework dasm

- Remove windows System.Private.CoreLib.ni.dll from test overlay

  The new test runtime dependencies were placing
  System.Private.CoreLib.ni.dll in the core_root directory, which resulted
  in the native image for windows being placed in the coreoverlay
  directory. We already had similar logic handling this case for
  mscorlib.ni.dll.

  This change also fixes the framework dasm output directory to match the
  test dasm output directory, and fixes some typos in the generated .sh
  files for running dasm on linux.

- Add dasm archiving on non-windows jobs

- Use core_root in bash scripts

7 years agoDo not treat certain calls as intrinsics for RyuJIT/x86.
Pat Gavlin [Mon, 21 Nov 2016 21:25:49 +0000 (13:25 -0800)]
Do not treat certain calls as intrinsics for RyuJIT/x86.

On x86 RyuJIT, importing intrinsics that are implemented as user calls
can cause incorrect calculation of the depth of the stack if these
intrinsics are used as arguments to another call. This causes bad code
generation for certain EH constructs. Instead of implementing these
intrinsics as intrinsics, simply import them as calls.

7 years agoMerge pull request #8106 from mikedn/magic-div
Russell C Hadley [Mon, 21 Nov 2016 20:54:46 +0000 (12:54 -0800)]
Merge pull request #8106 from mikedn/magic-div

Move magic division optimization from morph to lowering

7 years agoMerge pull request #8208 from adiaaida/fixShiftDecomp
Michelle McDaniel [Mon, 21 Nov 2016 18:48:05 +0000 (10:48 -0800)]
Merge pull request #8208 from adiaaida/fixShiftDecomp

Fix ordering of operands on GT_RSZ

7 years agoAddress PR feedback.
Pat Gavlin [Mon, 21 Nov 2016 18:38:17 +0000 (10:38 -0800)]
Address PR feedback.

7 years agoCurtail loop unroller epliog generation
Joseph Tremoulet [Thu, 17 Nov 2016 23:46:37 +0000 (15:46 -0800)]
Curtail loop unroller epliog generation

The Jit32 GC encoder puts a hard limit on the number of epilogs (at 4); in
this configuration, avoid unrolling any loops containing enough BBJ_RETURN
blocks to push us over that limit, the same way loop cloning is limited.

Also remove an unnecessary loop flag update to set DONT_UNROLL on some
unprofitable loops -- the loop unroller logic has been rearranged to avoid
reprocessing loops in the first place.

Fixes #8179.

7 years agoUse SET_EPILOGCNT_MAX named constant
Joseph Tremoulet [Mon, 21 Nov 2016 16:15:14 +0000 (08:15 -0800)]
Use SET_EPILOGCNT_MAX named constant

Instead of a hard-coded "4".

7 years agoFix overflow check in unroll cost calculation
Joseph Tremoulet [Thu, 17 Nov 2016 23:18:35 +0000 (15:18 -0800)]
Fix overflow check in unroll cost calculation

Perform the subtraction on signed rather than unsigned ints; if the unroll
size is actually smaller than the fixed size estimate, unrolling is
profitable.

7 years agoMerge pull request #8216 from stephentoub/asynclocal_allocs
Stephen Toub [Mon, 21 Nov 2016 16:09:16 +0000 (11:09 -0500)]
Merge pull request #8216 from stephentoub/asynclocal_allocs

Improve AsyncLocal throughput and memory usage

7 years agoRemove unsafe banned functions (#8162)
Jan Vorlicek [Mon, 21 Nov 2016 15:22:45 +0000 (16:22 +0100)]
Remove unsafe banned functions (#8162)

This change removes _snwprintf, _snprintf and _vsnwprintf usage from CoreCLR and
their implementations from PAL.
PAL exposes their secure variants instead and CoreCLR now uses those instead.
I have also removed the StringCchPrintfA/W, StringCchVPrintfA/W, StringCbVPrintfA/W,
StringCbPrintfA/W, StringCbPrintfExA/W, StringCchVPrintfExA/W, StringCbVPrintfExA/W
and StringCchPrintfExA/W replaced their usage by the secure variants of the sprintf
functions, since they were used at only few places and implementing all of the variants
using the secure sprintf variants would be a hassle.
I also needed to fix a missing support for size modifiers for %p formatting character
and for wide characters / strings in the secure sprintf functions that was revealed
by the PAL tests.
I have also removed a bunch of PAL tests that were using %n formatting character which
was not implemented since it is considered unsafe and translated PAL tests that were using
the removed functions to use the safe variants of those.

7 years agoAddress PR feedback
Stephen Toub [Mon, 21 Nov 2016 12:36:15 +0000 (07:36 -0500)]
Address PR feedback

- Delete !FEATURE_CORECLR code from ExecutionContext
- Add support for downgrading between map types when values are set to null
- Change ManyElementAsyncLocalValueMap.Set to size the dictionary based on whether the key is in the existing map

7 years agoFix "method has no body, 'ret' emitted" warning (#8212)
mikedn [Mon, 21 Nov 2016 02:08:45 +0000 (06:08 +0400)]
Fix "method has no body, 'ret' emitted" warning (#8212)

7 years agoMerge pull request #8057 from CarolEidt/StructOpts2
Carol Eidt [Mon, 21 Nov 2016 02:07:10 +0000 (18:07 -0800)]
Merge pull request #8057 from CarolEidt/StructOpts2

Enable optimization of structs

7 years agoImprove AsyncLocal throughput and memory usage
Stephen Toub [Sun, 20 Nov 2016 22:25:47 +0000 (17:25 -0500)]
Improve AsyncLocal throughput and memory usage

ExecutionContext stores an immutable dictionary used to hold the values of all AsyncLocal instances associated with that context.  Reading an AsyncLocal.Value looks up a value in the dictionary, keyed by the AsyncLocal instance.  Writing an AsyncLocal.Value creates a new dictionary with the contents of the old one and then sets the new pair into it. For small numbers of AsyncLocal instances, this adds a lot of overhead.

This commit adds a new internal IAsyncLocalValueMap interface that's used instead of Dictionary.  It then provides several concrete implementations of that interface, for 1 pair, 2 pairs, 3 pairs, up to 16 pairs, and then up to any number of pairs.  The first three implementations are optimized for those sizes, while the one for up to 16 uses an array, and the one for beyond that is just a Dictionary.

7 years agoDetect duplicate calls to genProduceReg
Mike Danes [Sun, 20 Nov 2016 16:45:59 +0000 (18:45 +0200)]
Detect duplicate calls to genProduceReg

7 years agoFixing arm subsystem version (#8211)
Peter Marcu [Sun, 20 Nov 2016 07:37:51 +0000 (23:37 -0800)]
Fixing arm subsystem version (#8211)

7 years agoGeneric Dictionary - add constructor that accepts IEnumerable
Dan Moseley [Sat, 19 Nov 2016 18:24:21 +0000 (10:24 -0800)]
Generic Dictionary - add constructor that accepts IEnumerable

Generic Dictionary - add constructor that accepts IEnumerable

7 years agoFix warnings in native test code
Mike Danes [Sat, 19 Nov 2016 09:18:58 +0000 (11:18 +0200)]
Fix warnings in native test code

7 years agoAdd System.Collections.Generic.Dictionary constructor that accepts
Robert Matusewicz [Thu, 17 Nov 2016 09:37:43 +0000 (09:37 +0000)]
Add System.Collections.Generic.Dictionary constructor that accepts
IEnumerable<KeyValyePair<TKey, TValue>> to initialize dictionary

7 years agoReinstate the struct optimization changes:
Carol Eidt [Wed, 9 Nov 2016 17:09:49 +0000 (09:09 -0800)]
Reinstate the struct optimization changes:

Remove many of the restrictions on structs that were added to preserve behavior of the old IR form.
Change the init block representation to not require changing the parent when a copy block is changed to an init.
In addition, fix the bug that was causing the corefx  ValueTuple  tests to fail. This was a bug in assertion prop where it was not invaliding the assertions about the parent struct when a field is modified. Add a repro test case for that bug.
Incorporate the fix to #7954, which was encountered after the earlier version of these changes. This was a case where we reused a struct temp, and then it wound up eventually getting assigned the value it originally contained, so we had V09 = V09. This hit the assert in liveness where it wasn't expecting to find a struct assignment with the same lclVar on the lhs and rhs. This assert should have been eliminated with the IR change to struct assignments, but when this situation arises we may run into issues if we call a helper that doesn't expect the lhs and rhs to be the same. So, change morph to eliminate such assignments.

7 years agoFix ordering of operands on GT_RSZ
Michelle McDaniel [Fri, 18 Nov 2016 22:12:30 +0000 (14:12 -0800)]
Fix ordering of operands on GT_RSZ

By removing hiOp1 and loOp1 from LIR and then putting them back in, we
inadvertantly reversed the order of operations for high and lo. This is an
issue when op1 is a long add or sub where the order of operations is
important.

Fixes 8171.

7 years agoFix two bugs revealed during internal testing.
Pat Gavlin [Fri, 18 Nov 2016 21:30:24 +0000 (13:30 -0800)]
Fix two bugs revealed during internal testing.

- gtNewTempAssign was unnecessarily creating a new node to represent the
  value being assigned to a temp if the value was a normalize-on-load
  lclVar. This caused problems when using `gtNewTempAssign` as part of
  `LIR::Use::ReplaceWithLclVar`, which assumes that `gtNewTempAssign`
  only creates a single node (the new `st.lclVar` node). Instead of
  creating a new lclVar node, simply change the type of the existing
  node.
- LowerSignedDivOrMod contained an unnecessarily strong assertion. This
  assertion has been removed.

7 years agoMerge pull request #8180 from jashook/arm64_lst_update
Jarret Shook [Fri, 18 Nov 2016 21:28:31 +0000 (13:28 -0800)]
Merge pull request #8180 from jashook/arm64_lst_update

Update the lst file to exclude failing tests.

7 years agoMerge pull request #8097 from pgavlin/VSO279396
Pat Gavlin [Fri, 18 Nov 2016 21:19:29 +0000 (13:19 -0800)]
Merge pull request #8097 from pgavlin/VSO279396

Do not fold (ind (addr (lclVar))) in certain cases.

7 years agoDelete dead files (#8202)
Jan Kotas [Fri, 18 Nov 2016 21:03:01 +0000 (13:03 -0800)]
Delete dead files (#8202)

7 years agoAdd CI job and build.cmd command for building with FEATURE_STANDALONE_GC (#8183)
Sean Gillespie [Fri, 18 Nov 2016 20:57:38 +0000 (12:57 -0800)]
Add CI job and build.cmd command for building with FEATURE_STANDALONE_GC (#8183)

* Add CI job and build.cmd command for building with FEATURE_STANDALONE_GC

* Add missed case

* Correct a condition

* Accidental fallthrough in switch

* Only run on x64

7 years agoUpdate the lst file to exclude failing tests.
jashook [Thu, 17 Nov 2016 18:18:24 +0000 (10:18 -0800)]
Update the lst file to exclude failing tests.

These are new regressions that were introduced during CI downtime.

7 years agoOrganizing the perflab tests under a common namespace. (#8184)
José Rivero [Fri, 18 Nov 2016 19:24:07 +0000 (11:24 -0800)]
Organizing the perflab tests under a common namespace. (#8184)

- These changes adds a hierarchy to the perflab tests under BenchView.

7 years agoUpdate with corefx PR changes
Ian Hays [Fri, 18 Nov 2016 18:50:17 +0000 (10:50 -0800)]
Update with corefx PR changes

7 years agoMerge pull request #8198 from pgavlin/GH8170
Pat Gavlin [Fri, 18 Nov 2016 18:46:46 +0000 (10:46 -0800)]
Merge pull request #8198 from pgavlin/GH8170

Fix codegen for `(umod (gt_long) (const int))`.

7 years agoFix codegen for `(umod (gt_long) (const int))`.
Pat Gavlin [Fri, 18 Nov 2016 06:37:17 +0000 (22:37 -0800)]
Fix codegen for `(umod (gt_long) (const int))`.

When targeting x86, we opt not to use a helper call to implement the
64-bit unsigned modulus operator if we have a tree of either of the
following forms:
- `(umod ulong (x ulong) (cast ulong (const int const_val)))`
- `(umod ulong (x ulong) (const ulong const_val))`
where `const_val` falls in the range `[2, 0x3fffffff]`.

We eventually decompose this into `(umod uint (gt_long lo hi) (const int const_val))`.
This was then emitted as:

      mov eax, lo
      mov edx, hi
      mov reg, const_val

      div edx:eax reg

Unfortunately, this generated code does not take into account the fact
that the result of the modulus may not fit into 32 bits. This can cause
an overflow exception at runtime despite the fact that the modulus
originally produced a 64-bit result.

This change fixes the code generation to check for overflow before
performing the modulus and perform a 64-bit division if the result would
overflow. This results in generated code like the following:

      mov eax, lo
      mov edx, hi
      mov reg, const_val

      cmp edx, reg
      jb noOverflow
      mov temp, eax
      mov edx, eax
      xor edx, edx
      div edx:eax, const_val
      mov eax, temp

    noOverflow:
      div edx:eax, const_val

Which is identical to the code produced by JIT32 and the legacy backend.

7 years agoMerge pull request #8194 from AndyAyersMS/FixMismatchTests
Pat Gavlin [Fri, 18 Nov 2016 16:02:12 +0000 (08:02 -0800)]
Merge pull request #8194 from AndyAyersMS/FixMismatchTests

Revise mismatch tests so they don't rely on undefined behavior

7 years agoAdd missing Arg_BadDecimal resource string (#8197)
mikedn [Fri, 18 Nov 2016 14:19:12 +0000 (18:19 +0400)]
Add missing Arg_BadDecimal resource string (#8197)

7 years agoMerge pull request #8178 from adiaaida/excludeHeapVerify
Russ Keldorph [Fri, 18 Nov 2016 11:11:09 +0000 (03:11 -0800)]
Merge pull request #8178 from adiaaida/excludeHeapVerify

Exclude tests that timeout with HeapVerify

7 years agoMerge pull request #8187 from pgavlin/gh8150
Pat Gavlin [Fri, 18 Nov 2016 04:37:50 +0000 (20:37 -0800)]
Merge pull request #8187 from pgavlin/gh8150

Fix the transformation of `(call ARRADDR_ST x, y, null)`.

7 years agoType sigs (#8191)
Dan Moseley [Fri, 18 Nov 2016 03:39:43 +0000 (19:39 -0800)]
Type sigs (#8191)

7 years agoMerge pull request #8182 from mikedn/x86-cmp-long-linqmax
Sivarv [Fri, 18 Nov 2016 03:24:12 +0000 (19:24 -0800)]
Merge pull request #8182 from mikedn/x86-cmp-long-linqmax

Fix x86 long compares that produce a result

7 years agoFormat code.
Pat Gavlin [Fri, 18 Nov 2016 02:58:06 +0000 (18:58 -0800)]
Format code.

7 years agoRevise mismatch tests so they don't rely on undefined behavior
Andy Ayers [Fri, 18 Nov 2016 00:06:46 +0000 (16:06 -0800)]
Revise mismatch tests so they don't rely on undefined behavior

The mismatch32 and mismatch64 tests ensure that the jit will avoid
inlining in cases where there are bad type mismatches at call sites.

This change modifies the tests so that by default the call with the
bad type mismatch is not hit at runtime, since execution of this code
exposes undefined behavior that can be arch or jit specific (eg failing
on x86 and passing on other architectures).

The problematic call can still be hit at runtime by passing at least one
command line argument.

Remove the associated test exclusions for x86.

Fixes #8152.

7 years agoFix the transformation of `(call ARRADDR_ST x, y, null)`.
Pat Gavlin [Thu, 17 Nov 2016 23:49:49 +0000 (15:49 -0800)]
Fix the transformation of `(call ARRADDR_ST x, y, null)`.

`fgMorphCall` transforms `(call ARRADDR_ST x, y, null)` into
`(assign (arrindex x y) null)`. The transformation was not taking into
account the fact that the operands to the call might have been spilled
to temps, and was therefore silently dropping code in the case that they
had been.

This change collects all argument setup nodes in `gtCallArgs` in a
sequence of comma nodes if any exist and attaches the assignment
expression as the ultimate LHS of the comma tree.

Fixes #8150.

7 years agoAdd Unix FileStream Lock/Unlock
Ian Hays [Thu, 17 Nov 2016 23:36:31 +0000 (15:36 -0800)]
Add Unix FileStream Lock/Unlock

Implements FileStream Lock/Unlock by calling the SystemNative functions for fcntl F_SETLK