platform/upstream/coreclr.git
8 years agoMerge pull request #4068 from Lucrecious/master
Brian Robbins [Wed, 13 Apr 2016 21:15:14 +0000 (14:15 -0700)]
Merge pull request #4068 from Lucrecious/master

Generate map files for symbol resolution for Linux native images on PerfView

8 years agoMerge pull request #4303 from CarolEidt/NoBarrierLclVarAddr
Carol Eidt [Wed, 13 Apr 2016 18:43:40 +0000 (11:43 -0700)]
Merge pull request #4303 from CarolEidt/NoBarrierLclVarAddr

No GC barrier needed for indirection of expressions involving lclVars

8 years agoEnable SOS gcInfo command. All it does basically is just enable the gcdecoder
Zhicheng Zhu [Wed, 13 Apr 2016 18:40:47 +0000 (11:40 -0700)]
Enable SOS gcInfo command. All it does basically is just enable the gcdecoder

Enable SOS gcInfo command. Basically all it does is just enable the code related to sos gcInfo and make it compiled for linux.

8 years agoMerge pull request #4295 from fadimounir/typesystemtests
Fadi Hanna [Wed, 13 Apr 2016 17:40:38 +0000 (10:40 -0700)]
Merge pull request #4295 from fadimounir/typesystemtests

Bulk port of TypeSystem test cases

8 years agoMerge pull request #4310 from RussKeldorph/arglist
Russ Keldorph [Wed, 13 Apr 2016 17:29:40 +0000 (10:29 -0700)]
Merge pull request #4310 from RussKeldorph/arglist

Port arglist tests for x86 and ARM

8 years agoNo GC barrier needed for LclVar address expressions
Carol Eidt [Tue, 12 Apr 2016 19:53:31 +0000 (12:53 -0700)]
No GC barrier needed for LclVar address expressions

The check for the case where a barrier is not required when writing to a
local variable needs to include the LocalVarAddr and lclVar address
expression cases.

Update per comments

8 years agoMerge pull request #4302 from kyulee1/badtest
Kyungwoo Lee [Wed, 13 Apr 2016 12:27:14 +0000 (05:27 -0700)]
Merge pull request #4302 from kyulee1/badtest

ARM64: Tests update

8 years agoARM64: Tests update
Kyungwoo Lee [Tue, 12 Apr 2016 20:30:31 +0000 (13:30 -0700)]
ARM64: Tests update

- Delete bad test (sql_stress4) which uses Thread.Abort which is not in
  .NET Core.
- Delete non-existing test (MarshalBoolArray)
- Update time-out for StringConcat4/StringConcat8 which usualy failed due to time-out.
- Made _opt_dbgexplicit5/_opt_relexplicit5 UNSTABLE which pass mostly when
  running twice in the lab.
- Delete bad test (b519927) which uses AppDomain.DefineDynamicAssembly
  which is not in .NET Core.
- Delete bad test (b16241) that has overflow conversion (from double to int).

8 years agoMerge pull request #4074 from kouvel/SoftwareWriteWatch
Koundinya Veluri [Wed, 13 Apr 2016 04:19:01 +0000 (21:19 -0700)]
Merge pull request #4074 from kouvel/SoftwareWriteWatch

Implement software write watch and make concurrent GC functional outs…

8 years agoPort arglist tests for x86 and ARM
Russ Keldorph [Tue, 12 Apr 2016 18:49:58 +0000 (11:49 -0700)]
Port arglist tests for x86 and ARM

Arglist tests, which are only valid on Windows, have non-x64 versions that
needed to be ported.

8 years agoMerge pull request #4273 from sivarv/multireg2
Sivarv [Wed, 13 Apr 2016 01:38:51 +0000 (18:38 -0700)]
Merge pull request #4273 from sivarv/multireg2

Force IR to be always var=call in case of multi-reg returning call nodes plus refactoring changes

8 years agoMerge pull request #4255 from pgavlin/GcInfoArrayList
Pat Gavlin [Tue, 12 Apr 2016 23:57:42 +0000 (16:57 -0700)]
Merge pull request #4255 from pgavlin/GcInfoArrayList

Refactor `StructArrayList` for the GC info encoder.

8 years agoImplement software write watch and make concurrent GC functional outside Windows
Koundinya Veluri [Thu, 7 Jan 2016 19:21:27 +0000 (11:21 -0800)]
Implement software write watch and make concurrent GC functional outside Windows

- Implemented software write watch using write barriers
- A new set of write barriers is introduced, each corresponding to an existing one, but which also updates the write watch table. The GC switches to a write watch barrier during concurrent GC, and switches back to a non write watch barrier after the final query for dirty pages.
- The write watch table is alloacted along with the card table
- Since the card table is used differently, different synchonization is used for the write watch table. The runtime is suspended during resize since that is the most infrequently occuring operation, of that, ResetWriteWatch, and GetWriteWatch.
- ResetWriteWatch() doesn't need a suspend, but since the software WW version is much faster than the Windows version, moved it into the suspended region to avoid some synchronization that would otherwise be required
- The background calls to GetWriteWatch() don't need or do a suspend. They only need to synchronize with the resize path, not for the purpose of correct functionality, but to not miss dirty pages such that concurrent GC is effective.

Miscellaneous:
- Fixed runtests.sh to copy mscorlib.dll and delete the Windows version of mscorlib.ni.dll

8 years agoMerge pull request #4278 from RussKeldorph/t1
Russ Keldorph [Tue, 12 Apr 2016 23:14:41 +0000 (16:14 -0700)]
Merge pull request #4278 from RussKeldorph/t1

Fix two "missing DLL" test failures

8 years agoMerge pull request #4296 from mmitche/fix-prefix-casing
Matt Mitchell [Tue, 12 Apr 2016 22:46:57 +0000 (15:46 -0700)]
Merge pull request #4296 from mmitche/fix-prefix-casing

Fix output casing of prefix dir

8 years agoRefactoring changes to use ReturnTypeDesc in codegenxarch.
sivarv [Mon, 11 Apr 2016 18:49:41 +0000 (11:49 -0700)]
Refactoring changes to use ReturnTypeDesc in codegenxarch.

8 years agoMerge pull request #4279 from swaroop-sridhar/GC
Swaroop Sridhar [Tue, 12 Apr 2016 20:32:10 +0000 (13:32 -0700)]
Merge pull request #4279 from swaroop-sridhar/GC

GCInfo: Fix ARM64 GCInfo decoding

8 years agoBulk port of TypeSystem test cases
Fadi Hanna [Tue, 12 Apr 2016 00:27:01 +0000 (17:27 -0700)]
Bulk port of TypeSystem test cases

8 years agoClean up StructArrayList for GC info.
Pat Gavlin [Fri, 8 Apr 2016 22:39:55 +0000 (15:39 -0700)]
Clean up StructArrayList for GC info.

- Move the code into the GC info encoder, as that is its
  only consumer.
- Remove contracts
- Delete dead code
- Reformat and refactor to current coding standards

8 years agoMerge pull request #4292 from janvorli/hw-exceptions-change
Jan Vorlicek [Tue, 12 Apr 2016 19:18:32 +0000 (21:18 +0200)]
Merge pull request #4292 from janvorli/hw-exceptions-change

Fix hardware exception handling in native code on BSD

8 years agoMerge pull request #4294 from kyulee1/fixsp
Kyungwoo Lee [Tue, 12 Apr 2016 18:25:40 +0000 (11:25 -0700)]
Merge pull request #4294 from kyulee1/fixsp

ARM64: Fix for recording SP for handler.

8 years agoFix output casing of prefix dir
Matt Mitchell [Tue, 12 Apr 2016 16:48:00 +0000 (09:48 -0700)]
Fix output casing of prefix dir

The PREFIX dir is upper case, should be refered to as such.  Blocker for building on Linux

8 years agoFix two "missing DLL" test failures
Russ Keldorph [Sun, 10 Apr 2016 10:58:19 +0000 (03:58 -0700)]
Fix two "missing DLL" test failures

Fix #2234 Missing native DLL
Fix #2237 Missing DLL is a MC++ test hiding alongside a C# wrapper--delete
    test which was mistakenly ported.

8 years agoMerge pull request #4085 from LLITCHEV/Issue3618-1
Lubomir Litchev [Tue, 12 Apr 2016 17:39:28 +0000 (10:39 -0700)]
Merge pull request #4085 from LLITCHEV/Issue3618-1

Fix a bug in the code for inserting a tree in the linear order.

8 years agofix GCInfo build problem, tested a few simple "HelloWorld" program works good!
Zhicheng Zhu [Mon, 11 Apr 2016 18:01:21 +0000 (11:01 -0700)]
fix GCInfo build problem, tested a few simple "HelloWorld" program works good!

8 years agoARM64: Fix for recording SP for handler.
Kyungwoo Lee [Tue, 12 Apr 2016 16:11:53 +0000 (09:11 -0700)]
ARM64: Fix for recording SP for handler.

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

When GC occurs in a catch handler, we compare the current frame with the one
saved before the funclet was invoked.
The recorded SP address was wrong (offset by 16 byte), which caused FindParentStackFrameForStackWalk to null frame.
So, we ended up with assert on `ExceptionTracker::HasFrameBeenUnwoundByAnyActiveException(&m_crawl)`.
The issue was assembly helper, CallEHFunclet records FP instead of SP while SP is adjusted in prolog.

8 years agoMerge pull request #4290 from leemgs/upstream-clang38
Jan Kotas [Tue, 12 Apr 2016 13:42:03 +0000 (03:42 -1000)]
Merge pull request #4290 from leemgs/upstream-clang38

Add clang-3.8 into build.sh

8 years agoMerge pull request #4187 from stephentoub/lcts_dispose_cancel_race
Stephen Toub [Tue, 12 Apr 2016 13:19:29 +0000 (09:19 -0400)]
Merge pull request #4187 from stephentoub/lcts_dispose_cancel_race

Fix race condition between CTS.Cancel and Dispose

8 years agoFix hardware exception handling in native code on BSD
Jan Vorlicek [Mon, 11 Apr 2016 12:21:01 +0000 (14:21 +0200)]
Fix hardware exception handling in native code on BSD

There is a problem with hardware exception handling when the exception
happens in native code and it is under the HardwareExceptionHolder on
FreeBSD and NetBSD. The problem was that the C++ unwinder was unable
to cross the signal trampoline.
This change fixes the problem by throwing the PAL_SEHException from
the context of the hardware exception itself rather than from the
signal handler.
Since it uses the same code as we were using for StartUnwindingNativeFrames
in CoreCLR before, I have moved that stuff to PAL and let both CoreCLR and
the signal handlers use it too.
At the same time, I have reenabled the paltest_pal_sxs_test1 for FreeBSD and
NetBSD, since it now works.

8 years agoMerge pull request #4280 from krytarowski/netbsd-support-59
Jan Vorlicek [Tue, 12 Apr 2016 08:15:03 +0000 (10:15 +0200)]
Merge pull request #4280 from krytarowski/netbsd-support-59

Use _lwp_self() in THREADSilentGetCurrentThreadId() for NetBSD

8 years agoAdd clang-3.8 into build.sh
Geunsik Lim [Tue, 12 Apr 2016 06:11:53 +0000 (15:11 +0900)]
Add clang-3.8 into build.sh

According to the official release note, clang 3.8 is also stable version.
http://llvm.org/releases/download.html
Let's add version 3.8 of clang into build.sh script.

Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
8 years agoMerge pull request #4274 from davmason/master
David Mason [Tue, 12 Apr 2016 04:13:24 +0000 (21:13 -0700)]
Merge pull request #4274 from davmason/master

Bug Fixes for EventSource

8 years agoFix a bug in the code for inserting a tree in the linear order.
Lubomir Litchev [Tue, 5 Apr 2016 17:31:20 +0000 (10:31 -0700)]
Fix a bug in the code for inserting a tree in the linear order.

A long standing issue in the Compiler::fgInsertTreeInListBefore method was
found where the gtStmtList of a statement was not updated when a tree is
inserted before the first statement in the list (stmt->gtStmtList ==
insertionPoint). In such case the gtStmtList is not updated to include the
new tree(s) inserted.

After talking to few people offline to understand where this fix should be made
and realizing that the comment on Compiler::fgMakeEmbeddedStmt is
incorrect, I made the necessary fix in Compiler::fgInsertTreeInListBefore
so the newly inserted tree(s) in includedin the gtStmtList of the updated
stmt.

Fixes 3618.

8 years agoUse _lwp_self() in THREADSilentGetCurrentThreadId() for NetBSD
Kamil Rytarowski [Tue, 12 Apr 2016 00:26:54 +0000 (02:26 +0200)]
Use _lwp_self() in THREADSilentGetCurrentThreadId() for NetBSD

The _lwp_self() call returns the LWP ID of the calling LWP.
It requires <lwp.h> on NetBSD.

8 years agoMerge pull request #4101 from sejongoh/detect_ldsfld_access_non_static_field
Sejong Oh [Tue, 12 Apr 2016 00:19:29 +0000 (17:19 -0700)]
Merge pull request #4101 from sejongoh/detect_ldsfld_access_non_static_field

Check if LDSFLD accesses non-static field

8 years agoMerge pull request #4277 from mikem8361/rpath
Mike McLaughlin [Tue, 12 Apr 2016 00:06:44 +0000 (17:06 -0700)]
Merge pull request #4277 from mikem8361/rpath

Unable to debug coreclr apps on Debian 8.2 (Issue #4263)

8 years agoUnable to debug coreclr apps on Debian 8.2 (Issue #4263)
Mike McLaughlin [Mon, 11 Apr 2016 22:37:42 +0000 (15:37 -0700)]
Unable to debug coreclr apps on Debian 8.2 (Issue #4263)

Add set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) to dbi and sos cmake files.

8 years agoMerge pull request #4218 from mikem8361/symbols
Mike McLaughlin [Mon, 11 Apr 2016 23:55:44 +0000 (16:55 -0700)]
Merge pull request #4218 from mikem8361/symbols

Add symbol packages for coreclr runtime.

8 years agoMerge pull request #4272 from AndyAyersMS/FixSpectralNorm
Andy Ayers [Mon, 11 Apr 2016 23:52:45 +0000 (16:52 -0700)]
Merge pull request #4272 from AndyAyersMS/FixSpectralNorm

Fix validation of spectralnorm under xunit-performance

8 years agoGCInfo: Fix ARM64 GCInfo decoding
Swaroop Sridhar [Fri, 8 Apr 2016 01:09:13 +0000 (18:09 -0700)]
GCInfo: Fix ARM64 GCInfo decoding

GCStress traps were not inserted in ARM64 code correctly because safepoint
offsets were not correctly computed by EnumerateSafepoints().

This change fixes the issue by adding the (-1) adjustment to the ARM64
Safepoint offsets, similar to ARM and AMD64.

8 years agoMerge pull request #4113 from swgillespie/long_running_gc
Sean Gillespie [Mon, 11 Apr 2016 22:58:49 +0000 (15:58 -0700)]
Merge pull request #4113 from swgillespie/long_running_gc

Create Long-running GC test job for the CI

8 years agoBuffer sending of large manifests
David Mason [Mon, 11 Apr 2016 20:41:29 +0000 (13:41 -0700)]
Buffer sending of large manifests

8 years agoMerge pull request #4157 from chuckries/master
Aditya Mandaleeka [Mon, 11 Apr 2016 22:24:11 +0000 (15:24 -0700)]
Merge pull request #4157 from chuckries/master

Fix error return in getPath

8 years agoMerge pull request #4266 from janvorli/fix-brick-table-issue
Maoni Stephens [Mon, 11 Apr 2016 22:22:15 +0000 (15:22 -0700)]
Merge pull request #4266 from janvorli/fix-brick-table-issue

Fix brick table issue on Unix

8 years agoMerge pull request #4261 from yizhang82/byvalarray_fix
Yi Zhang (CLR) [Mon, 11 Apr 2016 22:15:28 +0000 (15:15 -0700)]
Merge pull request #4261 from yizhang82/byvalarray_fix

Fix ByValArray support.

ByValArray marshalling is implemented actually in OleVariant.cpp, which implements both regular array marshalling and variant marshalling). Regular array marshalling code should be supported in x-plat but it was incorrectly #ifdef-ed out. Fix by only #ifdef the COM interop VARIANT part.

Fix #4262 and #4194

8 years agoAdd symbol packages for coreclr runtime.
Mike McLaughlin [Tue, 5 Apr 2016 00:52:15 +0000 (17:52 -0700)]
Add symbol packages for coreclr runtime.

Depends on the new buildtools symbol support.

Update build tools version containing the new symbol file support.

8 years agoMerge remote-tracking branch 'upstream/master'
Mike McLaughlin [Mon, 11 Apr 2016 21:54:33 +0000 (14:54 -0700)]
Merge remote-tracking branch 'upstream/master'

8 years agoFix validation of spectralnorm under xunit-performance
Andy Ayers [Mon, 11 Apr 2016 21:21:56 +0000 (14:21 -0700)]
Fix validation of spectralnorm under xunit-performance

The valiation code wasn't correctly for the iteration strategy
used by xunit-performance.

Closes #4270.

8 years agoFix bug where Tags weren't respected in tracelogging.
David Mason [Mon, 11 Apr 2016 20:40:18 +0000 (13:40 -0700)]
Fix bug where Tags weren't respected in tracelogging.

8 years agoIncrease max etw arguments to 64
David Mason [Mon, 11 Apr 2016 20:38:16 +0000 (13:38 -0700)]
Increase max etw arguments to 64

8 years agoMerge pull request #4269 from adiaaida/longSub
Michelle McDaniel [Mon, 11 Apr 2016 20:21:45 +0000 (13:21 -0700)]
Merge pull request #4269 from adiaaida/longSub

Add support for x86 long subtract operator

8 years agoMerge pull request #4206 from BruceForstall/RyujitX86
Bruce Forstall [Mon, 11 Apr 2016 19:23:33 +0000 (12:23 -0700)]
Merge pull request #4206 from BruceForstall/RyujitX86

Clean up JIT build rules

8 years agoMerge pull request #4221 from BruceForstall/Cleanup1
Bruce Forstall [Mon, 11 Apr 2016 19:23:02 +0000 (12:23 -0700)]
Merge pull request #4221 from BruceForstall/Cleanup1

Cleanup: be consistent about compCalleeFPRegsSavedMask #ifdefs

8 years agoMerge pull request #4239 from BruceForstall/Cleanup2
Bruce Forstall [Mon, 11 Apr 2016 19:22:46 +0000 (12:22 -0700)]
Merge pull request #4239 from BruceForstall/Cleanup2

Cleanup: remove getFramePointerReg()

8 years agoMerge pull request #4242 from BruceForstall/Cleanup3
Bruce Forstall [Mon, 11 Apr 2016 19:22:25 +0000 (12:22 -0700)]
Merge pull request #4242 from BruceForstall/Cleanup3

Add genEstablishFramePointer() to enapsulate frame pointer creation

8 years agoMerge pull request #4243 from BruceForstall/Cleanup4
Bruce Forstall [Mon, 11 Apr 2016 19:21:56 +0000 (12:21 -0700)]
Merge pull request #4243 from BruceForstall/Cleanup4

Minor JIT changes

8 years agoAdd longgc to a new assert
Sean Gillespie [Mon, 11 Apr 2016 19:02:07 +0000 (12:02 -0700)]
Add longgc to a new assert

8 years agoAdd new trigger phrases to documentation
Sean Gillespie [Mon, 11 Apr 2016 18:52:16 +0000 (11:52 -0700)]
Add new trigger phrases to documentation

8 years agoCreate Long-running GC test job for the CI
Sean Gillespie [Fri, 11 Mar 2016 23:48:56 +0000 (15:48 -0800)]
Create Long-running GC test job for the CI

8 years agoFix JIT crash with static function accessing non-static field
Sejong Oh [Wed, 6 Apr 2016 00:52:14 +0000 (17:52 -0700)]
Fix JIT crash with static function accessing non-static field

The IL below is invalid since the static function acceses the non-static
field. On Desktop CRL, JIT throws a verification exception. However, CoreCLR
doesn't support verification and JIT crashes. This fix makes JIT throw a
invalid program exception if verification is disabled.

.field int32 i
.method static int32 f()
{
ldsfld int32 Test::i
ret
}

The test also expects InvalidProgramException instead of
VerificationException.

8 years agoMerge pull request #4268 from RussKeldorph/ignore
Russ Keldorph [Mon, 11 Apr 2016 18:11:35 +0000 (11:11 -0700)]
Merge pull request #4268 from RussKeldorph/ignore

Add missing arch-specifc strings in .gitignore

8 years agoAdd support for x86 long subtract operator
Michelle McDaniel [Mon, 11 Apr 2016 17:24:41 +0000 (10:24 -0700)]
Add support for x86 long subtract operator

With #3296, we have all the support for subtracting longs on x86. Subtract
can use the same logic as addition for longs.

Fixes #4189.

8 years agoByValArray marshaling support is implemented in OleVariant.cpp (which actually implem...
Yi Zhang (CLR) [Mon, 11 Apr 2016 06:59:35 +0000 (23:59 -0700)]
ByValArray marshaling support is implemented in OleVariant.cpp (which actually implements both regular array marshalling and variant marshalling) and is incorrectly #ifdef-ed out under x-plat. Fix by only #ifdef the COM interop VARIANT part.

Re-enable ByValArray test as well.

8 years agoAdd missing arch-specifc strings in .gitignore
Russ Keldorph [Wed, 30 Mar 2016 18:16:40 +0000 (11:16 -0700)]
Add missing arch-specifc strings in .gitignore

I would prefer that the test build not drop cruft outside of designated
folders like bin, but unless/until that happens we should at least make
the architectures' builds consistent.

8 years agoMerge pull request #4240 from LLITCHEV/Issue4147
Lubomir Litchev [Mon, 11 Apr 2016 14:58:49 +0000 (07:58 -0700)]
Merge pull request #4240 from LLITCHEV/Issue4147

Add test for issue 4115.

8 years agoMerge pull request #4245 from AndyAyersMS/ModelPolicy
Andy Ayers [Mon, 11 Apr 2016 14:44:21 +0000 (07:44 -0700)]
Merge pull request #4245 from AndyAyersMS/ModelPolicy

Inliner: initial version of a model-based policy

8 years agoFix brick table issue on Unix
Jan Vorlicek [Mon, 11 Apr 2016 11:42:07 +0000 (13:42 +0200)]
Fix brick table issue on Unix

There is a problem with Clang compiling a loop that sets a range of brick
table entries that are "shorts" as a memset. That causes it to be written
by bytes in some cases on OSX (and it is a mere chance that the memset on
Linux is implemented so that it doesn't use byte access).
This was causing corruption of the brick table on OSX.
The fix is to mark the pointer that iterates over the brick table as volatile
to prevent the compiler from using the memset.

8 years agoMerge pull request #3990 from myungjoo/testing/fix3856
Jan Kotas [Mon, 11 Apr 2016 06:03:19 +0000 (20:03 -1000)]
Merge pull request #3990 from myungjoo/testing/fix3856

Fix Linux-ARM Broken Stack w/ ThePreStub

8 years agoMerge pull request #4257 from jkotas/noexecstack
Jan Kotas [Mon, 11 Apr 2016 06:00:34 +0000 (20:00 -1000)]
Merge pull request #4257 from jkotas/noexecstack

Pass noexecstack option to the assembler on Linux

8 years agoAdd a test for Issue 4147.
Lubomir Litchev [Sun, 10 Apr 2016 20:46:01 +0000 (13:46 -0700)]
Add a test for Issue 4147.

This checkin adds a test for Issue 4147.

8 years agoFix race condition between CTS.Cancel and Dispose
stephentoub [Fri, 8 Apr 2016 17:01:19 +0000 (13:01 -0400)]
Fix race condition between CTS.Cancel and Dispose

In general, CancellationTokenSource.Dispose is not meant to be used concurrently with other operations on the instance: Dispose should only be used when the creator of the CTS is done with it.  However, there's one common situation where recommended usage runs afoul of this.  A typical usage of a LinkedCancellationTokenSource (as created by CancellationTokenSource.CreateLinkedTokenSource) is as follows:
```C#
private CancellationToken _internalCancellation;

public void SomeMethod(CancellationToken externalCancellation)
{
    using (var cts = CancellationTokenSource.CreateLinkedTokenSource(externalCancellation, _internalCancellation))
    {
        DoWork(cts.Token);
    }
}
```
where an LCTS is used to combine some external source of cancellation with some internal one.  It's important that the LCTS then be disposed, as otherwise it'll end up leaking state into constituent CTs, and in particular in the case of the externally provided one, that could be a very long lived token.  However, it's perfectly fine for the external token to have cancellation requested at any time during this method, which means that even though Dispose and Cancel weren't designed to be safe to execute concurrently, and even though we recommend against it, it's actually possible with recommended usage.

It's a very dificult race to reproduce, but when it does, the typical visible result is an ObjectDisposedException.  State corruption could also result.

This commit addresses that in two ways:
1. Rather than having the LCTS register a delegate with each CT that calls Cancel, it instead has its delegate call NotifyCancellation.  This is the same method Cancel calls, but without the upfront disposal check.  That eliminates the easily visible result of a race that would cause an ObjectDisposedException.
2. With all of the tweaking that's been done to Dispose since it was originally written, it's actually very close to being safe to use concurrently with Cancel; this takes it the rest of the way (though we still don't want to document it as such, it's really just to make LCTS work correctly).  The only state Dispose mutates that could be problematic is a Timer and a ManualResetEvent.  Timer's Dispose is already thread-safe.  MRE's isn't, so if it's been allocated (which is relatively rare), I add a single Interlocked.Exchange to null it out, and then do a volatile read on a state field to see whether cancellation is currently in progress, only Dispose'ing of the MRE if it is, and leaving it for finalization otherwise.  On the Cancel side, we just add some null checks to ensure we're not attempting to Dispose of null'd out fields, again with volatile reads where necessary.

8 years agoMerge pull request #4250 from yizhang82/nativevariant_fix
Yi Zhang (CLR) [Sun, 10 Apr 2016 04:59:35 +0000 (21:59 -0700)]
Merge pull request #4250 from yizhang82/nativevariant_fix

Fix GetObjectForNativeVariant test issue. It should roundtrip the actual object instead of IntPtr. Also add proper variant clean up code.

Fix #4192.

8 years agoPass noexecstack option to the assembler on Linux
Jan Kotas [Sun, 10 Apr 2016 04:15:42 +0000 (18:15 -1000)]
Pass noexecstack option to the assembler on Linux

8 years agoMerge pull request #4253 from jamesqo/faulty-trues
Jan Kotas [Sun, 10 Apr 2016 01:51:18 +0000 (15:51 -1000)]
Merge pull request #4253 from jamesqo/faulty-trues

Fix a couple of erroneous assert(trues)

8 years agoMerge pull request #4256 from yizhang82/chararray_fix
Yi Zhang (CLR) [Sun, 10 Apr 2016 01:13:51 +0000 (18:13 -0700)]
Merge pull request #4256 from yizhang82/chararray_fix

Change Marshal.SizeOf to sizeof to calculate buffer size because Marshal.Copy copies managed contents, while Marshal.SizeOf gives native size. Fix #4254

8 years agoChange Marshal.SizeOf to sizeof because Marshal.Copy copies managed contents and...
Yi Zhang (CLR) [Sat, 9 Apr 2016 20:18:36 +0000 (13:18 -0700)]
Change Marshal.SizeOf to sizeof because Marshal.Copy copies managed contents and does not do marshalling.

8 years agoMerge pull request #4249 from yizhang82/lptstr_fix
Yi Zhang (CLR) [Sat, 9 Apr 2016 19:44:17 +0000 (12:44 -0700)]
Merge pull request #4249 from yizhang82/lptstr_fix

Fix LPTSTRTest failure - it has a incorrect constant probably due to bad merge. Fix #4197

8 years agoFix GetObjectForNativeVariant test issue. It should roundtrip the actual object inste...
Yi Zhang (CLR) [Sat, 9 Apr 2016 06:22:51 +0000 (23:22 -0700)]
Fix GetObjectForNativeVariant test issue. It should roundtrip the actual object instead of IntPtr. Also add proper variant clean up code.

NOTE that I had to keep Marshal.IUnknownForObject call to force COM initialization.

8 years agoMerge remote-tracking branch 'upstream/master'
Mike McLaughlin [Sat, 9 Apr 2016 18:26:05 +0000 (11:26 -0700)]
Merge remote-tracking branch 'upstream/master'

8 years agoFix LPTSTRTest failure - it has a incorrect constant probably due to bad porting...
Yi Zhang (CLR) [Sat, 9 Apr 2016 02:39:48 +0000 (19:39 -0700)]
Fix LPTSTRTest failure - it has a incorrect constant probably due to bad porting. Also remove StringMarshal tests from issues.targets

8 years agoFix a couple of erroneous assert(trues)
James Ko [Sat, 9 Apr 2016 14:48:02 +0000 (10:48 -0400)]
Fix a couple of erroneous assert(trues)

8 years agoMerge pull request #4248 from dotnet/revert-4199-struct16-abi
Matt Ellis [Sat, 9 Apr 2016 06:08:54 +0000 (23:08 -0700)]
Merge pull request #4248 from dotnet/revert-4199-struct16-abi

Revert "ARM64 Work Item 3817, 3524 - Struct16 decomposition"

8 years agoRevert "ARM64 Work Item 3817, 3524 - Struct16 decomposition"
Jan Kotas [Sat, 9 Apr 2016 04:34:40 +0000 (18:34 -1000)]
Revert "ARM64 Work Item 3817, 3524 - Struct16 decomposition"

8 years agoMerge pull request #4162 from ramarag/ResolveWorkerChainLookupAsmStub
Rama krishnan Raghupathy [Sat, 9 Apr 2016 04:33:40 +0000 (21:33 -0700)]
Merge pull request #4162 from ramarag/ResolveWorkerChainLookupAsmStub

[Arm64]:Fixing the Logic of ResolveWorkerChainLookupAsmStub for VSD

8 years agoMerge pull request #4202 from MichalStrehovsky/applicationException
Michal Strehovský [Sat, 9 Apr 2016 02:10:55 +0000 (19:10 -0700)]
Merge pull request #4202 from MichalStrehovsky/applicationException

Remove usage of ApplicationException in tests

8 years ago[Arm64]:Fixing the Logic of ResolveWorkerChainLookupAsmStub
Rama Krishnan Raghupathy [Fri, 8 Apr 2016 02:40:30 +0000 (19:40 -0700)]
[Arm64]:Fixing the Logic of ResolveWorkerChainLookupAsmStub

8 years agoInliner: initial version of a model-based policy
Andy Ayers [Fri, 8 Apr 2016 02:43:09 +0000 (19:43 -0700)]
Inliner: initial version of a model-based policy

Add a model-based size predictor to the `DiscretionaryPolicy` and
dump its data along with observations. This can be used to assess
the performance of the model. Currently using a linear model that
can explain about 55% of the variability in code size impact for
mscorlib. Whether this holds up for other situations is still to
be determined.

Create a `ModelPolicy` that relies on this code size model to make
inlining decisions. This is very much a work in progress as the code
size models are still not well vetted and there is no real code
quality model yet.

8 years agoMerge pull request #4207 from swgillespie/437657
Sean Gillespie [Sat, 9 Apr 2016 00:24:08 +0000 (17:24 -0700)]
Merge pull request #4207 from swgillespie/437657

Remove a test that doesn't provide much value, fails in parallel test…

8 years agoMerge pull request #4199 from briansull/struct16-abi
Brian Sullivan [Fri, 8 Apr 2016 23:59:18 +0000 (16:59 -0700)]
Merge pull request #4199 from briansull/struct16-abi

ARM64 Work Item 3817, 3524 - Struct16 decomposition

8 years agoMinor JIT changes
Bruce Forstall [Fri, 8 Apr 2016 23:20:31 +0000 (16:20 -0700)]
Minor JIT changes

Add a useful assert about SP to FP offsets.

Add "const" to a few member functions.

8 years agoAdd genEstablishFramePointer() to enapsulate frame pointer creation
Bruce Forstall [Fri, 8 Apr 2016 23:15:29 +0000 (16:15 -0700)]
Add genEstablishFramePointer() to enapsulate frame pointer creation

8 years agoCleanup: replace getFramePointerReg() with preexisting genFramePointerReg()
Bruce Forstall [Fri, 8 Apr 2016 23:06:22 +0000 (16:06 -0700)]
Cleanup: replace getFramePointerReg() with preexisting genFramePointerReg()

8 years agoCleanup: be consistent about compCalleeFPRegsSavedMask #ifdefs
Bruce Forstall [Fri, 8 Apr 2016 22:38:51 +0000 (15:38 -0700)]
Cleanup: be consistent about compCalleeFPRegsSavedMask #ifdefs

8 years agoMerge remote-tracking branch 'upstream/master'
Mike McLaughlin [Fri, 8 Apr 2016 22:28:04 +0000 (15:28 -0700)]
Merge remote-tracking branch 'upstream/master'

8 years agoMerge pull request #4205 from mikem8361/sosfx2
Mike McLaughlin [Fri, 8 Apr 2016 22:27:29 +0000 (15:27 -0700)]
Merge pull request #4205 from mikem8361/sosfx2

Better sos message for runtime not initialized

8 years agoMerge remote-tracking branch 'upstream/master'
Mike McLaughlin [Fri, 8 Apr 2016 22:23:43 +0000 (15:23 -0700)]
Merge remote-tracking branch 'upstream/master'

8 years agoMerge pull request #4163 from pgavlin/GCInfoQSort
Pat Gavlin [Fri, 8 Apr 2016 22:20:11 +0000 (15:20 -0700)]
Merge pull request #4163 from pgavlin/GCInfoQSort

Replace CQuickSort with qsort in GC info encoders.

8 years agoARM64 Work Item 3817, 3524 - Struct16 decomposition
Brian Sullivan [Fri, 8 Apr 2016 19:08:24 +0000 (12:08 -0700)]
ARM64 Work Item 3817, 3524 - Struct16 decomposition

Changes to support passing of MultiReg structs using GT_LISTs
Optional support for  struct promotion for multireg structs:
To enable set  FEATURE_MULTIREG_STRUCT_PROMOTE to 1
Morphs the 16-byte structs at the end of fgMorphArgs
Careful refactoring to avoid changes to UNIX_AMD64 code
Covers all of the 16-byte struct expansion cases in fgMorph
Added function header comments
Passing the tests for Arm64
No AsmDiffs for non-Arm64 targets.
Codegen uses Contained nodes for PUTARG_STK 16-byte stack args
Created a genPutArgStk method for Arm64

8 years agoRemove a test that doesn't provide much value, fails in parallel test environments...
Sean Gillespie [Fri, 8 Apr 2016 21:43:31 +0000 (14:43 -0700)]
Remove a test that doesn't provide much value, fails in parallel test environments, and p/invokes to kernel32.dll

8 years agoMerge pull request #4198 from dotnet-bot/from-tfs
Matt Ellis [Fri, 8 Apr 2016 21:03:49 +0000 (14:03 -0700)]
Merge pull request #4198 from dotnet-bot/from-tfs

Merge changes from TFS