platform/upstream/coreclr.git
5 years agoReplace 'where T : object` with `where T : notnull`
Stephen Toub [Wed, 12 Jun 2019 19:09:49 +0000 (15:09 -0400)]
Replace 'where T : object` with `where T : notnull`

5 years agoUpdate dependencies from dotnet/arcade (dotnet/corefx#38474)
dotnet-maestro[bot] [Wed, 12 Jun 2019 17:41:32 +0000 (10:41 -0700)]
Update dependencies from dotnet/arcade (dotnet/corefx#38474)

* Update dependencies from https://github.com/dotnet/arcade build 20190611.2

- Microsoft.DotNet.XUnitExtensions - 2.4.1-beta.19311.2
- Microsoft.DotNet.XUnitConsoleRunner - 2.5.1-beta.19311.2
- Microsoft.DotNet.VersionTools.Tasks - 1.0.0-beta.19311.2
- Microsoft.DotNet.ApiCompat - 1.0.0-beta.19311.2
- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19311.2
- Microsoft.DotNet.Build.Tasks.Configuration - 1.0.0-beta.19311.2
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19311.2
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19311.2
- Microsoft.DotNet.CodeAnalysis - 1.0.0-beta.19311.2
- Microsoft.DotNet.CoreFxTesting - 1.0.0-beta.19311.2
- Microsoft.DotNet.GenAPI - 1.0.0-beta.19311.2
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19311.2
- Microsoft.DotNet.RemoteExecutor - 1.0.0-beta.19311.2
- Microsoft.DotNet.GenFacades - 1.0.0-beta.19311.2

* Update `where T : object` constraint to be `where T : notnull`

* Update several TODO-NULLABLE comments

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
5 years agoFix nullable annotations on Binder.ReorderArgumentArray
Stephen Toub [Wed, 12 Jun 2019 15:12:31 +0000 (11:12 -0400)]
Fix nullable annotations on Binder.ReorderArgumentArray

5 years agoRemove defunct !s and update some TODO-NULLABLE comments
Stephen Toub [Wed, 12 Jun 2019 15:00:51 +0000 (11:00 -0400)]
Remove defunct !s and update some TODO-NULLABLE comments

5 years agoUpdate dependencies from https://github.com/dotnet/arcade build 20190611.2
dotnet-maestro [Wed, 12 Jun 2019 12:25:40 +0000 (12:25 +0000)]
Update dependencies from https://github.com/dotnet/arcade build 20190611.2

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19311.2
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19311.2
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19311.2
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19311.2

5 years agoAllocate handles for custom marshalers in ALCs instead of in the AppDomain. (#25105)
Jeremy Koritzinsky [Wed, 12 Jun 2019 17:16:42 +0000 (10:16 -0700)]
Allocate handles for custom marshalers in ALCs instead of in the AppDomain. (#25105)

5 years agoEnable coreclr-runincontext in azure pipelines (#25073)
Jan Vorlicek [Wed, 12 Jun 2019 17:15:22 +0000 (19:15 +0200)]
Enable coreclr-runincontext in azure pipelines (#25073)

* Enable coreclr-runincontext in azure pipelines

5 years agoSuperPMI: Fix `getFieldType` (#25102)
Carol Eidt [Wed, 12 Jun 2019 16:07:32 +0000 (09:07 -0700)]
SuperPMI: Fix `getFieldType` (#25102)

* SuperPMI: Fix `getFieldType`

The `structType` out parameter is optional (i.e. it may be null), but it's not used as a key, so we need to update the map if we've saved a null but encounter a non-null.

5 years agoConvert PermissionSet NIE to PlatformNotSupportedException (#25114)
Marek Safar [Wed, 12 Jun 2019 14:33:18 +0000 (16:33 +0200)]
Convert PermissionSet NIE to PlatformNotSupportedException (#25114)

5 years agoExpose readonly heap segments to DAC (#25113)
Michal Strehovský [Wed, 12 Jun 2019 14:32:53 +0000 (16:32 +0200)]
Expose readonly heap segments to DAC (#25113)

This was in CoreRT's copy of gcinterface.dac.h, but got lost in dotnet/corert#7517.

5 years agoAdd missing TraceOperationCreation log event in GetStateMachineBox (#25097)
Stephen Toub [Wed, 12 Jun 2019 13:42:08 +0000 (06:42 -0700)]
Add missing TraceOperationCreation log event in GetStateMachineBox (#25097)

This was removed accidentally as part of overhauling the async infrastructure in 2.1. VS depends on it for some task tracking logic.

5 years agoFix Module::IsInSameVersionBubble contract (#25106)
Jan Vorlicek [Wed, 12 Jun 2019 11:27:12 +0000 (13:27 +0200)]
Fix Module::IsInSameVersionBubble contract (#25106)

* Fix Module::IsInSameVersionBubble contract

The function had an incorrect contract indicating that it cannot throw
and that it cannot trigger GC. This is not true in case the underlying
GetNativeAssemblyImport loads the manifest.
Change the contract to STANDARD_VM_CONTRACT

5 years agoCoreRT change
Suchiman [Tue, 11 Jun 2019 19:38:23 +0000 (21:38 +0200)]
CoreRT change

5 years agoEnsure gen0_max_size to be initially >= gen0_min_size
Suchiman [Sun, 9 Jun 2019 16:18:44 +0000 (18:18 +0200)]
Ensure gen0_max_size to be initially >= gen0_min_size

Otherwise, gen0_min_size is eventually capped by gen0_max_size, which makes it impossible to raise gen0 size above the default max sizes for gen0.
This is required for some scenarios (CppCodeGen, WASM) in CoreRT.

5 years agoMultiple CoreRT changes
Suchiman [Tue, 11 Jun 2019 19:32:51 +0000 (21:32 +0200)]
Multiple CoreRT changes

5 years agoFix casts
Suchiman [Tue, 11 Jun 2019 19:30:57 +0000 (21:30 +0200)]
Fix casts

5 years agoFix Redhawk defines
Suchiman [Tue, 11 Jun 2019 19:17:46 +0000 (21:17 +0200)]
Fix Redhawk defines

5 years agoUNREFERENCED_PARAMETER
Suchiman [Tue, 11 Jun 2019 19:14:57 +0000 (21:14 +0200)]
UNREFERENCED_PARAMETER

5 years agoPort typo fixes from CoreRT
Suchiman [Tue, 11 Jun 2019 18:18:39 +0000 (20:18 +0200)]
Port typo fixes from CoreRT

5 years agoJIT: use stress mode tail call validation info for implicit tail calls (#25093)
Andy Ayers [Wed, 12 Jun 2019 01:17:47 +0000 (18:17 -0700)]
JIT: use stress mode tail call validation info for implicit tail calls (#25093)

If a call site fails tail call stress validation, don't consider it for
implicit tail calling either.

In normal jitting we defer this level of validation until impImportCall
to avoid duplicating work.

This avoids an assert when we have invalid IL.

Fixes #25027.

5 years agoFix context restore for ARM/ARM64 debugging (#25089)
Juan Hoyos [Wed, 12 Jun 2019 00:16:25 +0000 (17:16 -0700)]
Fix context restore for ARM/ARM64 debugging (#25089)

5 years agoFall back to CpuId if failed to get cache size from OS (#24989)
Andy Hanson [Tue, 11 Jun 2019 23:20:29 +0000 (16:20 -0700)]
Fall back to CpuId if failed to get cache size from OS (#24989)

* Fall back to CpuId if failed to get cache size from OS

It's possible for GetLogicalProcessorCacheSizeFromOS() to fail;
this happens on alpine linux where it compiles to just `return 0;`.

As a fallback, we can get the cache size from CpuId. Previously that
was specific to x86; this PR preserves the behavior that we never call
GetLogicalProcessorCacheSizeFromOS on x86.

CpuId only works on x86 and amd64; on other systems we may still return
0 from here. Then GC defaults to a cache size of only 0.25MB.

Note: Removed the code in an `#ifdef _WIN64` that was nested inside of
`#if defined (_TARGET_X86_)`. Presuming that is dead code.

* Fix exception handler

5 years agoFix ForeignThreadExceptions test (#25074)
Jan Vorlicek [Tue, 11 Jun 2019 22:42:46 +0000 (00:42 +0200)]
Fix ForeignThreadExceptions test (#25074)

This test creates a native thread on which it calls a managed callback. It uses
std::thread to create the thread. The problem is that on MUSL based Linux distros,
the default stack size for secondary threads is 80kB, which is not enough for this
test.
Since std::thread has no way to set the thread stack size, the fix is to use
pthreads on Unix and keep the std::thread for Windows only.

5 years agoImprove corefx testing (#24962)
Bruce Forstall [Tue, 11 Jun 2019 21:18:08 +0000 (14:18 -0700)]
Improve corefx testing (#24962)

CoreFX tests are now used to test CoreCLR on Windows/x64 and Linux/x64.
PR testing includes normal and no-tiered modes. CI testing will include
all JIT stress modes that apply to CoreCLR testing. Many tests have been
disabled to allow the jobs to (mostly) run error-free.

Support for other platforms requires fixes to the testhost generation.

5 years agoCompilation fixes (#25084)
Sinan Kaya [Tue, 11 Jun 2019 21:08:08 +0000 (17:08 -0400)]
Compilation fixes (#25084)

5 years agoTrack timer count and add Timer.ActiveCount (#25061)
Koundinya Veluri [Tue, 11 Jun 2019 20:56:40 +0000 (13:56 -0700)]
Track timer count and add Timer.ActiveCount (#25061)

* Track timer count and add Timer.Count

Part of https://github.com/dotnet/corefx/issues/38422

* Use lock to prevent tearing

* Add assert

* Rename Count to ActiveCount

* Fix build

5 years agoUse the per session configuration to invoke the EventPipeProvider callbacks (#25088)
Andrew Au [Tue, 11 Jun 2019 20:51:09 +0000 (13:51 -0700)]
Use the per session configuration to invoke the EventPipeProvider callbacks (#25088)

* Use the per session configuration to invoke the EventPipeProvider callbacks

* Avoid making the callback if the session does not have the provider

5 years agoDelete dead code (#25066)
Jan Kotas [Tue, 11 Jun 2019 20:18:03 +0000 (13:18 -0700)]
Delete dead code (#25066)

5 years agoR2R ilstubs (#24823)
David Wrighton [Tue, 11 Jun 2019 20:13:09 +0000 (13:13 -0700)]
R2R ilstubs (#24823)

* Basic support for precompiled pinvoke stubs

* Generate R2R file with multiple references to same IL stub (one per method which the IL stub is associated with)
* Not all il stubs are p/invokes. Don't fail when they aren't.
* Consistently use IsDynamicScope and GetModule to avoid unsafe memory access in IL stub compilation paths
* Enable full p/invoke il stubs when compiling System.Private.Corelib
* Disable IL Stub generation in crossgen for ARM32.
- The cross bitness logic is not correct for IL Stub generation

5 years agoUpdate dependencies from https://github.com/dotnet/core-setup build 20190611.01 ...
dotnet-maestro[bot] [Tue, 11 Jun 2019 19:00:31 +0000 (12:00 -0700)]
Update dependencies from https://github.com/dotnet/core-setup build 20190611.01 (#25078)

- Microsoft.NETCore.App - 3.0.0-preview7-27811-01

5 years agoMake GetSessionProvider const (#25085)
Andrew Au [Tue, 11 Jun 2019 18:00:34 +0000 (11:00 -0700)]
Make GetSessionProvider const (#25085)

5 years agoRefactor one-time ETL rundown event firing (#24993)
Koundinya Veluri [Tue, 11 Jun 2019 17:58:05 +0000 (10:58 -0700)]
Refactor one-time ETL rundown event firing (#24993)

- Moved the `RuntimeInformation` and `TieredCompilation/Settings` events to fire on rundown on attach/detach

5 years agoUpdate IEquatable/IComparable<T> for nullability (#25053)
Stephen Toub [Tue, 11 Jun 2019 16:08:18 +0000 (09:08 -0700)]
Update IEquatable/IComparable<T> for nullability (#25053)

We need to revise our use of nullable for `IComparable<T>` and `IEquatable<T>`:
- For reference types that implement `IComparable<T>`, the implementation should use `IComparable<T?>`, e.g. `String : IComparable<String?>`, so that the type can be used in methods with a `where T : IComparable<T>` constraint: `IComparable<T>`'s contravariance then allows both `T` and `T?` to work as generic type arguments.
- For reference types that implement `IEquatable<T>`, we can't take advantage of such contravariance, as by design `IEquatable<T>` is invariant (it would be a breaking change to make it contravariant, and even if it wasn't doing so is of questionable design given that equality and inheritance don't mix well).  Given the current language design, we have little option but to explicitly make any reference type implementations of `IEquatable<T>` be oblivious, and also make all `where T : IEquatable<T>` constraints be oblivious.  Otherwise, regardless nullable annotations, a developer will get a warning for using either or both of `T`/`T?` with any given method employing such a constraint.

5 years agoUpdate dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimizati...
dotnet-maestro[bot] [Tue, 11 Jun 2019 14:22:26 +0000 (14:22 +0000)]
Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20190610.3 (#25079)

- optimization.IBC.CoreCLR - 99.99.99-master-20190610.3
- optimization.PGO.CoreCLR - 99.99.99-master-20190610.3

5 years agoUpdate dependencies from https://github.com/dotnet/corefx build 20190611.1 (#25077)
dotnet-maestro[bot] [Tue, 11 Jun 2019 14:08:08 +0000 (07:08 -0700)]
Update dependencies from https://github.com/dotnet/corefx build 20190611.1 (#25077)

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview7.19311.1
- Microsoft.NETCore.Platforms - 3.0.0-preview7.19311.1
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview7.19311.1

5 years agoUpdate dependencies from https://github.com/dotnet/arcade build 20190610.24 (#25076)
dotnet-maestro[bot] [Tue, 11 Jun 2019 14:07:54 +0000 (07:07 -0700)]
Update dependencies from https://github.com/dotnet/arcade build 20190610.24 (#25076)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19310.24
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19310.24
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19310.24
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19310.24

5 years agoEnable lab support for coreclr tests in unloadable context (#25064)
Jan Vorlicek [Tue, 11 Jun 2019 08:54:52 +0000 (10:54 +0200)]
Enable lab support for coreclr tests in unloadable context (#25064)

5 years agoAdd optimization tiers to the Linux perf maps for perfcollect (#24967)
Koundinya Veluri [Tue, 11 Jun 2019 06:27:02 +0000 (23:27 -0700)]
Add optimization tiers to the Linux perf maps for perfcollect (#24967)

Add optimization tiers to the Linux perf maps for perfcollect

Fixes https://github.com/dotnet/coreclr/issues/23222:
- It looks like module unloads are currently not taken into account. Once they would be taken into account, Although we have method JIT events from `lttng` with the code address and optimization tier, samples can only be associated with method JIT events by associating the time range when the module is loaded with times of samples, and the event times from `lttng` would not necessarily correspond with times from samples taken by `perf`.
- Updated to include the optimization tier in the perf map for each jitted or R2R method code address
- Refactored common code between eventtrace and perfmap for getting jit tiers

5 years agoSwitch P/Invokes into libcoreclr for the PAL to QCalls (#25055)
Jeremy Koritzinsky [Tue, 11 Jun 2019 04:33:00 +0000 (21:33 -0700)]
Switch P/Invokes into libcoreclr for the PAL to QCalls (#25055)

* Switch PInvokes into libcoreclr to QCalls

* Register QCalls in runtime. Remove pal exports from libcoreclr

* Alphabetize new ecalllist.h entries

* Remove W suffixes from native side of QCall

* Interop signatures are in nested classes (which doesn't show up here) in the root namespace. So we don't want to pass a namespace in here

* Convert the interop test in R2R to use a local native library instead of calling into the CoreCLR PAL via DllImport.

5 years agofix generic attribute bug when generic attribute has parameters and the parameters...
Avi Avni [Tue, 11 Jun 2019 00:22:34 +0000 (03:22 +0300)]
fix generic attribute bug when generic attribute has parameters and the parameters (#25054)

* fix generic attribute bug

* add missing test cases

5 years agoFix inline tracking (#25062)
Jan Vorlicek [Tue, 11 Jun 2019 00:22:13 +0000 (02:22 +0200)]
Fix inline tracking (#25062)

Inline tracking didn't correctly place the right key into the
inline tracking map for generics. The logic places the instantiated
methoddesc into the tracking map, and then attempts to find it by
looking up the uninstantiated form. This would generally be a silent
failure, but in unloadable assembly testing we have an assert that the
CrossLoaderAllocatorHash holds as keys items from a matching
LoaderAllocator.

This issue also results in an assert `key->GetLoaderAllocator() ==
m_pLoaderAllocator` in CrossLoaderAllocatorHash when the code is
running inside of a collectible AssemblyLoadContext.

5 years ago[master] Update dependencies from dotnet/core-setup (#25005)
dotnet-maestro[bot] [Mon, 10 Jun 2019 23:20:44 +0000 (16:20 -0700)]
[master] Update dependencies from dotnet/core-setup (#25005)

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

- Microsoft.NETCore.App - 3.0.0-preview7-27805-02

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

- Microsoft.NETCore.App - 3.0.0-preview7-27806-03

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

- Microsoft.NETCore.App - 3.0.0-preview7-27808-01

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

- Microsoft.NETCore.App - 3.0.0-preview7-27809-01

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

- Microsoft.NETCore.App - 3.0.0-preview7-27810-02

5 years agoUse pread() to read DOS/NT headers when mapping PE files (#25059)
Leandro A. F. Pereira [Mon, 10 Jun 2019 22:44:29 +0000 (15:44 -0700)]
Use pread() to read DOS/NT headers when mapping PE files (#25059)

Shaves off two syscalls per managed assembly load.

5 years agoAdd source-build hook for dotnet install (#24929)
Jarret Shook [Mon, 10 Jun 2019 21:13:27 +0000 (14:13 -0700)]
Add source-build hook for dotnet install (#24929)

* Add source-build hook for dotnet install

* Fix batch syntax

* Address feedback

* Use the correct returned variables:

unix: _InitializeDotNetCli
windows: DOTNET_TOOL_DIR

* Remove changes to dotnet.cmd

* Do not export, just use _InitializeDotNetCli

5 years agoMake Debug.Print(string) behavior consistent with .NET Framework (#25036)
Maryam Ariyan [Mon, 10 Jun 2019 21:09:07 +0000 (14:09 -0700)]
Make Debug.Print(string) behavior consistent with .NET Framework (#25036)

*     Debug.Print should call Debug.WriteLine
    - to behave similar to .NET Framework

* temporarily disable tests
- Waiting for coreclr/fx changes to propagate

5 years agoAdd support for the NetTrace EventPipe file format
noahfalk [Mon, 10 Jun 2019 20:48:50 +0000 (13:48 -0700)]
Add support for the NetTrace EventPipe file format

Right now the new format is not on by default, but it can be enabled using COMPlus_EventPipeNetTraceFormat = 1 for testing purposes. The plan to have a follow up PR that will add shipping configuration mechanisms and change the default setting.

See the documentation in the PerfView repo for more details about the format. At a glance the goal is to create a format that is more efficient to produce, has a smaller on disk size, and offers enhanced functionality in a few areas:
a) 64 bit thread id support
b) Detection of dropped events via sequence numbers
c) Better support for extracting subsets of the file

Together with the change there was also some refactoring of the EventPipeBufferManager and EventPipeThread.

This change addresses (at least in part) the following issues:
#19688, #23414, #24188, #20751, #20555, #21827, #24852, #25046

5 years ago[master] Update dependencies from dnceng/internal/dotnet-optimization (#25023)
dotnet-maestro[bot] [Mon, 10 Jun 2019 15:22:45 +0000 (15:22 +0000)]
[master] Update dependencies from dnceng/internal/dotnet-optimization (#25023)

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20190606.3

- optimization.IBC.CoreCLR - 99.99.99-master-20190606.3
- optimization.PGO.CoreCLR - 99.99.99-master-20190606.3

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20190610.1

- optimization.IBC.CoreCLR - 99.99.99-master-20190610.1
- optimization.PGO.CoreCLR - 99.99.99-master-20190610.1

5 years ago[master] Update dependencies from dotnet/corefx (#25022)
dotnet-maestro[bot] [Mon, 10 Jun 2019 15:11:43 +0000 (11:11 -0400)]
[master] Update dependencies from dotnet/corefx (#25022)

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

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview7.19306.9
- Microsoft.NETCore.Platforms - 3.0.0-preview7.19306.9
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview7.19306.9

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

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview7.19307.10
- Microsoft.NETCore.Platforms - 3.0.0-preview7.19307.10
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview7.19307.10

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

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview7.19309.1
- Microsoft.NETCore.Platforms - 3.0.0-preview7.19309.1
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview7.19309.1

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

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview7.19309.5
- Microsoft.NETCore.Platforms - 3.0.0-preview7.19309.5
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview7.19309.5

5 years agoUpdate dependencies from https://github.com/dotnet/arcade build 20190609.1 (#25051)
dotnet-maestro[bot] [Mon, 10 Jun 2019 15:11:04 +0000 (11:11 -0400)]
Update dependencies from https://github.com/dotnet/arcade build 20190609.1 (#25051)

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19309.1
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19309.1
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19309.1
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19309.1

5 years agoUse SIZE_T for SectionSize in RegisterFrozenSegment (#25044)
Mukul Sabharwal [Mon, 10 Jun 2019 15:09:12 +0000 (08:09 -0700)]
Use SIZE_T for SectionSize in RegisterFrozenSegment (#25044)

5 years agoFix field offset computation for large version bubble (#25029)
Jan Vorlicek [Mon, 10 Jun 2019 14:33:42 +0000 (16:33 +0200)]
Fix field offset computation for large version bubble (#25029)

There was a discrepancy in field offset calculations at crossgen time
and at runtime in some rare cases due to the alignment of a derived
class offset.
The issue happened due to MethodTableBuilder::NeedsAlignedBaseOffset not
taking into account the fact that the module of the parent and child
class can both be in large version bubble.

We also had a bug in the PEDecoder::GetNativeManifestMetadata. When it
was called for regular crossgened image without large version bubble, it
left the pDir uninitialized due to the fact that there was no
READYTORUN_SECTION_MANIFEST_METADATA. And then it tried to dereference
that.

5 years ago[master] Update dependencies from dotnet/arcade (#25021)
dotnet-maestro[bot] [Mon, 10 Jun 2019 00:50:31 +0000 (17:50 -0700)]
[master] Update dependencies from dotnet/arcade (#25021)

* Update dependencies from https://github.com/dotnet/arcade build 20190606.12

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19306.12
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19306.12
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19306.12
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19306.12

* Update dependencies from https://github.com/dotnet/arcade build 20190607.12

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19307.12
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19307.12
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19307.12
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19307.12

* Update dependencies from https://github.com/dotnet/arcade build 20190607.62

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19307.62
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19307.62
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19307.62
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19307.62

* Update dependencies from https://github.com/dotnet/arcade build 20190608.1

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19308.1
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19308.1
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19308.1
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19308.1

5 years agoFix `EventPipe::Disable` threading issues. (#24896)
José Rivero [Sun, 9 Jun 2019 15:49:31 +0000 (08:49 -0700)]
Fix `EventPipe::Disable` threading issues. (#24896)

`EventPipe::WriteEvent*` does not use the `EventPipe::Crst` which created race conditions with other methods such as EventPipe::Disable.

5 years agodon't acquire lock if the collator has been already created (#24973)
Adam Sitnik [Sun, 9 Jun 2019 11:39:29 +0000 (13:39 +0200)]
don't acquire lock if the collator has been already created (#24973)

* don't acquire lock if the collator has been already created

* use atomic_compare_exchange_strong instead of __sync_bool_compare_and_swap

* don't try to workaround clang 5.0 bug, just use __atomic_compare_exchange_n

5 years agoMove Marshal class to S.P.CoreLib (dotnet/corert#7502)
Michal Strehovský [Sat, 8 Jun 2019 14:11:46 +0000 (16:11 +0200)]
Move Marshal class to S.P.CoreLib (dotnet/corert#7502)

After this change, CoreRT only uses S.P.Interop to host the interop hashtable readers. Those can't move to CoreLib because they call into the type loader.

I didn't touch ProjectN's version of Marshal and I left the `PInvokeMarshal` class in place to help with that. I guess we'll need to make a call at some point on what to do with S.P.Interop since without MCG the code in it is kind of useless.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
5 years agoFix issue in NamedPipeServerStream.GetImpersonationUserName() (#37676)
Carlos Sanchez Lopez [Fri, 7 Jun 2019 19:35:43 +0000 (12:35 -0700)]
Fix issue in NamedPipeServerStream.GetImpersonationUserName() (#37676)

Fix for issue where NamedPipeServerStream.GetImpersonationUserName() throws unexpected InvalidationOperationException("The operation completed successfully") when impersonation is not allowed, when in fact it should simply return an empty string.

The fix will call GetNamedPipeHandleStateW once. If it fails, it will try to load sspicli.dll if it was not loaded, and will reattempt the call to GetNamedPipeHandleStateW.

This fix is only for Win32: UAP does not allow calling LoadLibraryEx, and Windows Nano says denies access to GetNamedPipeHandleStateW even after attempting to load sspicli.dll.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
5 years agoFix a race condition in EventPipe (#25025)
Andrew Au [Sat, 8 Jun 2019 04:10:24 +0000 (21:10 -0700)]
Fix a race condition in EventPipe (#25025)

5 years agoFix redist
Jeremy Kuhne [Fri, 31 May 2019 17:31:39 +0000 (10:31 -0700)]
Fix redist

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
5 years agoFix AppDomain issues (#25019)
Steve MacLean [Sat, 8 Jun 2019 00:25:35 +0000 (20:25 -0400)]
Fix AppDomain issues (#25019)

Populate AppDomain.CurrentDomain when invoking events
Make AppDomain method implemented in AssemblyLoadContext internal

5 years agoMention `COMPlus_AltJitNgen=*` for crossgen
Carol Eidt [Fri, 7 Jun 2019 22:12:31 +0000 (15:12 -0700)]
Mention `COMPlus_AltJitNgen=*` for crossgen

5 years agoMerge pull request #24007 from mikedn/enable-w4
Sergey Andreenko [Fri, 7 Jun 2019 22:04:51 +0000 (15:04 -0700)]
Merge pull request #24007 from mikedn/enable-w4

Compile JIT sources with /W4

5 years agoExplicitly set permission on the socket file created by DiagnosticServer (#24988)
Sung Yoon Whang [Fri, 7 Jun 2019 21:17:17 +0000 (14:17 -0700)]
Explicitly set permission on the socket file created by DiagnosticServer (#24988)

* Explicitly set permission on the socket file created by DiagnosticServer

* Add an asserte and remove execute permission

* Use umask to set permission instead of fchmod

* use fchmod for linux, ifdef out osx specific permission sets

* Set correct permission bit in call to umask

* Forgot to recover umask on one of the error paths

5 years agoDo not delete polymorphic objects without a virtual destructor (#23705)
Omair Majid [Fri, 7 Jun 2019 20:49:52 +0000 (16:49 -0400)]
Do not delete polymorphic objects without a virtual destructor (#23705)

SEI CERT C++ Coding Standard says:

> Do not delete an object of derived class type through a pointer to its
> base class type that has a non-virtual destructor. Instead, the base
> class should be defined with a virtual destructor. Deleting an object
> through a pointer to a type without a virtual destructor results in
> undefined behavior.

See https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP52-CPP.+Do+not+delete+a+polymorphic+object+without+a+virtual+destructor

Clang generally warns about this, but we disabled the warning via
-Wno-delete-non-virtual-dtor. This commit re-enables the warning and
fixes up all the code that hits the warning.

5 years agoAdd docs for rejit on attach and the new profiler attach mechanism (#24868)
David Mason [Fri, 7 Jun 2019 20:49:15 +0000 (13:49 -0700)]
Add docs for rejit on attach and the new profiler attach mechanism (#24868)

5 years agoReduce indirect function calls (#24980)
David Wrighton [Fri, 7 Jun 2019 18:38:49 +0000 (11:38 -0700)]
Reduce indirect function calls (#24980)

* Reduce indirect dispatch in hot paths in metadata

* Remove allocation indirections in utilcode for coreclr
- we no longer have a multi-dll distribution of code that needs to share heaps

* Remove unused code in GetCLRFunction

* Remove virtual dispatch around impl/decl methodtable access in MethodData

5 years agoAddress nullable feedback for System.Runtime and System.Runtime.Extensions (#25017)
Santiago Fernandez Madero [Fri, 7 Jun 2019 16:01:51 +0000 (11:01 -0500)]
Address nullable feedback for System.Runtime and System.Runtime.Extensions (#25017)

* Address last nullable feedback from System.Runtime

* Address nullable feedback for System.Runtime.Extensions

* PR Feedback

5 years agoFix blr printing (#24979)
Carol Eidt [Fri, 7 Jun 2019 13:59:55 +0000 (06:59 -0700)]
Fix blr printing (#24979)

A blr instruction may have a result that is not a pointer size, but its target register is always EA_PTRSIZE.

Fix #24940

5 years agoAdd [NotNull] to syncLock parameter of EnsureInitialized (#25012)
Stephen Toub [Fri, 7 Jun 2019 01:54:29 +0000 (21:54 -0400)]
Add [NotNull] to syncLock parameter of EnsureInitialized (#25012)

5 years agoAdd DisplayUnits property to DiagnosticCounter (#24981)
Sung Yoon Whang [Fri, 7 Jun 2019 00:18:27 +0000 (17:18 -0700)]
Add DisplayUnits property to DiagnosticCounter (#24981)

5 years agoMarking Vector128<T>.Count and Vector256<T>.Count as [Intrinsic] (#24991)
Tanner Gooding [Thu, 6 Jun 2019 23:06:22 +0000 (16:06 -0700)]
Marking Vector128<T>.Count and Vector256<T>.Count as [Intrinsic] (#24991)

* Marking Vector128<T>.Count and Vector256<T>.Count as [Intrinsic]

* Fixing NI_Vector128_Count and NI_Vector256_Count to use clsHnd when getting the simdSize and baseType

* Applying the formatting patch.

* Changing some comments to just be "vector element count".

* Fixing impBaseIntrinsic to set the baseType so Vector128_Count and Vector256_Count don't return nullptr

5 years agoUse CMake's C# support to build DacTableGen instead of manually invoking csc.exe...
Jeremy Koritzinsky [Thu, 6 Jun 2019 21:43:54 +0000 (14:43 -0700)]
Use CMake's C# support to build DacTableGen instead of manually invoking csc.exe ourselves. (#24342)

* Use CMake's C# support to build DacTableGen instead of manually invoking csc.exe ourselves.

* Fix x86 failures.

* Disable DAC generation when building with NMake Makefiles and issue an error since the CMake C# support is VS-only. We don't actually support building with NMake (only configure) so this is ok.

* Clean up rest of the macro=1's

PR Feedback.

* Fix Visual Studio generator matching.

* Explicitly specify anycpu32bitpreferred for DacTableGen so the ARM64 build doesn't accidentally make it 64-bit

* Fix bad merge

5 years agoMove COM object lifetime control tests to CoreCLR. (#24990)
Jeremy Koritzinsky [Thu, 6 Jun 2019 21:39:42 +0000 (14:39 -0700)]
Move COM object lifetime control tests to CoreCLR. (#24990)

* Add COM object lifetime control tests to CoreCLR.

* Combine cleanup control test into NETClientPrimitives.

5 years agoFix initializing BuildTools when the Platform environment variable is set (#24998)
Elinor Fung [Thu, 6 Jun 2019 21:03:18 +0000 (14:03 -0700)]
Fix initializing BuildTools when the Platform environment variable is set (#24998)

* Make build-test.cmd exit if init-tools.cmd fails

* Clear Platform variable before initializing BuildTools

5 years agoMerge pull request #25011 from dotnet/revert-24987-ReenableStackTraceTest
Sergey Andreenko [Thu, 6 Jun 2019 20:52:48 +0000 (13:52 -0700)]
Merge pull request #25011 from dotnet/revert-24987-ReenableStackTraceTest

Revert "Reenable StackTracePreserveTests."

5 years agoRevert "Reenable StackTracePreserveTests."
Sergey Andreenko [Thu, 6 Jun 2019 20:49:04 +0000 (13:49 -0700)]
Revert "Reenable StackTracePreserveTests."

5 years agoClear syncblock early when `VERIFY_HEAP && DEBUG` to prevent verification asserts...
Vladimir Sadov [Thu, 6 Jun 2019 19:12:55 +0000 (12:12 -0700)]
Clear syncblock early when `VERIFY_HEAP && DEBUG` to prevent verification asserts. (#24992)

Fixes:#24879

5 years agoReenable StackTracePreserveTests. (#24987)
Sergey Andreenko [Thu, 6 Jun 2019 17:23:36 +0000 (10:23 -0700)]
Reenable StackTracePreserveTests. (#24987)

I was not able to repro any failures, maybe they were fixed already. Lets see what ci thinks.

5 years agoExclude tests that do not work without tailcalls on arm32 Unix. (#24995)
Sergey Andreenko [Thu, 6 Jun 2019 17:22:47 +0000 (10:22 -0700)]
Exclude tests that do not work without tailcalls on arm32 Unix. (#24995)

5 years agoDelete unnecessary security transparency attributes (#25007)
Jan Kotas [Thu, 6 Jun 2019 17:09:05 +0000 (10:09 -0700)]
Delete unnecessary security transparency attributes (#25007)

5 years agoShortenning /Platform_Assemblies_Paths to just /p for convenience. Leaving the origin...
Fadi Hanna [Thu, 6 Jun 2019 17:05:09 +0000 (10:05 -0700)]
Shortenning /Platform_Assemblies_Paths to just /p for convenience. Leaving the original switch name for compatibility reasons. (#24986)

5 years agoAdd R2R outerloop test mode without any stress modes (#24961)
Fadi Hanna [Thu, 6 Jun 2019 17:04:36 +0000 (10:04 -0700)]
Add R2R outerloop test mode without any stress modes (#24961)

* Add R2R outerloop test mode without any stress modes

5 years agoPInvoke stubs for Unix platforms (#24834)
Fadi Hanna [Thu, 6 Jun 2019 17:03:52 +0000 (10:03 -0700)]
PInvoke stubs for Unix platforms (#24834)

Enable pinvoke stub inlining on Unix
Exclude x86 Unix platforms from inlining pinvoke stubs (limited support)

5 years agoUpdate dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimizati...
dotnet-maestro[bot] [Thu, 6 Jun 2019 15:23:10 +0000 (15:23 +0000)]
Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20190606.1 (#25006)

- optimization.IBC.CoreCLR - 99.99.99-master-20190606.1
- optimization.PGO.CoreCLR - 99.99.99-master-20190606.1

5 years ago[master] Update dependencies from dotnet/arcade (#24969)
dotnet-maestro[bot] [Thu, 6 Jun 2019 14:48:11 +0000 (07:48 -0700)]
[master] Update dependencies from dotnet/arcade (#24969)

* Update dependencies from https://github.com/dotnet/arcade build 20190605.13

- Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19305.13
- Microsoft.DotNet.Build.Tasks.Feed - 2.2.0-beta.19305.13
- Microsoft.DotNet.Build.Tasks.Packaging - 1.0.0-beta.19305.13
- Microsoft.DotNet.Helix.Sdk - 2.0.0-beta.19305.13

5 years agoUpdate dependencies from https://github.com/dotnet/corefx build 20190606.1 (#25004)
dotnet-maestro[bot] [Thu, 6 Jun 2019 14:46:42 +0000 (07:46 -0700)]
Update dependencies from https://github.com/dotnet/corefx build 20190606.1 (#25004)

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview7.19306.1
- Microsoft.NETCore.Platforms - 3.0.0-preview7.19306.1
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview7.19306.1

5 years agoFix tmp dir in configure.cmake (#25003)
Jan Vorlicek [Thu, 6 Jun 2019 13:47:53 +0000 (15:47 +0200)]
Fix tmp dir in configure.cmake (#25003)

The ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS check was using a temp
path that had some non-existent components. While this works fine on Linux,
it fails to create the temp file on OSX.
The fix is to use temp dir in the CMake's output dir.

5 years agoDelete TwoKeywords test. (#24982)
Sergey Andreenko [Thu, 6 Jun 2019 04:38:08 +0000 (21:38 -0700)]
Delete TwoKeywords test. (#24982)

5 years agoMerge two equal exclusion groups for arm32 All OS. (#24984)
Sergey Andreenko [Thu, 6 Jun 2019 04:37:23 +0000 (21:37 -0700)]
Merge two equal exclusion groups for arm32 All OS. (#24984)

There were two:
<!-- Arm32 All OS -->
    <ItemGroup Condition="'$(XunitTestBinBase)' != '' and ('$(BuildArch)' == 'arm' or '$(AltJitArch)' == 'arm')">
and
<!-- arm32 All OS specific excludes -->
    <ItemGroup Condition="'$(XunitTestBinBase)' != '' and  ('$(BuildArch)' == 'arm' or '$(AltJitArch)' == 'arm')">

5 years agoLess work for OptimalMaxSpinWaitsPerSpinIteration fast-path (#21702)
Ben Adams [Thu, 6 Jun 2019 00:36:16 +0000 (01:36 +0100)]
Less work for OptimalMaxSpinWaitsPerSpinIteration fast-path (#21702)

5 years agoAPIs to allow profilers to use DoStackSnapShot on Linux (#24968)
David Mason [Thu, 6 Jun 2019 00:30:46 +0000 (17:30 -0700)]
APIs to allow profilers to use DoStackSnapShot on Linux (#24968)

5 years agoFix GCStress coverage for multi reg returns. (#24826)
Sergey Andreenko [Thu, 6 Jun 2019 00:25:24 +0000 (17:25 -0700)]
Fix GCStress coverage for multi reg returns. (#24826)

* Extract ReplaceInstrAfterCall.

* Avoid GCStress when return multireg with pointers.

Determinate when we need to protect the second register and do not cause GCStress in such cases.

* Add a repro test.

* Reenable MethodImplOptionsTests.

* Extract IsGcCoveregeInterruptInstruction.

That changes how we do checks for arm32 in `IsGcCoverageInterrupt`.

* Tolerate direct call to JIT_RareDisableHelper.

x86 ILStubClass:IL_STUB_PInvoke(byref,ref,int,byref):int generates it like:
Generating: N119 (  4,  7) [000118] ------------              *  RETURNTRAP int    REG NA
IN0021:        cmp      dword ptr [0F9BF9F8H], 0
New Basic Block BB10 [0009] created.
IN0022:        je       L_M6496_BB10
                                                        Call: GCvars=00000001 {V01}, gcrefRegs=00000000 {}, byrefRegs=00000000 {}
IN0023:        call     CORINFO_HELP_STOP_FOR_GC

* Support GC stress protect return 1/2/both Unix x64.

* Fix arm64.

Do not insert GC Stress instrucitons when we can't determinate the exact return kind.

* Fix review1.

* Fix review2.

* Change the test as Andy suggested.

* Fix some typos.

* Replace all SLOT with PBYTE.

* Disable assert that can fail because of multithreading.

5 years agoReenable StackTracePreserveTests.
Sergey Andreenko [Thu, 6 Jun 2019 00:12:26 +0000 (17:12 -0700)]
Reenable StackTracePreserveTests.

I was not able to repro any failures, maybe they were fixed already. Lets see what ci thinks.

5 years agoFix PAL_GetLogicalProcessorCacheSizeFromOS on mac (#24777)
Andy Hanson [Wed, 5 Jun 2019 23:58:56 +0000 (16:58 -0700)]
Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac (#24777)

* Fix PAL_GetLogicalProcessorCacheSizeFromOS on mac

In a previous PR
(https://github.com/dotnet/coreclr/commit/ed52a006c01a582d4d34add40c318d6f324b99ba#diff-8447e54277bb962d167a77bb260760d7R1879),
GetCacheSizePerLogicalCpu was changed to no longer rely on cpuid on
amd64 systems; instead it uses GetLogicalProcessorCacheSizeFromOS().
Unfortunately that function consisted of a number of `#if`s, none of
which were active on macs, and we just returned 0. This caused us to
default to a gen0size of only 0.25MB, causing many GCs.

Fixed by adding a new case that uses `sysctlbyname`.

Fix #24658

* Fixes from code review

* Check for function sysctlbyname instead of header

5 years agoShortenning /Platform_Assemblies_Paths to just /p for convenience. Leaving the origin...
fadimounir [Wed, 5 Jun 2019 23:50:14 +0000 (16:50 -0700)]
Shortenning /Platform_Assemblies_Paths to just /p for convenience. Leaving the original switch name for compatibility reasons.

5 years agoZero initReg in genSetGSSecurityCookie (#24371)
Egor Chesakov [Wed, 5 Jun 2019 23:24:12 +0000 (16:24 -0700)]
Zero initReg in genSetGSSecurityCookie (#24371)

Fix an issue that is reproduced when

1) a register is used in the prolog for initializing GSSecurityCookie (i.e. the register contains a random non-zero value) and
2) the same register holds a must-init GC variable in the next basic block and
3) the variable is live at the beginning of this basic block.

The register was not zeroed at the end of the prolog and this was causing segmentation fault during GC.Collect().

5 years agoMerge pull request #24937 from safern/FixNullableAnnotationsApiReview
Santiago Fernandez Madero [Wed, 5 Jun 2019 22:55:52 +0000 (15:55 -0700)]
Merge pull request #24937 from safern/FixNullableAnnotationsApiReview

Fix some nullable annotations from API Review

5 years agoCleanup block stores and test for 24846 (#24950)
Carol Eidt [Wed, 5 Jun 2019 21:51:04 +0000 (14:51 -0700)]
Cleanup block stores and test for 24846 (#24950)

* Cleanup block stores and test for 24846

Fix zero-length assert/bad codegen for initblk.
Remove redundant assertions in codegen and those that don't directly relate to codegen requirements.
Eliminate redundant LEA that was being generated by `genCodeForCpBlk`.
Rename `genCodeFor[Cp|Init]Blk` to `genCodeFor[Cp|Init]BlkHelper` to parallel the other forms.
Fix the test case for #24846.

5 years agoAdd test verifying reliable SafeHandle unmarshalling (#24959)
Jeremy Koritzinsky [Wed, 5 Jun 2019 21:49:17 +0000 (14:49 -0700)]
Add test verifying reliable SafeHandle unmarshalling (#24959)

* Add test ensuring we correctly unmarshal a SafeHandle even when the stub throws an exception.

* PR Feedback.

5 years agoUse Modern CMake features instead of CMAKE_CXX_FLAGS (#24861)
Jeremy Koritzinsky [Wed, 5 Jun 2019 21:48:55 +0000 (14:48 -0700)]
Use Modern CMake features instead of CMAKE_CXX_FLAGS (#24861)

* Convert C++ standard settings and warning options from CMAKE_<LANG>_FLAGS to Modern CMake isms.

* More $<COMPILE_LANGUAGE> generator expressions instead of CMAKE_CXX_FLAGS.

* Use $<COMPILE_LANGUAGE:CXX> for all -fpermissive usage

* Fix generator expression that generates multiple flags

* Fix invalid use of CMAKE_CXX_FLAGS instead of CMAKE_C_FLAGS.

* Treat AppleClang as though it is Clang (match pre-3.0 behavior).

* Update our build system to understand that AppleClang is distinct from Clang and remove CMP0025 policy setting.

* PR Feedback.

5 years agoDisable corefx tests
Santiago Fernandez Madero [Wed, 5 Jun 2019 19:04:05 +0000 (12:04 -0700)]
Disable corefx tests