platform/upstream/dotnet/runtime.git
5 years agoFix FileStream.FlushAsync() to behave like Flush() (dotnet/coreclr#24902)
Stephen Toub [Fri, 31 May 2019 23:41:59 +0000 (19:41 -0400)]
Fix FileStream.FlushAsync() to behave like Flush() (dotnet/coreclr#24902)

Flush() behaves like Flush(false) and writes out any buffered data but doesn't P/Invoke to FlushFileBuffers/FSync to flush the OS buffers.

But whereas FlushAsync() is supposed to just be an async equivalent of Flush(), it's actually behaving like Flush(true).  This makes FlushAsync() inconsistent and much more expensive.  (This is separate from FlushAsync not actually being async, which is an impactful problem to be solved separately.)

This changes FlushAsync to behave like Flush()/Flush(false) rather than Flush(true).  If someone wants the FlushFileBuffers/FSync behavior, they can call Flush(true).

Commit migrated from https://github.com/dotnet/coreclr/commit/436debb93c390e144f9c25b5d1922ac7780745f4

5 years agoUpdate branding to preview7 in master (dotnet/coreclr#24895)
William Godbe [Fri, 31 May 2019 19:48:54 +0000 (12:48 -0700)]
Update branding to preview7 in master (dotnet/coreclr#24895)

Commit migrated from https://github.com/dotnet/coreclr/commit/525623770c07d83d637fb3f8c7856c85077ffea1

5 years agoHandle a zero byte cpblk (dotnet/coreclr#24871)
Carol Eidt [Fri, 31 May 2019 18:02:02 +0000 (11:02 -0700)]
Handle a zero byte cpblk (dotnet/coreclr#24871)

Fix dotnet/coreclr#24846

Commit migrated from https://github.com/dotnet/coreclr/commit/0d21b57657f8135622797f0db29460c975dd2339

5 years agoFix overlooked moduleIndex initial value (dotnet/coreclr#24881)
Jan Vorlicek [Fri, 31 May 2019 16:46:12 +0000 (18:46 +0200)]
Fix overlooked moduleIndex initial value (dotnet/coreclr#24881)

When adding the signature copying some time ago, I have overlooked one
place where the moduleIndex was set to -1 instead of MODULE_INDEX_NONE.
I was using the -1 during the development and replaced it by creating
MODULE_INDEX_NONE during final cleanup at all but one places.

This caused issues during crossgen even without large version bubble
enabled. Methods requiring generic constraint were not crossgen-ed due
to this.

Commit migrated from https://github.com/dotnet/coreclr/commit/795f2fd2a67047519b477cd1776626368c88e73c

5 years agoMakes GetTotalAllocatedBytes monotonic in nonprecise case. (dotnet/coreclr#24875)
Vladimir Sadov [Fri, 31 May 2019 14:45:03 +0000 (07:45 -0700)]
Makes GetTotalAllocatedBytes monotonic in nonprecise case. (dotnet/coreclr#24875)

* Makes GetTotalAllocatedBytes monotonic in nonprecise case.

Fixes:dotnet/coreclr#24615

* read `dead_threads_non_alloc_bytes` atomically on 32bit platforms

* Update src/vm/comutilnative.cpp

Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/0bbac00d8344195da3c9ee60dad31d0036b7dec0

5 years agoDelete dead code (dotnet/coreclr#24876)
Jan Kotas [Fri, 31 May 2019 06:35:35 +0000 (23:35 -0700)]
Delete dead code (dotnet/coreclr#24876)

Commit migrated from https://github.com/dotnet/coreclr/commit/b8d5b7b760f64d39e00554189ea0e5c66ed6bd62

5 years agoCheck that we are using a valid IDispatch invocation flag earlier to limit the amount...
Jeremy Koritzinsky [Fri, 31 May 2019 03:40:51 +0000 (20:40 -0700)]
Check that we are using a valid IDispatch invocation flag earlier to limit the amount of work we do when we're going to return early anyway. (dotnet/coreclr#24872)

Commit migrated from https://github.com/dotnet/coreclr/commit/996c6ad8015ac8597c504df53aefebd58fad7395

5 years agoFix dotnet/coreclr#24867 (dotnet/coreclr#24870)
Jarret Shook [Fri, 31 May 2019 02:07:50 +0000 (19:07 -0700)]
Fix dotnet/coreclr#24867 (dotnet/coreclr#24870)

Pre SDK 3.0, a project type that is not .csproj would not include Directory.Build.targets. Change empty.proj to empty.csproj to allow source build, which uses a 2.1 sdk to build, correctly import Directory.Build.targets.

Commit migrated from https://github.com/dotnet/coreclr/commit/c6d6fc20a597b01ad0e2745b6933ca216746e7df

5 years agoRemove unused code in vm/util.* (dotnet/coreclr#24863)
Aaron Robinson [Fri, 31 May 2019 01:38:33 +0000 (18:38 -0700)]
Remove unused code in vm/util.* (dotnet/coreclr#24863)

* Remove unused code in vm/util.*

Commit migrated from https://github.com/dotnet/coreclr/commit/82bd51f001c8df3def3b327bb31fc7611539cbd8

5 years agoAdd information in docs for required Windows SDK version for test build. (dotnet...
Jeremy Koritzinsky [Fri, 31 May 2019 00:33:21 +0000 (17:33 -0700)]
Add information in docs for required Windows SDK version for test build. (dotnet/coreclr#24865)

Commit migrated from https://github.com/dotnet/coreclr/commit/56c35e9b60e5f3a978ebe0b77f4b5b0c040495e4

5 years agoMerge pull request dotnet/coreclr#24869 from briansull/desktop-build-fixes
Brian Sullivan [Thu, 30 May 2019 23:49:40 +0000 (16:49 -0700)]
Merge pull request dotnet/coreclr#24869 from briansull/desktop-build-fixes

Fixes for building the Desktop JIT in CodegenMirror

Commit migrated from https://github.com/dotnet/coreclr/commit/7d8309f149d0de976a482941356ed0e48b309858

5 years agoCreate NearDiffer in SuperPMI based on specified targetArchitecture (dotnet/coreclr...
Egor Chesakov [Thu, 30 May 2019 23:40:50 +0000 (16:40 -0700)]
Create NearDiffer in SuperPMI based on specified targetArchitecture (dotnet/coreclr#24860)

Commit migrated from https://github.com/dotnet/coreclr/commit/404e82becbadbd3def532047e5504e1313c1766a

5 years agoSupport running SuperPMI with ARM protononjit.dll (dotnet/coreclr#24840)
Egor Chesakov [Thu, 30 May 2019 23:26:12 +0000 (16:26 -0700)]
Support running SuperPMI with ARM protononjit.dll (dotnet/coreclr#24840)

Commit migrated from https://github.com/dotnet/coreclr/commit/5ee8a09345ea63f80996f0dde7ee4d8396efd902

5 years agoRemove BuildTools from product build (dotnet/coreclr#24841)
Elinor Fung [Thu, 30 May 2019 21:58:09 +0000 (14:58 -0700)]
Remove BuildTools from product build (dotnet/coreclr#24841)

* Remove BuildTools imports from product build
* Split scripts for installing dotnet vs BuildTools

Commit migrated from https://github.com/dotnet/coreclr/commit/fa8383fb28be945cae900a5579afd5920f274fd4

5 years agoFixes for building the Desktop JIT in CodegenMirror
Brian Sullivan [Thu, 30 May 2019 21:34:55 +0000 (14:34 -0700)]
Fixes for building the Desktop JIT in CodegenMirror

Commit migrated from https://github.com/dotnet/coreclr/commit/a765642cab6f2242fcfe0fab27ca41ceb7c57490

5 years agoAdd build-tools.cmd (dotnet/coreclr#24817)
Jan Vorlicek [Thu, 30 May 2019 20:07:06 +0000 (22:07 +0200)]
Add build-tools.cmd (dotnet/coreclr#24817)

* Add build-tools.cmd

This script builds selected tools in the src/tools directory (for the
time being, it builds just the runincontext tool). This is a preparation
step to enable nightly runs with unloadability tests. The
build-tools.cmd should build helper tools needed during test runs.

* Remove the build-tools.cmd

* Build the tools as part of the managed runtime build.
* Update the R2RDump project to put binaries into the bin/Product/...

* Update runincontext.cmd/sh scripts

Reflect the new location of the runincontext binary

Commit migrated from https://github.com/dotnet/coreclr/commit/7e17986ff71a70ba328895e0b99e1de83d1bf5b5

5 years agoMove CI to supported queues
Russ Keldorph [Tue, 28 May 2019 20:05:54 +0000 (13:05 -0700)]
Move CI to supported queues

Commit migrated from https://github.com/dotnet/coreclr/commit/d651f0ae68a78741b5c9c18696245035d4aba27a

5 years agoUpdate CoreClr to preview6.19280.1 (dotnet/coreclr#24848)
dotnet-maestro-bot [Thu, 30 May 2019 17:09:48 +0000 (10:09 -0700)]
Update CoreClr to preview6.19280.1 (dotnet/coreclr#24848)

Commit migrated from https://github.com/dotnet/coreclr/commit/604a34b497219551a20abe266337b64e7124dac6

5 years agoAdd Environment.TickCount64 (dotnet/coreclr#24857)
Stephen Toub [Thu, 30 May 2019 16:54:55 +0000 (12:54 -0400)]
Add Environment.TickCount64 (dotnet/coreclr#24857)

Commit migrated from https://github.com/dotnet/coreclr/commit/31acad70cae93caf0afe753775f14ebe80db31ed

5 years agoImplement R2R helpers for synchronized methods (dotnet/coreclr#24646)
Michal Strehovský [Thu, 30 May 2019 15:37:23 +0000 (17:37 +0200)]
Implement R2R helpers for synchronized methods (dotnet/coreclr#24646)

Synchronized methods show up when `Console` is used and the missing helper mapping would cause us not to AOT compile them.

Commit migrated from https://github.com/dotnet/coreclr/commit/7143390a5834d22213ffbbc04f8817b1c401fb83

5 years agoFrkaya/gcc fix 052919 (dotnet/coreclr#24845)
Sinan Kaya [Thu, 30 May 2019 08:35:37 +0000 (04:35 -0400)]
Frkaya/gcc fix 052919 (dotnet/coreclr#24845)

* fix compilation with gcc7.x

In file included from src/inc/sstring.h:1029:0,
                 from src/inc/ex.h:19,
                 from src/inc/stgpool.h:28,
                 from src/inc/../md/inc/metamodel.h:18,
                 from src/inc/../md/inc/metamodelro.h:19,
                 from src/inc/metadata.h:17,
                 from src/inc/corpriv.h:21,
                 from src/md/compiler/stdafx.h:20,
                 from src/md/compiler/mdutil.cpp:12:
src/inc/sstring.inl: In member function ‘const WCHAR* SString::GetUnicode() const’:
src/inc/sstring.inl:650:5: error: nonnull argument ‘this’ compared to NULL [-Werror=nonnull-compare]
     if (this == NULL)
     ^~

add version check

* Use the abstracted version of __nodebug__

* cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C

Commit migrated from https://github.com/dotnet/coreclr/commit/41832cedbb2d46362239d2b272964a39ca37cd89

5 years agoAllow generating HW intrinsics in crossgen (dotnet/coreclr#24689)
Michal Strehovský [Thu, 30 May 2019 07:48:07 +0000 (09:48 +0200)]
Allow generating HW intrinsics in crossgen (dotnet/coreclr#24689)

We currently don't precompile methods that use hardware intrinsics because we don't know the CPU that the generated code will run on. Jitting these methods slows down startup and accounts for 3% of startup time in PowerShell.
With this change, we're going to lift this restriction for CoreLib (the thing that matters for startup) and support generating HW intrinsics for our minimum supported target ISA (SSE/SSE2).

Commit migrated from https://github.com/dotnet/coreclr/commit/d4fadf03b9964ba9a1bf96f5a2136c2c8f4f38fe

5 years agoRemove all uses of CanRunManagedCode() (dotnet/coreclr#24847)
Aaron Robinson [Thu, 30 May 2019 06:51:51 +0000 (23:51 -0700)]
Remove all uses of CanRunManagedCode() (dotnet/coreclr#24847)

* Remove all uses of CanRunManagedCode()

Commit migrated from https://github.com/dotnet/coreclr/commit/5d16005b984b9b27ce59245bca87aa225b2ca0b7

5 years agoUse /proc/<pid>/mem to read memory in remote DBI data target. It makes the test case...
Mike McLaughlin [Thu, 30 May 2019 06:39:31 +0000 (23:39 -0700)]
Use /proc/<pid>/mem to read memory in remote DBI data target. It makes the test case run at (dotnet/coreclr#24844)

least 4 to 5 times faster than before.

Fallback to old transport ReadMemory if /proc/<pid>/mem can't be opened. This happens
on attach because of permissions/access, but works fine on the launch (the most
important case).

Commit migrated from https://github.com/dotnet/coreclr/commit/e46ae5921c510309f252af21c2a88d341e4e15ab

5 years agoAdd COMPlus_LTTng environment variable (dotnet/coreclr#24733)
John Salem [Thu, 30 May 2019 01:59:27 +0000 (18:59 -0700)]
Add COMPlus_LTTng environment variable (dotnet/coreclr#24733)

* default value is 1, and when set to 0 will disable loading LTTng.

Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/cc1f8ab68e645cd46601b1df50ff644dfffc4dae

5 years agoSort out ARM load/store instruction size issues (dotnet/coreclr#20126)
mikedn [Thu, 30 May 2019 00:53:11 +0000 (03:53 +0300)]
Sort out ARM load/store instruction size issues (dotnet/coreclr#20126)

* Avoid using ins_Load/ins_Store with constant type

* Use ldr to load array lengths/lower bounds

genCodeForArrIndex and genCodeForArrOffset emit a ldrsw on ARM64 but that's not necessary. Array lengths are always positive. Lower bounds are signed but then the subsequent subtract is anyway EA_4BYTE so sign extension isn't actually needed. Just use ldr on both ARM32 and ARM64.

* Use ldr to load array length (part 2)

genCodeForIndexAddr's range check generation is messed up:
- It uses ldrsw to load array length on ARM64. Not needed, the length is positive.
- It uses sxtw to sign etxend the array length if the index is native int. But it was already extended by the load.
- It creates IND and LEA nodes out of thin air. Just call the appropiate emitter functions.
- It always generates a TYP_I_IMPL cmp, even when the index is TYP_INT. Well, that's just bogus.

* Stop the using the instruction size for immediate scaling on ARM32

The scaling of immediate operands is a property of the instruction and its encoding. It doesnt' make sense to throw the instruction size (emitAttr) into the mix, that's a codegen/emitter specific concept. On ARM32 it's also almost meaningless, at least in the case of integer types - all instructions are really EA_4BYTE, even ldrb, ldrh etc.

The ARM64 emitter already extracts the scaling factor from the instruction. It can't use the instruction size as on ARM64 the size is used to select between 32 bit and 64 bit instructions so it's never EA_1BYTE/EA_2BYTE.

* Stop using ldrsw for TYP_INT loads

ARM64's ins_Load returns INS_ldrsw for TYP_INT but there's nothing in the JIT type system that requires sign extending TYP_INT values on load. The fact that an indir node has TYP_INT doesn't even imply that the value to load is signed, it may be unsigned and indir nodes will never have type TYP_UINT nor have the GTF_UNSIGNED flag set.

XARCH uses a mov (rather than movsxd, the equivalent of ldrsw) so it zero extends. There's no reason for ARM64 to behave differently and doing so makes it more difficult to share codegen logic between XARCH and ARM64

Other ARM64 compilers also use ldr rather than ldrsw.

This requires patching up emitInsAdjustLoadStoreAttr so EA_4BYTE loads don't end up using EA_8BYTE, which ldrsw requires.

* Cleanup genCodeForIndir/genCodeForStoreInd

In particular, cleanup selection of acquire/release instructions. The existing code starts by selecting a "normal" instruction, only to throw it away and redo the type/size logic in the volatile case. And get it wrong in the process, it required that "targetType" be TYP_UINT or TYP_LONG to use ldar. But there are no TYP_UINT indirs.

Also rename "targetType" to "type", using "target" is misleading. The real target type would be genActualType(tree->TypeGet()).

* Remove ARM32/64 load/store instruction size inconsistencies

- Require EA_4BYTE for byte/halfword instructions on ARM32.
- Remove emitInsAdjustLoadStoreAttr on ARM64. Getting the correct instruction size simply requires using emitActualTypeSize, that will provide the correct size on both ARM32 and ARM64.
- Replace emitTypeSize with emitActualTypeSize as needed.

* Remove unnecessary insUnscaleImm parameter

Commit migrated from https://github.com/dotnet/coreclr/commit/c6824d52873d0f6382b4f733c50f510491d37b12

5 years agoStop using %~dp0 in build scripts after args processing (dotnet/coreclr#24842)
Elinor Fung [Thu, 30 May 2019 00:10:41 +0000 (17:10 -0700)]
Stop using %~dp0 in build scripts after args processing (dotnet/coreclr#24842)

Commit migrated from https://github.com/dotnet/coreclr/commit/0950e5200eaefab9ac75edd59d23ef69eaccf539

5 years agoUpdate CoreClr to preview6.19279.1 (dotnet/coreclr#24829)
dotnet-maestro-bot [Wed, 29 May 2019 22:57:42 +0000 (15:57 -0700)]
Update CoreClr to preview6.19279.1 (dotnet/coreclr#24829)

Commit migrated from https://github.com/dotnet/coreclr/commit/42d8e40e469cf00128e0cfa48f24297afa13c36f

5 years agoRefactor native build to remove the compiler-override files (dotnet/coreclr#23897)
Jeremy Koritzinsky [Wed, 29 May 2019 21:40:31 +0000 (14:40 -0700)]
Refactor native build to remove the compiler-override files (dotnet/coreclr#23897)

* On systems that have both cmake 2 and cmake 3, use cmake 3.

Move CMAKE_EXPORT_COMPILE_COMMANDS to top level instead of in gen-buildsys-*. Define the CMake install prefix in gen-buildsys-* instead of pulling from an environment variable.

Define C++ standard as CMake property instead of as flag.

Move CLR_DEFINES_*_INIT out of overrides and into configurecompiler.cmake

Move flags that generate debug info into configurecompiler.cmake

Remove the CMAKE_USER_RULES_OVERRIDE files.

Add cmake version output for determining what cmake versions each CI system has.

Fix syntax in gen-buildsys-clang.

Change add_compile_definitions back to add_definitions

Add -D prefix for adding definitions via add_definitions

Remove extraneous double-quote

Change default config definition adding to the syntax in master

Switch back to old CMAKE_<LANG>_FLAGS way of setting the language standards and try to go back to 2.8.12 minimum

Switch back setting compile definitions for non-Windows branch too.

Use SET with CMAKE_<LANG>_FLAGS. Convert some usages of appending to CMAKE_<LANG>_FLAGS to add_compile_options where possible.

Set CMAKE_<LANG>_FLAGS_INIT instead of CMAKE_<LANG>_FLAGS

Make sure configureopimitzation.cmake is included correctly in test build.

Try to add brackets to get the Linux ARM compilation working correctly.

Define standard language version in configurecompiler.cmake instead of root CMakeLists (so tests get it)

Try to move langauge standard check to configure.cmake

define language standard in each root CMakeLists.txt

Fix off-Windows test build.

Set CMAKE_EXPORT_COMPILE_COMMANDS after the project() call

* Set CMAKE_USER_MAKE_RULES_OVERRIDE to "" to not break incremental builds after building on a branch that had it set to a path.

* Remove CMake version output.

* Move comment outside of multiline command.

* Retry setting CMAKE_USER_MAKE_RULES_OVERRIDE

* Remove unnecessary variable wrappers.

* Simplify cmake 3 resolution.

* Explicitly use CMAKE_CXX_FLAGS for C++-only flags that GCC complains about on C files.

* Set -Wall via CMAKE_<LANG>_FLAGS until we can move all flag settings to add_compile_options

* Fix typos

* Another temporary precedence issue.

* include configureoptimization.cmake in configurecompiler.cmake

* Move setting CMAKE_EXPORT_COMPILE_COMMANDS to configurecompiler.cmake.

* Rename configure.cmake -> verify_lto.cmake.

* Fix path to verify-lto

* Try using CMAKE_<LANG>_FLAGS instead of CMAKE_<LANG>_FLAGS_INIT.

* Revert name change to configure.camek

Commit migrated from https://github.com/dotnet/coreclr/commit/38f121b06910b25080b5f3259152effc0fe3c672

5 years agoUse Ubuntu 14.04-on-16.04 Docker image for arm cross builds. (dotnet/coreclr#23999)
Jeremy Koritzinsky [Wed, 29 May 2019 20:47:52 +0000 (13:47 -0700)]
Use Ubuntu 14.04-on-16.04 Docker image for arm cross builds. (dotnet/coreclr#23999)

Commit migrated from https://github.com/dotnet/coreclr/commit/3ac776125f4b9182de05abb1daccb98221509cc1

5 years agoStop specifying cdecl for ComponentEntryPoint (default to stdcall) (dotnet/coreclr...
Elinor Fung [Wed, 29 May 2019 20:32:07 +0000 (13:32 -0700)]
Stop specifying cdecl for ComponentEntryPoint (default to stdcall) (dotnet/coreclr#24833)

Commit migrated from https://github.com/dotnet/coreclr/commit/85af89bbbf22b30f3f7f46c961b3f484c8783630

5 years agoChange binary op tree display (dotnet/coreclr#20045)
mikedn [Wed, 29 May 2019 17:37:25 +0000 (20:37 +0300)]
Change binary op tree display (dotnet/coreclr#20045)

Commit migrated from https://github.com/dotnet/coreclr/commit/2eeeac5b0239cc619c1d71dc33896fa2bdced12c

5 years agoAdd back AssemblyDescription attribute (dotnet/coreclr#24819)
Sven Boemer [Wed, 29 May 2019 16:06:55 +0000 (09:06 -0700)]
Add back AssemblyDescription attribute (dotnet/coreclr#24819)

This was present in System.Private.CoreLib previously, but removed in recent versions (I compared 3.0.0-preview5-27610-03 and 3.0.0-preview6-27715-05 on macos). It's unclear to me what used to be adding the attribute  - https://github.com/dotnet/coreclr/commit/dotnet/coreclr@099177b0899156a4e8a352083a273805240c0ccd touched the SPC logic, but even in that change I see no mention of it. Maybe it used to be autogenerated by the old project files. In any case, I believe it should be added back.
Its value used to be System.Private.CoreLib:
```diff
-  .custom instance void System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 16 53 79 73 74 65 6D 2E 50 72 69 76 61 74   // ...System.Privat
-                                                                                          65 2E 43 6F 72 65 4C 69 62 00 00 )                // e.CoreLib..
```

Commit migrated from https://github.com/dotnet/coreclr/commit/90e7b68a9616b7c643a3e0e0e918102d94e527a2

5 years agoUpdate MicrosoftDotNetXUnitConsoleRunnerVersion to reflect changes in Arcade (dotnet...
Egor Chesakov [Wed, 29 May 2019 14:42:55 +0000 (07:42 -0700)]
Update MicrosoftDotNetXUnitConsoleRunnerVersion to reflect changes in Arcade (dotnet/coreclr#24822)

* Update tf to netcoreapp2.1

* Bump up version of xunit.console package to 2.5.1-beta.19278.1

* Fix type in the version

Commit migrated from https://github.com/dotnet/coreclr/commit/90f2960e19700914c15abe1ead895c0ebea0db22

5 years agoSpecify restore sources in optdata.csproj (dotnet/coreclr#24825)
Elinor Fung [Wed, 29 May 2019 07:40:39 +0000 (00:40 -0700)]
Specify restore sources in optdata.csproj (dotnet/coreclr#24825)

Commit migrated from https://github.com/dotnet/coreclr/commit/b795318badbb2b7dd25715fff9f26153f261b4d4

5 years agoCreate the Concept of Multiple EventPipe Sessions (dotnet/coreclr#24417)
José Rivero [Wed, 29 May 2019 06:17:02 +0000 (23:17 -0700)]
Create the Concept of Multiple EventPipe Sessions (dotnet/coreclr#24417)

This is the initial work to enable https://github.com/dotnet/coreclr/issues/15377

## What's here?

- A lot of code move/split. Some important moves:
  - `EventPipe` has a colection of `EventPipeSessions` instead of a single session.
  - `EventPipeSession` now owns a `EventPipeBufferManager` and a `EventPipeFile`
  - `EventPipeThread` now owns a collection of { EventPipeBufferManager, EventPipeBuffer }, and a collection of { EventPipeBufferManager, EventPipeBufferList }
  - There is a cap on the max number of `EventPipeSession` (64 sessions)
  - `EventPipeProvider` and `EventPipeEvent` use a 64-bit mask to keep track of the sessions that are listening to provider/events.

## What's pending?

https://github.com/dotnet/coreclr/issues/24753

Commit migrated from https://github.com/dotnet/coreclr/commit/19edba3699daca1002bcd748e152d526d5b7bb69

5 years agoChange DllImportPath policy to create unicode-named test library immediately before...
Jeremy Koritzinsky [Wed, 29 May 2019 03:55:52 +0000 (20:55 -0700)]
Change DllImportPath policy to create unicode-named test library immediately before use (dotnet/coreclr#24812)

* Change DllImportPath_Unicode to use valid unicode characters. Create DllImportPath_Unicode via copying in a MSBuild property (copying in the test script doesn't work with batch).

* Have the test create the unicode native library right before use.

* Get first Dllimportpath_local that has the correct extension (check instead of assuming that the first one is the correct one).

Commit migrated from https://github.com/dotnet/coreclr/commit/c614a00fed86ffa921b55d169bb6a7eb8625c7ff

5 years agoUse Arcade for native versioning (dotnet/coreclr#24785)
Elinor Fung [Wed, 29 May 2019 01:46:08 +0000 (18:46 -0700)]
Use Arcade for native versioning (dotnet/coreclr#24785)

Commit migrated from https://github.com/dotnet/coreclr/commit/34805dc3852ba218fcfd695bc0b9eb996860e025

5 years agoFix nullable annotation
Jan Kotas [Tue, 28 May 2019 22:48:40 +0000 (15:48 -0700)]
Fix nullable annotation

Commit migrated from https://github.com/dotnet/coreclr/commit/420884ff6f4244f0e6ca8c5cfc2f59a708d89379

5 years agoFix superfluous delegate allocations in Unix WaitSubsystem (dotnet/coreclr#7454)
Jan Kotas [Tue, 28 May 2019 20:55:06 +0000 (13:55 -0700)]
Fix superfluous delegate allocations in Unix WaitSubsystem (dotnet/coreclr#7454)

Fixes dotnet/coreclr#7452

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/cdcc588fba1158a3ec7f45a539eece687426e917

5 years agoAdd null checks before calling ClassLoader::EnsureLoaded (dotnet/coreclr#24818)
Jan Kotas [Wed, 29 May 2019 01:38:42 +0000 (18:38 -0700)]
Add null checks before calling ClassLoader::EnsureLoaded (dotnet/coreclr#24818)

Fixes dotnet/coreclr#24816

Commit migrated from https://github.com/dotnet/coreclr/commit/02e75ab55272902aed4c2501ab7c6740bae30485

5 years agoStop adding 7 before the build revision number (dotnet/coreclr#24805)
Elinor Fung [Wed, 29 May 2019 00:37:52 +0000 (17:37 -0700)]
Stop adding 7 before the build revision number (dotnet/coreclr#24805)

Commit migrated from https://github.com/dotnet/coreclr/commit/7f9e1aef945a2115b337688976fa1c4cfebe1825

5 years agoChange StreamReader.ReadBufferAsync to return ValueTask<int> (dotnet/coreclr#24810)
Stephen Toub [Wed, 29 May 2019 00:36:52 +0000 (20:36 -0400)]
Change StreamReader.ReadBufferAsync to return ValueTask<int> (dotnet/coreclr#24810)

It's a private helper that's always directly awaited.  No need to allocate a task each time it's called and data is synchronously available.

Commit migrated from https://github.com/dotnet/coreclr/commit/13405da4ba21095f7673a10eaabfef990117478d

5 years agoFix IBC data collection (dotnet/coreclr#24814)
Jan Kotas [Tue, 28 May 2019 23:37:49 +0000 (16:37 -0700)]
Fix IBC data collection (dotnet/coreclr#24814)

Commit migrated from https://github.com/dotnet/coreclr/commit/88ebe4fab2945d6f45894e0e58f64a3054142664

5 years agoStop using BuildTools for signing (dotnet/coreclr#24808)
Elinor Fung [Tue, 28 May 2019 23:09:46 +0000 (16:09 -0700)]
Stop using BuildTools for signing (dotnet/coreclr#24808)

Commit migrated from https://github.com/dotnet/coreclr/commit/052042e8268d8f6e8743a7505666016c7b71f26c

5 years agoRename CreateNativeDelegate -> LoadAssemblyAndGetFunctionPointer (dotnet/coreclr...
Elinor Fung [Tue, 28 May 2019 23:05:28 +0000 (16:05 -0700)]
Rename CreateNativeDelegate -> LoadAssemblyAndGetFunctionPointer (dotnet/coreclr#24804)

Change extensibility parameter to void *

Commit migrated from https://github.com/dotnet/coreclr/commit/ff39e7f372515ecefac3f30640bffbeafc20adb6

5 years agoUsing AllocateUninitializedArray in array pool (dotnet/coreclr#24504)
Vladimir Sadov [Tue, 28 May 2019 21:28:56 +0000 (14:28 -0700)]
Using AllocateUninitializedArray in array pool (dotnet/coreclr#24504)

* Just use `new T[]` when elements are not pointer-free

* reduce zeroing out when not necessary.

* use AllocateUninitializedArray in ArrayPool

Commit migrated from https://github.com/dotnet/coreclr/commit/4ca032d49b0718eb40f2105f94db2b243cf94957

5 years agoMove parts of WeakReference to shared partition (dotnet/coreclr#24800)
Marek Safar [Tue, 28 May 2019 20:54:38 +0000 (22:54 +0200)]
Move parts of WeakReference to shared partition (dotnet/coreclr#24800)

Commit migrated from https://github.com/dotnet/coreclr/commit/2b08a111cc77d77221889700d169c9c636153355

5 years agoFixing the epilog size decoding
Andrew Au [Sun, 26 May 2019 23:30:39 +0000 (16:30 -0700)]
Fixing the epilog size decoding

Commit migrated from https://github.com/dotnet/coreclr/commit/c690daea096f44d6563de58cd4b5d50cce83d9bf

5 years agoCleanup unnecessary code in exception formatting (dotnet/coreclr#24797)
Jan Kotas [Tue, 28 May 2019 18:18:28 +0000 (11:18 -0700)]
Cleanup unnecessary code in exception formatting (dotnet/coreclr#24797)

* Cleanup unnecessary code in exception formatting

* Delete fNeedFileInfo argument for GetStackTrace

Fixes dotnet/coreclr#8694

Commit migrated from https://github.com/dotnet/coreclr/commit/156240d59b8acc277504fe43f148fe53e63f40bc

5 years agoExpose Path.TrimEndingDirectorySeparator (dotnet/coreclr#20805)
Marco Rossignoli [Tue, 28 May 2019 18:14:05 +0000 (20:14 +0200)]
Expose Path.TrimEndingDirectorySeparator (dotnet/coreclr#20805)

* expose TrimEndingDirectorySeparator

* address PR feedback

* updates

* address PR feedback

* fix comment

Commit migrated from https://github.com/dotnet/coreclr/commit/e44730085c65ddb98dad1a3059b4e8f7a1ae33ea

5 years agoMove some CustomAttribute related types to shared (dotnet/coreclr#23651)
Egor Bogatov [Tue, 28 May 2019 18:12:01 +0000 (21:12 +0300)]
Move some CustomAttribute related types to shared (dotnet/coreclr#23651)

Commit migrated from https://github.com/dotnet/coreclr/commit/89517b04ae89a39b4bde720f8cca87cfa4f12d2e

5 years agoMake sure the layout of coreclr!Module is the same as mscordaccore!Module
Andrew Au [Tue, 28 May 2019 08:02:26 +0000 (01:02 -0700)]
Make sure the layout of coreclr!Module is the same as mscordaccore!Module

Commit migrated from https://github.com/dotnet/coreclr/commit/4f325ce1a17a5ec5a0ac424cded0c98f268605f1

5 years agoFix initial thread affinity on Linux (dotnet/coreclr#24801)
Jan Vorlicek [Tue, 28 May 2019 16:06:38 +0000 (18:06 +0200)]
Fix initial thread affinity on Linux (dotnet/coreclr#24801)

* Fix initial thread affinity on Linux

On Linux, a new thread inherits the affinity mask of the thread
that created the new thread. This is a problem for background GC
threads that are created by one of the server GC threads that are
affinitized to single core.
This change adds resetting each new thread affinity to match the
current process affinity.
In addition to that, I've also fixed the extraction of the CPU count
that was using PID 0. While the doc says that 0 represents current process,
it in fact means current thread.
And as a small bonus, I've added caching of the value returned by
the PAL_GetLogicalCpuCountFromOS, since it cannot change during runtime.

Commit migrated from https://github.com/dotnet/coreclr/commit/3489e56c875c6144c729b51063300c7d60b1ae31

5 years agoUpdate CoreClr to preview6.19277.72 (dotnet/coreclr#24795)
dotnet-maestro-bot [Tue, 28 May 2019 10:07:21 +0000 (03:07 -0700)]
Update CoreClr to preview6.19277.72 (dotnet/coreclr#24795)

Commit migrated from https://github.com/dotnet/coreclr/commit/7631331183266734342de351b25519a07743e13e

5 years agoImprove performance of !dumpasync SOS command
Stephen Toub [Sat, 25 May 2019 02:06:37 +0000 (22:06 -0400)]
Improve performance of !dumpasync SOS command

A significant majority of the time spent in dumpasync was in getting the type name of each object in order to compare it to "AsyncStateMachineBox".  This switches to comparing by module and mdTypeDef.  On an ~1GB dump, the time to execute !dumpasync dropped from 43 to 11 seconds on my machine.

Commit migrated from https://github.com/dotnet/coreclr/commit/25878db0c11bfb8d52088c75ccfcc13e4c8383f2

5 years agoDisplay state machine fields in DumpAsync for -stacks
Stephen Toub [Thu, 23 May 2019 02:56:33 +0000 (22:56 -0400)]
Display state machine fields in DumpAsync for -stacks

Currently the DumpAsync -fields option just impacts whether the state machine fields are output for the top-level state machines.  We received feedback that it would be more expected for -fields to also cause the fields to be output for all state machines listed as part of continuation chains.  This does that.

Commit migrated from https://github.com/dotnet/coreclr/commit/66134f6e3646f22ac551fb5d720033d26d4cbf8d

5 years agoAdd and apply nullable attributes (dotnet/coreclr#24679)
Stephen Toub [Tue, 28 May 2019 10:04:13 +0000 (06:04 -0400)]
Add and apply nullable attributes (dotnet/coreclr#24679)

* Add and apply nullable attributes

* Adapt to API review decisions

* Address PR feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/4a1275434fff99206f2a28f5f0e87f124069eb7f

5 years agoCall derived ToString on inner exceptions (dotnet/coreclr#24793)
Dan Moseley [Tue, 28 May 2019 02:34:19 +0000 (19:34 -0700)]
Call derived ToString on inner exceptions (dotnet/coreclr#24793)

* Remove special Appx path and METHOD__EXCEPTION__TO_STRING

* Remove Exception.ToString(bool, bool)

* Remove Exception.InternalToString and callers

* Cache message

Commit migrated from https://github.com/dotnet/coreclr/commit/bb75edbac9c40034b6683c17d86057ee9bf4192d

5 years agoUse PublishBuildArtifacts instead of PublishPipelineArtifact (dotnet/coreclr#24788)
Egor Chesakov [Tue, 28 May 2019 00:23:52 +0000 (17:23 -0700)]
Use PublishBuildArtifacts instead of PublishPipelineArtifact (dotnet/coreclr#24788)

* Use PublishBuildArtifacts instead of PublishPipelineArtifacts

* Use DownloadBuildArtifacts instead of DownloadPipelineArtifact

* Try to specify itemPattern

* Use PublishBuildArtifacts instead of PublishPipelineArtifacts

* Try copy files in a separate step

* Add missing $

Commit migrated from https://github.com/dotnet/coreclr/commit/064686ce3a5501ffaa4eace5f2f21bd454642124

5 years agoFix module override for recursive generic signatures (dotnet/coreclr#24707)
Jan Vorlicek [Mon, 27 May 2019 16:42:16 +0000 (18:42 +0200)]
Fix module override for recursive generic signatures (dotnet/coreclr#24707)

* Fix module override for recursive generic signatures

When crossgen-ing with large version bubble enabled, generic signatures
that got copied from the source IL were missing module overrides at
deeper levels of the generic signature.
For example, in case of X<Y<A,B>,Z>, the override was applied only to Y
and Z, but not to A and B.

This change fixes that by inserting module override zapsig at all
levels.

Commit migrated from https://github.com/dotnet/coreclr/commit/419b46fc7d0fe0659e7ab521c222b7c921b36e35

5 years agoStop nulling out lock object in SemaphoreSlim (dotnet/coreclr#24776)
Stephen Toub [Sun, 26 May 2019 02:13:05 +0000 (22:13 -0400)]
Stop nulling out lock object in SemaphoreSlim (dotnet/coreclr#24776)

SemaphoreSlim.Dispose nulls out its lock object, and that's then used as an indication in other methods whether they should throw ObjectDisposedException.  But nulling out an object used for synchronization in other methods is a bad practice, and while SemaphoreSlim.Dispose is not thread-safe to be used concurrently with other usage of the instance, it's still confusing when such usage leads to NullReferenceExceptions due to trying to lock on a null lock object.  This change just changes the lock to be readonly, always set, and then whether the instance has been disposed is just a value set on that object (such that it's no larger than it used to be).

Commit migrated from https://github.com/dotnet/coreclr/commit/580152a50e4092d32c7d05ec876cd6976483ebf1

5 years agoMake sure all of the calculations of enregistered return types match correctly. ...
Jeremy Koritzinsky [Sat, 25 May 2019 16:19:03 +0000 (09:19 -0700)]
Make sure all of the calculations of enregistered return types match correctly. (dotnet/coreclr#24771)

* Make sure all of the calculations of enregistered return types match correctly.

* Revert "Disable ARM64 IDispatch tests (dotnet/coreclr#24770)"

This reverts commit dotnet/coreclr@852f40d5f1a3cff4d381c2de2d2a86fe8b1f29b4.

Commit migrated from https://github.com/dotnet/coreclr/commit/83309575a1552e39fe505cbd883391f3dcbea8b4

5 years agoDelete FEATURE_USE_LCID (dotnet/coreclr#24767)
Jan Kotas [Sat, 25 May 2019 06:10:21 +0000 (23:10 -0700)]
Delete FEATURE_USE_LCID (dotnet/coreclr#24767)

Never defined and obsolete

Commit migrated from https://github.com/dotnet/coreclr/commit/5b283a18625f7a8009c18221592ec81c3cd32375

5 years agoAdd more runtime GC counters (dotnet/coreclr#24561)
Sung Yoon Whang [Sat, 25 May 2019 03:16:11 +0000 (20:16 -0700)]
Add more runtime GC counters (dotnet/coreclr#24561)

* Add Series/CounterType to CounterPayload and IncrementingCounterPayload

* merging with master

* Add Generation sizes counter

* Some cleanup

* Add allocation rate counter

* Fix build

* add Allocation Rate runtime counter

* Fix a potential div by zero exception

* Add back in code commented out

* Add LOH size counter

* Fix linux build

* GetTotalAllocated -> GetTotalAllocation

* PR feedback

* More cleanup + renaming per PR feedback

* undo comments

* more pr feedback

* Use existing GC.GetTotalAllocatedBytes API instead

* Remove duplicate GetTotalAllocation

* More PR feedback

* Fix x86 build

* Match type between C++/C#

* remove unused variables'

Commit migrated from https://github.com/dotnet/coreclr/commit/b676246c1dd880b7290a1313cdac309fe020aa6f

5 years agoDisable ARM64 IDispatch tests (dotnet/coreclr#24770)
Jeremy Koritzinsky [Fri, 24 May 2019 23:39:50 +0000 (16:39 -0700)]
Disable ARM64 IDispatch tests (dotnet/coreclr#24770)

Commit migrated from https://github.com/dotnet/coreclr/commit/852f40d5f1a3cff4d381c2de2d2a86fe8b1f29b4

5 years agoArm64: Take more bounds checks into consideration when inlining immediates (dotnet...
Tamar Christina [Fri, 24 May 2019 23:26:18 +0000 (00:26 +0100)]
Arm64: Take more bounds checks into consideration when inlining immediates (dotnet/coreclr#24762)

* Arm64: Take GT_ARR_BOUNDS_CHECK to consideration for inlining immediate in cmp

* Arm64: Add SIMD and HW_INTRINSIC to IsContainableImmed

Commit migrated from https://github.com/dotnet/coreclr/commit/c6b3b61ae4d9ec1f928f02d4272135bca8d75f52

5 years agoSet the HasExplicitSize flag when a class size is specified in metadata. (dotnet...
Jeremy Koritzinsky [Fri, 24 May 2019 22:26:14 +0000 (15:26 -0700)]
Set the HasExplicitSize flag when a class size is specified in metadata. (dotnet/coreclr#24763)

* Set the HasExplicitSize flag when a class size is specified in metadata.

* Add test from @mikedn.

Commit migrated from https://github.com/dotnet/coreclr/commit/0bdf613f09a3bf409717beb939195b39e40c6828

5 years agoFix nulable annotations build break (dotnet/coreclr#24768)
Jan Kotas [Fri, 24 May 2019 22:24:17 +0000 (15:24 -0700)]
Fix nulable annotations build break (dotnet/coreclr#24768)

Commit migrated from https://github.com/dotnet/coreclr/commit/74d90fdaaa9a0aea2ee5da2cf38dfc07b0bf95fa

5 years agoUpdate CoreClr to preview6.19274.71 (dotnet/coreclr#24761)
dotnet-maestro-bot [Fri, 24 May 2019 21:37:04 +0000 (14:37 -0700)]
Update CoreClr to preview6.19274.71 (dotnet/coreclr#24761)

Commit migrated from https://github.com/dotnet/coreclr/commit/1f428dbc5554191dadd27511cd5cd181e4a60efb

5 years ago[master] Update dependencies from dotnet/arcade (dotnet/coreclr#24333)
dotnet-maestro[bot] [Fri, 24 May 2019 21:36:24 +0000 (14:36 -0700)]
[master] Update dependencies from dotnet/arcade (dotnet/coreclr#24333)

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

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

* Update Unix permissions

* Set the versions same way as CoreFX repo

* Fix the product branding version

* Delete .NET Framework reference assemblies reference

* Workaround for https://github.com/dotnet/arcade/issues/2673

Commit migrated from https://github.com/dotnet/coreclr/commit/d3b5e99a75be2344ec7bc9e1f28319cd3d31ccc2

5 years agoMerge pull request dotnet/coreclr#24764 from safern/FixArraySetValueNullable
Santiago Fernandez Madero [Fri, 24 May 2019 21:14:42 +0000 (14:14 -0700)]
Merge pull request dotnet/coreclr#24764 from safern/FixArraySetValueNullable

 Fix some nullable annotations

Commit migrated from https://github.com/dotnet/coreclr/commit/5d85833c0169de7a8a54351184238a0525da5073

5 years agoFix publishing in official build
Elinor Fung [Fri, 24 May 2019 18:53:42 +0000 (11:53 -0700)]
Fix publishing in official build

Commit migrated from https://github.com/dotnet/coreclr/commit/79c3f85963a3447cbf349c421a78e2a585a8dafe

5 years agoEnable LCID marshalling and clean up our LCID marshalling tests. (dotnet/coreclr...
Jeremy Koritzinsky [Fri, 24 May 2019 20:20:23 +0000 (13:20 -0700)]
Enable LCID marshalling and clean up our LCID marshalling tests. (dotnet/coreclr#24642)

* Enable LCID marshalling and clean up our LCID marshalling tests.

* Fix return type.

* Enable LCID IDispatch reverse marshalling

* Add more tests for LCID marshalling.

* Add testing for reverse-IDispatch. Fix bug in Thread::GetCulture when culture has not been initialized on the managed side.

* PR Feedback.

* Fix install command.

Commit migrated from https://github.com/dotnet/coreclr/commit/73217c884caeca4bcfbb9cc93ffe4c90db79cf7a

5 years agoPR Feedback
Santiago Fernandez Madero [Fri, 24 May 2019 19:00:48 +0000 (12:00 -0700)]
PR Feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/75c8c865ea12b079df314d3a14a614bb5e243972

5 years agoFix nullable annotation in String.Join
Santiago Fernandez Madero [Fri, 24 May 2019 18:54:56 +0000 (11:54 -0700)]
Fix nullable annotation in String.Join

Commit migrated from https://github.com/dotnet/coreclr/commit/06de1100c25eb38e94334054b7176f1baf7e1263

5 years agoFix nullable annotations in RuntimeTypeHandle operators
Santiago Fernandez Madero [Fri, 24 May 2019 18:45:29 +0000 (11:45 -0700)]
Fix nullable annotations in RuntimeTypeHandle operators

Commit migrated from https://github.com/dotnet/coreclr/commit/7a60974599a3ca78e354b391afc23b56af294008

5 years agoFix Guid.TryParse nullabel annotation
Santiago Fernandez Madero [Fri, 24 May 2019 18:31:12 +0000 (11:31 -0700)]
Fix Guid.TryParse nullabel annotation

Commit migrated from https://github.com/dotnet/coreclr/commit/9495ff00afe9955ff1c869f9d6b2ddcd703a83a6

5 years agoFix nullable annotation in Array.SetValue
Santiago Fernandez Madero [Fri, 24 May 2019 18:02:44 +0000 (11:02 -0700)]
Fix nullable annotation in Array.SetValue

Commit migrated from https://github.com/dotnet/coreclr/commit/8aef401ad4ecab91d237c00e4cccc3500132da50

5 years agoMove to 3.0 SDK (dotnet/coreclr#24756)
Elinor Fung [Fri, 24 May 2019 15:52:45 +0000 (08:52 -0700)]
Move to 3.0 SDK (dotnet/coreclr#24756)

Commit migrated from https://github.com/dotnet/coreclr/commit/5894a0f4ecd7360dc25b1e01afb0120efceb7a11

5 years agoFix FEATURE_PREJIT option setup (dotnet/coreclr#24760)
Gleb Balykov [Fri, 24 May 2019 15:24:55 +0000 (18:24 +0300)]
Fix FEATURE_PREJIT option setup (dotnet/coreclr#24760)

Commit migrated from https://github.com/dotnet/coreclr/commit/f917969fed12b6fd8dca545b210c45eaafefd634

5 years agoUpdate BuildTools, CoreClr to preview4-04022-01, preview6-27721-71, respectively...
dotnet-maestro-bot [Fri, 24 May 2019 13:46:47 +0000 (06:46 -0700)]
Update BuildTools, CoreClr to preview4-04022-01, preview6-27721-71, respectively (master) (dotnet/coreclr#24369)

* Update BuildTools, CoreClr to preview4-04022-01, preview6-27721-71, respectively

* Use `Nullable=enable` rather than `NullableContextOptions=enable`

* Resolving new nullability warnings

* PR Feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/b2b7cabf57abd275a34284b28896852258e650f1

5 years agoRemove dependency on IEEMemoryManager (dotnet/coreclr#24755)
Jan Kotas [Fri, 24 May 2019 12:34:44 +0000 (05:34 -0700)]
Remove dependency on IEEMemoryManager (dotnet/coreclr#24755)

Commit migrated from https://github.com/dotnet/coreclr/commit/e4134398fd3c91cf3db99972f66fa74d5aa32bcf

5 years agoDelete RETURNTYPE and change how we get ReturnKind for gccover. (dotnet/coreclr#24600)
Sergey Andreenko [Fri, 24 May 2019 04:24:44 +0000 (21:24 -0700)]
Delete RETURNTYPE and change how we get ReturnKind for gccover. (dotnet/coreclr#24600)

* Move GetReturnKindFromMethodTable to method.hpp.

We would need this in other places in the next commits.

* Delete unnecessary checks from callhelpers.

* Do not check return types in CanDeduplicateCode.

GC info v.2 has this information and it is checked in another place.

* Change ComPlusMethodFrame to use the new function.

* Change gccover.cpp to use GetReturnKindFromMethodTable.

* Delete RETURNTYPE.

* Add check to ComPlusMethodFrame.

* Delete check from threadsuspend.

codeInfo->GetCodeManager()->GetReturnKind(gcInfoToken) must always return a valid kind nowdays (it could return an invalid lind only when GC Info v2 was not available).

* Rename functions/arguments.

* Add check for IsValidReturnKind.

* delete unused var.

Commit migrated from https://github.com/dotnet/coreclr/commit/d5d18896900561b7aaf38ba9501a8525a4b9caea

5 years agoDiagnostics IPC (dotnet/coreclr#24582)
John Salem [Fri, 24 May 2019 03:18:33 +0000 (20:18 -0700)]
Diagnostics IPC (dotnet/coreclr#24582)

* Initial draft of structs and classes for Diagnostic Server IPC Protocol

* Fix some syntax/name issues that weren't getting caught by intellisense in vscode for mac

* * Add member checkers for Flatten and GetSize
* Split Flatten impl to have a default version for simple, fixed-size structs

* * Remove unnecessary abstract class
* Add documentation about templates

* * Change templating for IpcMessage class to be more limited (only on message creation and payload parsing)
* flesh out parse and tryparse
* add requirement for non-fixed-size payloads to implement a static TryParse(buffer, bufferlen)
* refactor namespace to bottom of file

* * moved DiagnosticsIpc namespace into diagnosticprotocol.h to avoid being referenced by debug-pal project
* converted diagnostic server to use DiagnosticsIpc code
* converted EventPipeProtocolHelper to use DiagnosticsIpc code
* made EventPipe end to end use DiagnosticsIpc code

* * Add ASSERTs where relevant
* Refactor stream ownershpi back to previous way for collect tracing response

* * Add contracts where applicable

* * Updating GenerateCoreDump code to use new IPC work after rebase

* * modify contract in DiagnosticProtocolHelper to be more restrictive
* remove comments
* Add comment documentation of SFINAE pattern above usage
* simplify Has* checks
* Fix function resolution for static member check
* Add Constructor for rvalue references to IpcMessage
* avoid code path that would result in a blocking read on 0 bytes
* Fix silly strcmp bug
* fix contractin EventPipeProtocolHelper

* * Modify header declaration to make static initialization easier
* fix type in template code

* * Make all messages use Initialize instead of constructor for hydrating themselves, to make error paths easier

* * Expand and streamline error model to match spec
* Simplify writing error messages to a static function
* memory management

* *modify function signatures for SFINAE to remove clang warning

* * add braces to static initialization to remove clang warnings

* * modify IpcMessage::TryParseImpl, to reset the internal data pointer when passing back a reinterpret_cast to prevent double frees on destruction
* Add notes on requirement that user free the memory for a payload

* * fix bug in TryParse for generateCoreDump
* change INT to uint32_t in GenerateCoreDump payloads

* Remove unused error code

* * rename Miscellaneous command set to Diagnostic
* Remove unnecessary command ids in EventPipe

* Rename Diagnostic command set to Dump

* * Move payload into Holder to simplify cleanup
* Add buffer holder to payloads to ensure the buffers are being cleaned up after use
* updated Profiler attach to use IPC work after rebase

* * Fix typos
* Fix placement of ifdefs for profiler helpers

* * Fix accidental char hidden in ifdef...

* * Add ASSERT to signify we shouldn't be re-using IpcMessages

* * fix another typo hidden behind inactive ifdef...

* * Change errors to use HRESULTS to increase transparency
* fix bug in profiler attach for checking if entire client data is in buffer

Commit migrated from https://github.com/dotnet/coreclr/commit/267f8299ac1fd97430284fa6d44e5e9c6ed26850

5 years agoRe-enable queryperformancecounter PAL test (dotnet/coreclr#11291)
Jan Vorlicek [Fri, 24 May 2019 02:33:51 +0000 (19:33 -0700)]
Re-enable queryperformancecounter PAL test (dotnet/coreclr#11291)

The test seems to work in the lab again, so the failures seem to be related to the version
of OSX we were using in the past when the test started to fail.

Commit migrated from https://github.com/dotnet/coreclr/commit/442d71f95973f2d3b4c1fa2fb2664dcabf69329c

5 years agoCreate THIRD-PARTY-NOTICES.TXT (dotnet/coreclr#24752)
Rich Lander [Fri, 24 May 2019 00:40:45 +0000 (17:40 -0700)]
Create THIRD-PARTY-NOTICES.TXT (dotnet/coreclr#24752)

TPN for https://github.com/dotnet/coreclr/blob/dotnet/coreclr@a9074bce5e3814db67dbec1c56f477202164d162/tests/src/sizeondisk/sodbench/SoDBench.cs#L738

Commit migrated from https://github.com/dotnet/coreclr/commit/bf1472eaab876606090df62a23225ad13f104562

5 years agoMake AppDomain.GetThreadPrincipal() internal (dotnet/coreclr#24747)
Santiago Fernandez Madero [Fri, 24 May 2019 00:39:30 +0000 (17:39 -0700)]
Make AppDomain.GetThreadPrincipal() internal (dotnet/coreclr#24747)

Commit migrated from https://github.com/dotnet/coreclr/commit/46d98155f74fe3ff5ce82da033ead9fe108dda8f

5 years agoDelete FEATURE_TESTHOOK (dotnet/coreclr#24746)
Jan Kotas [Fri, 24 May 2019 00:38:52 +0000 (17:38 -0700)]
Delete FEATURE_TESTHOOK (dotnet/coreclr#24746)

Commit migrated from https://github.com/dotnet/coreclr/commit/d969f9766f8ae9b895b487cdbd600beeb47ee51b

5 years agoDelete unused file (dotnet/coreclr#24745)
Jan Kotas [Fri, 24 May 2019 00:38:42 +0000 (17:38 -0700)]
Delete unused file (dotnet/coreclr#24745)

Commit migrated from https://github.com/dotnet/coreclr/commit/5c1ccd1d83bd6927ae43ceb1a29568c2abe1491b

5 years agoDelete unused PredefinedTlsSlots (dotnet/coreclr#24744)
Jan Kotas [Fri, 24 May 2019 00:38:28 +0000 (17:38 -0700)]
Delete unused PredefinedTlsSlots (dotnet/coreclr#24744)

Commit migrated from https://github.com/dotnet/coreclr/commit/f0b12667cb8fc4ba767a7b2861cbc836bd3440e4

5 years agoFix restoring internal tools (dotnet/coreclr#24750)
Elinor Fung [Thu, 23 May 2019 23:42:08 +0000 (16:42 -0700)]
Fix restoring internal tools (dotnet/coreclr#24750)

Commit migrated from https://github.com/dotnet/coreclr/commit/061fd2b8cdde0c59d28edddf4594fb1123dcea93

5 years agoFewer ilstubs in corelib from reflection apis (dotnet/coreclr#24708)
David Wrighton [Thu, 23 May 2019 23:18:07 +0000 (16:18 -0700)]
Fewer ilstubs in corelib from reflection apis (dotnet/coreclr#24708)

Rework use of marshalling for RuntimeTypeHandle, RuntimeModule, RuntimeAssembly, and IRuntimeMethodInfo as used by QCalls
- Remove special QCall only used marshallers for RuntimeAssembly, RuntimeModule and IRuntimeMethodInfo
- Following the pattern of ObjectHandleOnStack, implement QCall handle types for RuntimeAssembly/Module/TypeHandle. Use these in all QCalls that once passed the types directly.
- For uses of IRuntimeMethodInfo, follow the existing RuntimeMethodHandleInternal pattern

Also perform some replacement of bool marshalling with use of Interop.BOOL, and a few cases of using pointers instead of byref arguments.

Fix delivers a relatively small win on startup, and small throughput gains around reflection as IL stubs are no longer necessary for many functions in reflection that once needed them.

Reduces methods jitted on powershell startup from 422 to 399, (About 5%) but performance win is only about 5ms on ~400ms as the methods removed are simple.

Commit migrated from https://github.com/dotnet/coreclr/commit/abdee1f2fa9531c78eeadef6d0bb8fb1f823d011

5 years agoFix CoreRT build breaks (dotnet/coreclr#24743)
Dotnet-GitSync-Bot [Thu, 23 May 2019 20:55:21 +0000 (13:55 -0700)]
Fix CoreRT build breaks (dotnet/coreclr#24743)

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/046d61c972d0b8372cbb7cec98e5636e08735782

5 years ago[master] Update dependencies from dotnet/corefx (dotnet/coreclr#24604)
dotnet-maestro[bot] [Thu, 23 May 2019 19:18:30 +0000 (12:18 -0700)]
[master] Update dependencies from dotnet/corefx (dotnet/coreclr#24604)

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

- Microsoft.Bcl.AsyncInterfaces - 1.0.0-preview6.19272.8
- Microsoft.NETCore.Platforms - 3.0.0-preview6.19272.8
- Microsoft.Private.CoreFx.NETCoreApp - 4.6.0-preview6.19272.8

* Disable failing test

Commit migrated from https://github.com/dotnet/coreclr/commit/c435f22dc59c71d6eed91c3455c73cc0c76a4302

5 years agoFix the checkboxes in superpmi.md (dotnet/coreclr#24496)
Akihisa Yagi [Thu, 23 May 2019 19:11:38 +0000 (04:11 +0900)]
Fix the checkboxes in superpmi.md (dotnet/coreclr#24496)

Commit migrated from https://github.com/dotnet/coreclr/commit/2df1833a44be865dcb93cd590819ff31e034227f

5 years agoFix missing version numbers in packaged files and getting IBC merge version in offici...
Elinor Fung [Thu, 23 May 2019 17:51:19 +0000 (10:51 -0700)]
Fix missing version numbers in packaged files and getting IBC merge version in official build (dotnet/coreclr#24735)

* Fix missing version numbers in packaged files in official build
* Fix build script for getting IBC merge version

Commit migrated from https://github.com/dotnet/coreclr/commit/3af71a7e68fb1d279b18d332db6cd3ee7a824295

5 years agoAdd some perf events/data for tiered compilation (dotnet/coreclr#24607)
Koundinya Veluri [Thu, 23 May 2019 17:49:10 +0000 (10:49 -0700)]
Add some perf events/data for tiered compilation (dotnet/coreclr#24607)

Add some perf events/data for tiered compilation

New events:
- `Settings` - Sent when TC is enabled
  - `Flags` - Currently indicates whether QuickJit and QuickJitForLoops are enabled
- `Pause` - Sent when TC is paused (due to a new method being called for the first time)
- `Resume` - Sent when TC resumes
  - `NewMethodCount` - Number of methods called for the first time while tiering was paused
- `BackgroundJitStart` - Sent when starting to JIT methods in the background
  - `PendingMethodCount` - Number of methods currently scheduled for background JIT
- `BackgroundJitStop` - Sent when background jitting stops
  - `PendingMethodCount` - Same as above. When 0, background jitting has completed.
  - `JittedMethodCount` - Number of methods jitted in the background since the previous BackgroundJitStart event on the same thread

Miscellaneous:
- Updated method JIT events to include the optimization tier
- Added a couple more cases where tiered compilation is disabled for methods that have JIT optimization disabled for some reason
- Renamed `Duration` field of the new version of the `ContentionEnd` to `DurationNs` to indicate the units of time
- Added `OptimizationTierOptimized` to `NativeCodeVersion::OptimizationTier` to distinguish it from `OptimizationTier1`. `OptimizationTierOptimized` is now used for methods that QuickJit is disabled for, and does not send the tier 1 flag.
  - For info about the code being generated by the JIT, added info to `PrepareCodeConfig` and stored a pointer to it on the thread object for the current JIT invocation. Info is updated in `PrepareCodeConfig` and used for updating the tier on the code version and for sending the ETL event.
  - If the JIT decides to use MinOpt when `MethodDesc::IsJitOptimizationDisabled()` is false, the info is not stored. The runtime method event will reflect the JIT's choice, the rundown event will not.
- Updated to show optimization tiers in SOS similarly to PerfView

Commit migrated from https://github.com/dotnet/coreclr/commit/61a02edb7fb443b92f0682a00c42200def2bd33a

5 years agoAdd missing pin to two tests and re-enable for GC stress (dotnet/coreclr#24738)
Andy Ayers [Thu, 23 May 2019 17:35:15 +0000 (10:35 -0700)]
Add missing pin to two tests and re-enable for GC stress (dotnet/coreclr#24738)

Test was evidently assuming that because an object that referred to an array
was pinned, so was the array. Failure was intermittent, GC is not guaranteed
to move objects or to render their former contents inaccessible.

Fixes dotnet/coreclr#24173.
Fixes dotnet/coreclr#24464.

Commit migrated from https://github.com/dotnet/coreclr/commit/9271757d2c917c5650c459a4c3fa648c2968a591

5 years agoUse auxiliary vector to obtain the executable path name (dotnet/coreclr#24696)
Leandro A. F. Pereira [Thu, 23 May 2019 16:59:17 +0000 (09:59 -0700)]
Use auxiliary vector to obtain the executable path name (dotnet/coreclr#24696)

This vector is populated by the kernel while loading an ELF, and is
available to user land without requiring any system calls.  This is
specially interesting if programs are executed under a chroot where
/proc isn't available (and thus realpath("/proc/self/exe"), the current
method of obtaining the full path name for the executable).

Commit migrated from https://github.com/dotnet/coreclr/commit/572be424ae932cdaba08585c922a9104684b408e