platform/upstream/dotnet/runtime.git
4 years agoStop unloading the profiler on shutdown to prevent segfaults on background threads...
David Mason [Thu, 26 Sep 2019 04:03:29 +0000 (21:03 -0700)]
Stop unloading the profiler on shutdown to prevent segfaults on background threads (dotnet/coreclr#26762)

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

4 years agoIntroduce Utf8Span, which is a span of UTF-8 text (dotnet/coreclr#26711)
Levi Broderick [Thu, 26 Sep 2019 00:36:44 +0000 (17:36 -0700)]
Introduce Utf8Span, which is a span of UTF-8 text (dotnet/coreclr#26711)

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

4 years agoReuse managed test components across all *nix flavors (dotnet/coreclr#26581)
Tomáš Rylek [Thu, 26 Sep 2019 00:35:57 +0000 (17:35 -0700)]
Reuse managed test components across all *nix flavors (dotnet/coreclr#26581)

Today CoreCLR pipelines build tests on the same OS flavors they are
supposed to run on. This is wasteful as we produce identical
managed test artifacts on OSX, Linux, Linux_musl and Linux_rhel6.

With this change, the pipeline construction analyzes the set of
OS / architecture combos to run tests on and picks the "best"
OS (or rather the OS that runs on the fastest lab HW) for build
of the managed test components.

Native test components are newly built as part of the product build
as these do need to be built separately for each targeting OS.
Product build zips them up and publishes them to Azure as an artifact
that gets subsequently downloaded and stitched together with
managed test components in the test run job.

Implementation-wise the change basically proceeds in two steps.
In platform-matrix.yml we first identify the exact set of OS / arch
combos to run. Using this information we subsequently identify
the OS to build managed components on for each combo; this information
is passed to test-job.yml which skips managed test build for those
OS-es that are expecting the managed components to be built on a
different OS.

Product build (build-job.yml) contains the additional logic to
build native test artifacts and publish the to Azure for perusal
by the test run job that downloads and unzips both managed and native
artifacts into the final test folder before publishing to Helix.

Thanks

Tomas

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

4 years agoReplace lateArgInx with GetLateArgInx (dotnet/coreclr#26887)
Sinan Kaya [Thu, 26 Sep 2019 00:31:19 +0000 (20:31 -0400)]
Replace lateArgInx with GetLateArgInx (dotnet/coreclr#26887)

* find src/jit -type f -exec sed -i -e 's/->lateArgInx/->GetLateArgInx()/g' {} \;

* Format patch

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

4 years agoReplace isVararg with GetIsVararg() (dotnet/coreclr#26891)
Sinan Kaya [Thu, 26 Sep 2019 00:31:09 +0000 (20:31 -0400)]
Replace isVararg with GetIsVararg() (dotnet/coreclr#26891)

* find src/jit -type f -exec sed -i -e 's/->isVararg/->GetIsVararg()/g' {} \;

* Format patch dotnet/coreclr#2

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

4 years agoReplace lvArgInitReg with GetArgInitReg (dotnet/coreclr#26888)
Sinan Kaya [Wed, 25 Sep 2019 23:52:58 +0000 (19:52 -0400)]
Replace lvArgInitReg with GetArgInitReg (dotnet/coreclr#26888)

* find src/jit -type f -exec sed -i -e 's/->lvArgInitReg/->GetArgInitReg()/g' {} \;

* Format patch

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

4 years agoDisable test that timeouts in outerloop (dotnet/coreclr#26892)
Jarret Shook [Wed, 25 Sep 2019 21:54:53 +0000 (14:54 -0700)]
Disable test that timeouts in outerloop (dotnet/coreclr#26892)

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

4 years agoVarious tailcall test improvements (dotnet/coreclr#26818)
Jakob Botsch Nielsen [Wed, 25 Sep 2019 21:54:21 +0000 (14:54 -0700)]
Various tailcall test improvements (dotnet/coreclr#26818)

* Remove some illegal tailcall tests

These tests pass address of local stack frame to tail. prefixed calls.

* Add some more tailcall tests

* Tail calls to functions with small return values
* Tail calls to functions with retbuf
* Tail calls to functions with multi-reg returned structs
* Tail calls to functions with void returns
* Tail calls to abstract methods
* Tail calls to interface methods
* tail. calli sequences
* Tail calls to struct instance methods
* Tail calls involving refs
* Tail calls involving byrefs
* Tail calls involving generics

* Improve tailcall hijacking test

* Force this test to use helper on AMD64 too
* Instead of 3 tailcallers and 1 collector, just use 1 collector and 1
tailcaller. Additionally, run it for only 30 iterations of 1 second
sleeps. This should allow it to run for AMD64 and ARM32 in CI too.

* Clarify some reasons for some disabled tests

* Disable new test on everything except x86 Windows

* Add another arg to TailHelper2 to ensure helper-based tailcall on SysV

* Disable hijacking test on anything except x86/x64 Windows

* Update more tailcalls test and add source file

* Pinvoke printf for Unix in TailcallVerifyWithPrefix test

* Clean up TailcallVerifyWithPrefix test

Remove commented tests and tests that do not run from this file

* Clean up reasons for disabling TailcallVerifyWithPrefix

* Update a reason

* Remove more dead code in TailcallVerifyWithPrefix.il

* Fix wrong IL in TailcallVerifyWithPrefix test

* Add a comment describing more_tailcalls.cs

* Clarify issue number

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

4 years agoFix CoreRT build break
Jan Kotas [Tue, 24 Sep 2019 20:50:02 +0000 (13:50 -0700)]
Fix CoreRT build break

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

4 years agoInitialize variant return value. (dotnet/coreclr#26871)
Jeremy Koritzinsky [Wed, 25 Sep 2019 20:05:54 +0000 (13:05 -0700)]
Initialize variant return value. (dotnet/coreclr#26871)

* Initialize variant return value.

* Move VariantInit call.

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

4 years agoMore Corelib cleanup (dotnet/coreclr#26872)
Stephen Toub [Wed, 25 Sep 2019 14:05:48 +0000 (07:05 -0700)]
More Corelib cleanup (dotnet/coreclr#26872)

* Remove unnecessary asserts

* Make several classes static

* Use is instead of as+null check

* Use T? instead of Nullable<T>

* more static classes

* Mark locals as const

* Merge declaration and initialization of some variables

* Remove unnecessary casts

* Remove unnecessary "unsafe"s

* Simplify several lambda expressions

* Remove redundant parentheses

* Remove redundant '== true'

* Remove redundant empty lines

* Simplify boolean comparison with '== false'

* Replace if-statement with return statement

* Use while for infinite loop

* Add static to all partial static class declarations

* Use ++/-- operator instead of assignment

* Use string.IsNullOrEmpty

* Use coalesce expression

* Simplify lazy initialization

* Use coalese expression

* Join string expressions

* Use regular string literal instead of verbatim string literal

* Optimize StringBuilder.Append calls

* Remove redundant assignment

* Remove unnecessary unsafe context

* Merge processor directives

* Use String.Equals instead of String.Compare

* Use Debug.Fail instead of Debug.Assert(false

* Remove Attribute suffix

* Use predefined type

* Use compound assignment

* Use while statement to create an infinite loop

* Remove redundant base ctor call

* Avoid using catch (Exception)

* Remove empty regions

* Span comparison to null

* Avoid unnecessary boxing of value type

* Expression is always equal to 'true'

* Remove unused method

* update coalesce assignment

* fix unsafe

* fix redundant parens

* Fix whitespace errors introduced

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

4 years agoReplace gtLclNum with GetLclNum() (dotnet/coreclr#26853)
Sinan Kaya [Wed, 25 Sep 2019 01:00:32 +0000 (21:00 -0400)]
Replace gtLclNum with GetLclNum() (dotnet/coreclr#26853)

* find src/jit -type f -exec sed -i -e 's/->gtLclNum/->GetLclNum()/g' {} \;

GetLclNum

GetLclNum

compile fixes

* Format patch

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

4 years agoAdd CollectionsMarshal (dotnet/coreclr#26867)
Ben Adams [Wed, 25 Sep 2019 00:24:01 +0000 (01:24 +0100)]
Add CollectionsMarshal (dotnet/coreclr#26867)

* Add CollectionsMarshal

* Feedback

* Feedback

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

4 years agoresolve several issues found by cppcheck (dotnet/coreclr#26869)
Ilya Shipitsin [Wed, 25 Sep 2019 00:19:06 +0000 (00:19 +0000)]
resolve several issues found by cppcheck (dotnet/coreclr#26869)

* src/debug/daccess/nidump.cpp: remove dead code
found by cppcheck

[src/debug/daccess/nidump.cpp:2839] -> [src/debug/daccess/nidump.cpp:2841]: (warning) Opposite inner 'if' condition leads to a dead code block.

* src/dlls/dbgshim/dbgshim.cpp: resolve possible null pointer dereference
found by cppcheck

[src/dlls/dbgshim/dbgshim.cpp:1373] -> [src/dlls/dbgshim/dbgshim.cpp:1367]: (warning) Either the condition 'pHandleArray==NULL' is redundant or there is pointer arithmetic with NULL pointer.

* src/ilasm/assembler.cpp: resolve possible null pointer dereference
found by cppcheck

[src/ilasm/assembler.cpp:2331] -> [src/ilasm/assembler.cpp:2330]: (warning) Either the condition 'pMID==NULL' is redundant or there is possible null pointer dereference: pMID.

* src/jit/flowgraph.cpp: resolve possible null pointer dereference
found by cppcheck

[src/jit/flowgraph.cpp:11009] -> [src/jit/flowgraph.cpp:11005]: (warning) Either the condition 'block!=nullptr' is redundant or there is possible null pointer dereference: block.

* src/pal/src/debug/debug.cpp: resolve possible null pointer dereference
found by cppcheck

[src/pal/src/debug/debug.cpp:376] -> [src/pal/src/debug/debug.cpp:381]: (warning) Either the condition 'command_string' is redundant or there is possible null pointer dereference: command_string.

* src/pal/src/libunwind/src/arm/Gex_tables.c: resolve possible null pointer dereference
found by cppcheck

[src/pal/src/libunwind/src/arm/Gex_tables.c:159] -> [src/pal/src/libunwind/src/arm/Gex_tables.c:155]: (warning) Either the condition 'buf!=NULL' is redundant or there is pointer arithmetic with NULL pointer.

* src/pal/src/synchmgr/synchmanager.cpp: resolve possible null pointer dereference
found by cppcheck

[src/pal/src/synchmgr/synchmanager.cpp:2512] -> [src/pal/src/synchmgr/synchmanager.cpp:2510]: (warning) Either the condition 'NULL!=pWLNode' is redundant or there is possible null pointer dereference: pWLNode.

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

4 years agoPack additional useful data into char's "Unicode categories" RVA static info (dotnet...
Levi Broderick [Tue, 24 Sep 2019 20:54:36 +0000 (13:54 -0700)]
Pack additional useful data into char's "Unicode categories" RVA static info (dotnet/coreclr#26848)

Also improves the performance of char.IsWhiteSpace / char.IsUpper / char.IsLower

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

4 years agoUse netcoreapp3.0 for building crossgen2 (dotnet/coreclr#26792)
David Wrighton [Tue, 24 Sep 2019 20:35:58 +0000 (13:35 -0700)]
Use netcoreapp3.0 for building crossgen2 (dotnet/coreclr#26792)

* Use netcoreapp3.0 for building crossgen2
- Enables better debugging support
- Enables use of netcoreapp3.0 surface area in crossgen2
- Should improve performance
- Initialize the PAL in the jit on Unix builds
- Enable crossgen2smoke on alpine

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

4 years agoLower SSE compare scalar and test nodes (dotnet/coreclr#22043)
mikedn [Tue, 24 Sep 2019 20:03:01 +0000 (23:03 +0300)]
Lower SSE compare scalar and test nodes (dotnet/coreclr#22043)

* Lower SSE compare scalar and test nodes

* Remove bogus instructions from intrinsic table

* Cleanup genHWIntrinsic_R_RM

* Add tests

* Adjust comments

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

4 years agoReplace genInterruptible with getInterruptible() (dotnet/coreclr#26854)
Sinan Kaya [Tue, 24 Sep 2019 19:56:42 +0000 (15:56 -0400)]
Replace genInterruptible with getInterruptible() (dotnet/coreclr#26854)

* find src/jit -type f -exec sed -i -e 's/genInterruptible->/getInterruptible()->/g' {} \;

Cleanup remaining getInterruptible()

* Format patch

* Change comment

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

4 years agoMerge pull request dotnet/coreclr#26860 from jkotas/revert
Jan Kotas [Tue, 24 Sep 2019 18:29:08 +0000 (11:29 -0700)]
Merge pull request dotnet/coreclr#26860 from jkotas/revert

Revert "Don't allow the hoisting of GT_CLS_VARs that were assigned a constant value. (dotnet/coreclr#26551)"

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

4 years agoFix available memory extraction on Linux (dotnet/coreclr#26764)
Jan Vorlicek [Tue, 24 Sep 2019 18:00:39 +0000 (20:00 +0200)]
Fix available memory extraction on Linux (dotnet/coreclr#26764)

* Fix available memory extraction on Linux

The GlobalMemoryStatusEx in PAL is returning number of free physical pages in
the ullAvailPhys member. But there are additional pages that are allocated
as buffers and caches that get released when there is a memory pressure and
thus they are effectively available too.

This change extracts the available memory on Linux from the /proc/meminfo
MemAvailable row, which is reported by the kernel as the most precise
amount of available memory.

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

4 years agoFix managed test artifacts to be *nix flavor-agnostic (dotnet/coreclr#26817)
Tomáš Rylek [Tue, 24 Sep 2019 15:56:54 +0000 (08:56 -0700)]
Fix managed test artifacts to be *nix flavor-agnostic (dotnet/coreclr#26817)

After I finally managed to make my infra change to reuse managed
test artifacts across various *nix flavors work on the CoreCLR-CI
Pri0 pipeline, I proceeded to testing the official build which
uncovered a single Pridotnet/coreclr#1 test violating the independence principle:

<pre>
Loader\AssemblyDependencyResolver\AssemblyDependencyResolverTests\AssemblyDependencyResolverTests.csproj
</pre>

This test project uses the clause

<pre>
    &lt;RequiresMockHostPolicy&gt;true&lt;/RequiresMockHostPolicy&gt;
</pre>

which makes the script CLRTest.MockHosting.targets emit an
OS-specific name of the mock hosting dynamic library to the
execution .sh script which then becomes non-portable between
Linux and OSX because they use different extensions for dynamic
libraries (so / dylib).

My proposed change fixes this by modifying the targets file to
emit just the library name without the extension and append
the appropriate per-OS extension in CoreRun.

Thanks

Tomas

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

4 years agoAdd doc on JIT-EE interface changes (dotnet/coreclr#26858)
Michal Strehovský [Tue, 24 Sep 2019 15:44:08 +0000 (17:44 +0200)]
Add doc on JIT-EE interface changes (dotnet/coreclr#26858)

Fixes dotnet/coreclr#26841.

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

4 years agosrc/inc/apithreadstress.cpp: resolve possible null pointer dereference (dotnet/corecl...
Ilya Shipitsin [Tue, 24 Sep 2019 15:23:46 +0000 (15:23 +0000)]
src/inc/apithreadstress.cpp: resolve possible null pointer dereference (dotnet/coreclr#26843)

found by cppcheck

[src/inc/apithreadstress.cpp:72] -> [src/inc/apithreadstress.cpp:70]: (warning) Either the condition 'p!=NULL' is redundant or there is pointer arithmetic with NULL pointer.

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

4 years agoRevert "Don't allow the hoisting of GT_CLS_VARs that were assigned a constant value...
Jan Kotas [Tue, 24 Sep 2019 15:19:30 +0000 (08:19 -0700)]
Revert "Don't allow the hoisting of GT_CLS_VARs that were assigned a constant value. (dotnet/coreclr#26551)"

This reverts commit dotnet/coreclr@2342c8231f1b1b3c17baaefbd0357aa4f228f5d1.

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

4 years agoSkip the MethodRef optimization for ArrayMethod's (dotnet/coreclr#26850)
Tomáš Rylek [Tue, 24 Sep 2019 14:24:03 +0000 (07:24 -0700)]
Skip the MethodRef optimization for ArrayMethod's (dotnet/coreclr#26850)

As Jan Vorlicek discovered during his investigation of the remaining
CPAOT bugs, CoreCLR runtime doesn't support the MethodRef encoding
flavor for the special array methods. My understanding is that this
is due to the fact that array types are somewhat weird as they are
kind of "generic types in disguise".

Thanks

Tomas

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

4 years agoAllow containing ExtractVector128 into Store (dotnet/coreclr#22896)
mikedn [Tue, 24 Sep 2019 13:36:08 +0000 (16:36 +0300)]
Allow containing ExtractVector128 into Store (dotnet/coreclr#22896)

* Allow containing ExtractVector128 into Store

* Support contained address modes on ExtractVector128

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

4 years agoNew SuperIlc command "compile-framework" and some fixes (dotnet/coreclr#26804)
Tomáš Rylek [Tue, 24 Sep 2019 06:30:51 +0000 (23:30 -0700)]
New SuperIlc command "compile-framework" and some fixes (dotnet/coreclr#26804)

1) New command "compile-framework" does just what it says on the tin.
My thinking is that I'll use this option to build the CPAOT
framework during product build in the envisioned pipeline. I have
added hard-coded exclusions for assemblies that fail to build right
now - about half of them aren't interesting as framework assemblies
(e.g. R2RDump.dll), some other fail with IBC bugs and one other bug
I'm about to investigate.

2) Based on JanV's suggestion I have added a somewhat hacky logic
to exclude the "testhost" folder when building the entire Pridotnet/coreclr#1
test tree. I'm open to suggestions how to tackle this in a cleaner
manner, I have shared my thoughts on the subject in code comments
next to the problematic spots.

Thanks

Tomas

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

4 years agoReplace (val / 2) with (val * 0.5) in Jit (dotnet/coreclr#24584)
Egor Bogatov [Tue, 24 Sep 2019 05:41:50 +0000 (08:41 +0300)]
Replace (val / 2) with (val * 0.5) in Jit (dotnet/coreclr#24584)

* Replace "val / dcon" with "val * (1.0 / dcon)"

* fix formatting issue

* replace tree->gtOp.gtOp2 with op2

* Address feedback

* fix mantissa calculations

* fix double mantissa

* use frexp+isnormal

* use frexp

* rollback frexp impl

* Add isNormal(float/double)

* fix exponent in isPow2(double)

* cleanup

* Add tests

* cleanup

* drop _finitef

* improve tests

* rename to hasPreciseReciprocal

* Add comments

* fix formatting issues

* add more test cases

* undo some formatting changes

* undo some formatting changes

* Address mikedn's feedback

* forgot to replace c-cast with reinterpret_cast in IsNormal()

* add fixed seed to Random in DivToMul (to make potential failures reproducible)

* use TestLibrary.Generator.GetDouble() instead of Random

* Remove Random-based values

* Update utils.cpp

* Update utils.cpp

* Address feedback

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

4 years agoAdd "inline" labels and rename IGF_EMIT_ADD to IGF_EXTEND (dotnet/coreclr#26819)
Jakob Botsch Nielsen [Tue, 24 Sep 2019 00:14:06 +0000 (17:14 -0700)]
Add "inline" labels and rename IGF_EMIT_ADD to IGF_EXTEND (dotnet/coreclr#26819)

This flag conceptually represents that the instruction group extends the
previous instruction group and means that the emitter will continue to
track GC info as if there was no label.

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

4 years agoDon't allow the hoisting of GT_CLS_VARs that were assigned a constant value. (dotnet...
Brian Sullivan [Mon, 23 Sep 2019 23:46:50 +0000 (16:46 -0700)]
Don't allow the hoisting of GT_CLS_VARs that were assigned a constant value. (dotnet/coreclr#26551)

* New fix - only disable GT_CLS_VAR's

* Fix typo

* Added back test:  JIT\Regression\JitBlue\GitHub_26417

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

4 years ago[skip -ci] Feedback on PerfScore design doc (dotnet/coreclr#26839)
Brian Sullivan [Mon, 23 Sep 2019 23:45:54 +0000 (16:45 -0700)]
[skip -ci] Feedback on PerfScore design doc (dotnet/coreclr#26839)

* Feedback on PerfScore design doc

* Additional feedback and grammer changes

* Added note on Benchmarks

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

4 years agoReplace gtSsaNum with GetSsaNum (dotnet/coreclr#26836)
Sinan Kaya [Mon, 23 Sep 2019 23:23:57 +0000 (19:23 -0400)]
Replace gtSsaNum with GetSsaNum (dotnet/coreclr#26836)

* find ./ -type f -exec sed -i -e 's/\<gtSsaNum\>/GetSsaNum()/g' {} \;

* format patch

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

4 years agoAdd switch to crossgen2 to ignore compile failures (dotnet/coreclr#26793)
David Wrighton [Mon, 23 Sep 2019 23:23:16 +0000 (16:23 -0700)]
Add switch to crossgen2 to ignore compile failures (dotnet/coreclr#26793)

* Add switch to crossgen2 to ignore compile failures
- the default failure behavior is good for most cases, but it is a problem when not actively working on codegen issues
- Method name printing is a risky process as it may throw. This changeset implements a ToString algorithm which attempts to print something even in the presence of errors

* Add back using statement removed in master branch

* Make ToString reslient to metadata loading failures
- Add a DiagnosticName property to type system constructs that have a Name property that may fail
- Workaround issue where Category cannot be reliably computed, and so instead use switch on type (as that is sufficient for this need)

* Switch to --resilient for switch name, and remove separate resilient name computation

* Review feedback

* More feedback

* More feedback

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

4 years agoReplace hasTailCalls with GetTailCalls()
Sinan Kaya [Mon, 23 Sep 2019 23:22:55 +0000 (19:22 -0400)]
Replace hasTailCalls with GetTailCalls()

find ./ -type f -exec sed -i -e 's/\<setTailCalls\>/SetTailCalls()/g' {} \;

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

4 years agoReplace gtCostEx with GetCostEx()
Sinan Kaya [Mon, 23 Sep 2019 22:08:53 +0000 (18:08 -0400)]
Replace gtCostEx with GetCostEx()

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

4 years agoChange several internal/private instance methods to be static (dotnet/coreclr#26835)
Stephen Toub [Mon, 23 Sep 2019 22:03:08 +0000 (15:03 -0700)]
Change several internal/private instance methods to be static (dotnet/coreclr#26835)

* Replace ToLower(CultureInfo.InvariantCulture) with ToLowerInvariant()

* Mark several members static

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

4 years agoRemove IsFastSort optimizations from String (dotnet/coreclr#26759)
Jan Kotas [Mon, 23 Sep 2019 22:02:27 +0000 (15:02 -0700)]
Remove IsFastSort optimizations from String (dotnet/coreclr#26759)

* Remove IsFastSort optimizations from String
- Fix bugs in the Span-based globalization fast paths. Note that some of these bug fixes are going to affect performance of the globalization fast paths.
- Use Span-based globalization fast paths for strings
- Avoid static array allocation for HighCharTable

Fixes dotnet/coreclr#26758

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

4 years agoMore feedback
David Wrighton [Mon, 23 Sep 2019 21:29:15 +0000 (14:29 -0700)]
More feedback

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

4 years agoUpdate clr-abi.md to indicate that R8 is used on Arm64 to pass the return buffer...
Egor Chesakov [Mon, 23 Sep 2019 19:39:18 +0000 (12:39 -0700)]
Update clr-abi.md to indicate that R8 is used on Arm64 to pass the return buffer address (dotnet/coreclr#26840)

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

4 years agoMark crossgen2 smoke test GCStressIncompatible (dotnet/coreclr#26834)
Michal Strehovský [Mon, 23 Sep 2019 19:09:17 +0000 (21:09 +0200)]
Mark crossgen2 smoke test GCStressIncompatible (dotnet/coreclr#26834)

This is known not to work with GCStress (see dotnet/coreclr#26633).

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

4 years agoMore feedback
David Wrighton [Mon, 23 Sep 2019 18:57:42 +0000 (11:57 -0700)]
More feedback

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

4 years agoAdd a trigger for gc-longrunning pipeline for "every day at 3AM" (dotnet/coreclr...
Vladimir Sadov [Mon, 23 Sep 2019 18:43:22 +0000 (20:43 +0200)]
Add a trigger for gc-longrunning pipeline for "every day at 3AM" (dotnet/coreclr#26533)

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

4 years agoCopy live sets when splitting blocks (dotnet/coreclr#26809)
Carol Eidt [Mon, 23 Sep 2019 18:09:41 +0000 (11:09 -0700)]
Copy live sets when splitting blocks (dotnet/coreclr#26809)

With dotnet/coreclr#26456 we may generate labels for split blocks (even though there's no associated code). Therefore we need to ensure that the live sets are correct.
Also, cleanup some miscellaneous dumping code.

Fix dotnet/coreclr#26795

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

4 years agoFix issue with locals overlapping out of scope GCFrame (dotnet/coreclr#26763)
Jan Vorlicek [Mon, 23 Sep 2019 15:13:20 +0000 (17:13 +0200)]
Fix issue with locals overlapping out of scope GCFrame (dotnet/coreclr#26763)

* Fix issue with locals overlapping out of scope GCFrame

More aggressive C/C++ optimizations done by VS2019 are breaking fragile
assumptions of the CoreCLR "manually managed code".

Unwinding of Frame chains accesses stack local variables after the stack
frame has been unwound, but it depends on their content to be left
intact. The new compiler is breaking this assumption by stack-packing a
different variable over it.

This change fixes the problem by adding a destructor to GCFrame that
pops the frame from the per-thread Frame list.

I also had to refactor two functions where the compiler was complaining
about mixing SEH and C++ EH in single function.

With these changes applied, there was still a problem that I've discovered
when running CoreCLR tests with GCStress 3. When the
ExceptionTracker::m_pInitialExplicitFrame was still pointing to a frame
that was already removed from the explicit Frame chain. When the
ExceptionTracker::HasFrameBeenUnwoundByAnyActiveException was walking
the frame chain starting at m_pInitialExplicitFrame to figure out if a given
frame was already unwound, it has walked to the destroyed GCFrame and
crashed.

To fix that, the chain from the initial explicit frame is updated so
that it stays valid (effectively, the destroyed GCFrame is removed from
it). It was also necessary to handle the case when the destroyed GCFrame
was the ExceptionTracker::m_pLimitFrame. The limit frame needs to be
updated to the next frame so that it can be reached on the chain from
the initial explicit frame.

* Reflect PR feedback

Change the switching to coop mode in ~GCFrame from holder based to
manual.

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

4 years agoReplace gtCostSz with /GetCostSz() (dotnet/coreclr#26808)
Sinan Kaya [Mon, 23 Sep 2019 07:13:59 +0000 (03:13 -0400)]
Replace gtCostSz with /GetCostSz() (dotnet/coreclr#26808)

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

4 years agoMerge pull request dotnet/coreclr#26810 from franksinankaya/frkaya/getEmitter
Sergey Andreenko [Mon, 23 Sep 2019 04:52:16 +0000 (21:52 -0700)]
Merge pull request dotnet/coreclr#26810 from franksinankaya/frkaya/getEmitter

Replace genEmitter with GetEmitter()

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

4 years agofix: contagious -> contiguous (dotnet/coreclr#26820)
Bruno Garcia [Mon, 23 Sep 2019 00:34:32 +0000 (02:34 +0200)]
fix: contagious -> contiguous (dotnet/coreclr#26820)

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

4 years agoformat patch fix
Sinan Kaya [Sat, 21 Sep 2019 16:10:54 +0000 (16:10 +0000)]
format patch fix

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

4 years agofind src/jit -type f -exec sed -i -e 's/->genEmitter/->getEmitter()/g' {} \;
Sinan Kaya [Mon, 18 Mar 2019 21:05:40 +0000 (21:05 +0000)]
find src/jit -type f -exec sed -i -e 's/->genEmitter/->getEmitter()/g' {} \;

replae genEmitter with getEmitter()

Forgotten getEmitter

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

4 years agoReview feedback
David Wrighton [Sat, 21 Sep 2019 01:07:55 +0000 (18:07 -0700)]
Review feedback

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

4 years agoReplace bbTreeList with GetBBTreeList() (dotnet/coreclr#23323)
Sergey Andreenko [Fri, 20 Sep 2019 21:52:34 +0000 (14:52 -0700)]
Replace bbTreeList  with  GetBBTreeList() (dotnet/coreclr#23323)

* Remove getBBTreeList

* find ./ -type f -exec sed -i -e 's/GetBBTreeList/GetFirstLIRNode/g' {} \;

* find ./ -type f -exec sed -i -e 's/SetBBTreeList/SetFirstLIRNode/g' {} \;

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

4 years agofind ./ -type f -exec sed -i -e 's/\<gtNextStmt\>/GetNextStmt()/g' {} \; (dotnet...
Sinan Kaya [Fri, 20 Sep 2019 21:51:39 +0000 (17:51 -0400)]
find ./ -type f -exec sed -i -e 's/\<gtNextStmt\>/GetNextStmt()/g' {} \; (dotnet/coreclr#26801)

* find ./ -type f -exec sed -i -e 's/\<gtNextStmt\>/getNextStmt()/g' {} \;

* Capitalize attempt dotnet/coreclr#2

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

4 years agoMark GC_TRANSITION(FALSE) for EventPipe stack sampling (dotnet/coreclr#26776)
Sung Yoon Whang [Fri, 20 Sep 2019 21:37:45 +0000 (14:37 -0700)]
Mark GC_TRANSITION(FALSE) for EventPipe stack sampling (dotnet/coreclr#26776)

* Mark GC_TRANSITION for collecting stacks

* Add some comments

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

4 years agoRemove tailcall limitations on unix64 and arm64 (dotnet/coreclr#26255)
Jakob Botsch Nielsen [Fri, 20 Sep 2019 21:06:59 +0000 (14:06 -0700)]
Remove tailcall limitations on unix64 and arm64 (dotnet/coreclr#26255)

* Remove tailcall limitations on unix64 and arm64

Fast tailcalls have their arguments passed in the incoming argument area
of the caller. This can cause problems when a previous argument might
end up overwriting the stack slot for an incoming argument that is later
used. To resolve this problem, we have logic that detects and introduces
temps in this situation. This logic was originally written for Windows
x64 where it is simple to know what argument is being overwritten, since
every argument always takes up a single slot on the stack. I.e. we know
that outgoing argument 7 can only overwrite incoming argument 7.

On unix x64 and arm64 this assumption does not hold. We previously tried
to workaround this by limiting our fast tailcalls to simple situations
where this assumption held, but this caused many missed fast tailcall
opportunities (for example, when arguments requires two slots or more).

This change removes those limitations. Instead of finding the argument
overwritten using the argument index, it keeps track of which stack
slots are used by each incoming and outgoing argument, allowing us to
more robustly check if an outgoing argument will overwrite an incoming
argument that will be used later.

To do this, we need to set the stack offset during init of args so that
we can use this info to determine whether it is necessary to introduce
temps for fast tailcalls. For arm64 we now define
FEATURE_PUT_STRUCT_ARG_STK to have access to the number of slots in
PUTARG_STK needed for this transformation.

There are also some corner cases we must consider. Since arguments now
consume multiple stack slots we can no longer move them with a single
atomic move instruction. Thus it is possible for us to get into cases
where we need to move an argument that is larger than 8 bytes and where
the move overlaps. This is a problem because codegen cannot handle
partially overlapping struct copies. We see this on unix64 in the
following case (assuming all args are on the stack):
void callee(S16 a, S32 b) { ... }
void caller(S32 a) { callee(default, a); }

Here 'caller' will need to move 'a' 16 bytes ahead in the arg list, and
we thus need a temp because we cannot do this atomically. Fix this by
detecting the partially overlapping case and looking for uses of the arg
from the current PUTARG_STK node's operand (instead of only starting
after).

* Fix formatting

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

4 years agoAllow IBC for non-generic methods to succeed (dotnet/coreclr#26794)
David Wrighton [Fri, 20 Sep 2019 20:30:23 +0000 (13:30 -0700)]
Allow IBC for non-generic methods to succeed (dotnet/coreclr#26794)

* Allow IBC for non-generic methods to succeed

* Update src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/ReadyToRunLibraryRootProvider.cs

Co-Authored-By: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/9c5a6030c62b2d2bfb105772debee628f5a06aa0

4 years agoSwitch to --resilient for switch name, and remove separate resilient name computation
David Wrighton [Fri, 20 Sep 2019 19:31:46 +0000 (12:31 -0700)]
Switch to --resilient for switch name, and remove separate resilient name computation

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

4 years agoMake ToString reslient to metadata loading failures
David Wrighton [Fri, 20 Sep 2019 19:23:36 +0000 (12:23 -0700)]
Make ToString reslient to metadata loading failures
- Add a DiagnosticName property to type system constructs that have a Name property that may fail
- Workaround issue where Category cannot be reliably computed, and so instead use switch on type (as that is sufficient for this need)

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

4 years agofind ./ -type f -exec sed -i -e 's/SetBBTreeList/SetFirstLIRNode/g' {} \;
Sinan Kaya [Fri, 20 Sep 2019 19:26:25 +0000 (19:26 +0000)]
find ./ -type f -exec sed -i -e 's/SetBBTreeList/SetFirstLIRNode/g' {} \;

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

4 years agofind ./ -type f -exec sed -i -e 's/GetBBTreeList/GetFirstLIRNode/g' {} \;
Sinan Kaya [Fri, 20 Sep 2019 19:23:53 +0000 (19:23 +0000)]
find ./ -type f -exec sed -i -e 's/GetBBTreeList/GetFirstLIRNode/g' {} \;

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

4 years agoAdd JitELTHookEnabled scenarios and testGroup in CI (dotnet/coreclr#26542)
Egor Chesakov [Fri, 20 Sep 2019 16:49:52 +0000 (09:49 -0700)]
Add JitELTHookEnabled scenarios and testGroup in CI (dotnet/coreclr#26542)

* Add jitelthookenabled, jitelthookenabled_tiered scenarios in tests/testenvironment.proj

* Add jitelthookenabled testGroup in eng/run-test-job.yml

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

4 years agoEnable VM `_ASSERTE` stack backtrace on Windows (dotnet/coreclr#26782)
Bruce Forstall [Fri, 20 Sep 2019 16:45:55 +0000 (09:45 -0700)]
Enable VM `_ASSERTE` stack backtrace on Windows (dotnet/coreclr#26782)

The stack backtrace code uses ImageHlp and doesn't run on non-Windows platforms.

The PDB files are already being copied to the Helix machines.
Just set `_NT_SYMBOL_PATH` so they can be found.
(This is configured in the VM by the call to SymInitialize in utilcode\stacktrace.cpp,
in particular `FillSymbolSearchPathThrows()`.)

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

4 years agoRemove getBBTreeList
Sinan Kaya [Mon, 18 Mar 2019 19:49:55 +0000 (19:49 +0000)]
Remove getBBTreeList

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

4 years agoImplement genProfilingEnterCallback genProfilingLeaveCallback on Arm64 (dotnet/corecl...
Egor Chesakov [Fri, 20 Sep 2019 03:35:34 +0000 (20:35 -0700)]
Implement genProfilingEnterCallback genProfilingLeaveCallback on Arm64 (dotnet/coreclr#26460)

* Split genProfilingEnterCallback and genProfilingLeaveCallback into architecture specific versions

* Remove redundant genStackLevel save/restore logic on Arm, Arm64, Amd64

* Implement JIT_ProfilerEnterLeaveTailcallStub in assembly

* Define RBM_PROFILER_{ENTER,LEAVE,TAILCALL}_TRASH for TARGET_ARM64

* Define REG_PROFILER_{ENTER,LEAVE}_ARG_FUNC_ID and RBM_PROFILER_{ENTER,LEAVE}_ARG_CALLER_SP

* Simplify r0Trashed logic in src/jit/codegenarm.cpp

* Remove wrong comment in src/jit/codegenarm.cpp

* On Arm genPrologPadForReJit does nothing so remove it in src/jit/codegenarm.cpp

* Implement LinearScan::BuildNode for GT_PROF_HOOK and GT_RETURN in src/jit/lsraarm64.cpp

* Shouldn't a call to CORINFO_HELP_PROF_FCN_TAILCALL be marked as a No-GC?

* Implement genProfilingEnterCallback genProfilingLeaveCallback in src/jit/codegenarm64.cpp

* Implement NYI profiler methods in src/vm/arm64/profiler.cpp

* Implement ProfileEnterNaked ProfileLeaveNaked ProfileTailcallNaked in src/vm/arm64/asmhelpers.S

* Implement profiler helpers on win-arm64

* Remove logic for !FINAL_FRAME_LAYOUT in codegenarm64.cpp

* Remove unused macro in src\jit\target.h

* genProfilingLeaveCallback ignores helper on arm in src\jit\codegenarm.cpp

* Refactor genProfilingLeaveCallback in src\jit\codegenarm.cpp

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

4 years agoAdd back using statement removed in master branch
David Wrighton [Fri, 20 Sep 2019 02:03:47 +0000 (19:03 -0700)]
Add back using statement removed in master branch

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

4 years agoAdd switch to crossgen2 to ignore compile failures
David Wrighton [Thu, 12 Sep 2019 23:39:11 +0000 (23:39 +0000)]
Add switch to crossgen2 to ignore compile failures
- the default failure behavior is good for most cases, but it is a problem when not actively working on codegen issues
- Method name printing is a risky process as it may throw. This changeset implements a ToString algorithm which attempts to print something even in the presence of errors

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

4 years agoDon't try to publish build logs in finalize-publish (dotnet/coreclr#26787)
Sven Boemer [Thu, 19 Sep 2019 19:27:53 +0000 (12:27 -0700)]
Don't try to publish build logs in finalize-publish (dotnet/coreclr#26787)

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

4 years agoFix missing checkout step in several pipelines (dotnet/coreclr#26773)
Tomáš Rylek [Thu, 19 Sep 2019 14:30:15 +0000 (07:30 -0700)]
Fix missing checkout step in several pipelines (dotnet/coreclr#26773)

I have apparently missed some of the pipelines in my "one checkout"
change. I have gone over all yml files under eng/pipelines and
fixed the four remaining yml files by adding the missing step.

Thanks

Tomas

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

4 years agoDelete man page quote (dotnet/coreclr#26779)
Jan Kotas [Thu, 19 Sep 2019 03:50:02 +0000 (20:50 -0700)]
Delete man page quote (dotnet/coreclr#26779)

Man pages come with a license. Quoting man pages may require complying with the license that is not worth the trouble.

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

4 years agoUpdate path to CoreLib sln
Cory Nelson [Thu, 19 Sep 2019 03:03:57 +0000 (20:03 -0700)]
Update path to CoreLib sln

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

4 years agoStatements: return dumping methods. (dotnet/coreclr#26744)
Sergey Andreenko [Thu, 19 Sep 2019 01:32:22 +0000 (18:32 -0700)]
Statements: return dumping methods. (dotnet/coreclr#26744)

* Return dumping for Statement.

Return statements ID and implement dumping methods.

* Delete block->bbStmtNum and compiler->compCurStmtNum.

They were duplicating `stmt->gtTreeID` in the past and it was not clear why they were added in the first place.

Delete them and use `stmt->GetID()`, with `STMT%05u` format.

* Use FMT_STMT for printing `Statement->GetID()`.

So you can use `STMT\d{5}` to seach them anywhere in JiDump.

* Fix the comments and one missed printing.

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

4 years agoFix update versions logic (dotnet/coreclr#26768)
Sven Boemer [Wed, 18 Sep 2019 22:25:05 +0000 (15:25 -0700)]
Fix update versions logic (dotnet/coreclr#26768)

* Fix update versions logic

After https://github.com/dotnet/coreclr/pull/26108, this was broken
because the Tools.proj was never restored on the agent running the
finalize-publish job. This fixes the script to do a restore, and adds
a missing import.

* Remove UpdatePublishedVersions.ps1 and add darc dependency

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

4 years agoIncrease checkout fetchDepth to 5 (dotnet/coreclr#26774)
Tomáš Rylek [Wed, 18 Sep 2019 21:52:17 +0000 (14:52 -0700)]
Increase checkout fetchDepth to 5 (dotnet/coreclr#26774)

Based on recommended practice and on Jared's experience from the
Roslyn repo I propose increasing the fetchDepth constant to 5 to
prevent occasional checkout failures seen after my change from
last week to only check out the GIT branch once for Windows
and once for Linux per pipeline.

This change is expected to fix the issue

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

Thanks

Tomas

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

4 years agoComplete the filtering for MethodImpl.AggressiveOptimization (dotnet/coreclr#26756)
Andrew Au [Wed, 18 Sep 2019 20:34:22 +0000 (13:34 -0700)]
Complete the filtering for MethodImpl.AggressiveOptimization (dotnet/coreclr#26756)

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

4 years agoAdd performance measurement to crossgen2/SuperILC (dotnet/coreclr#26742)
Anubhav Srivastava [Wed, 18 Sep 2019 20:31:51 +0000 (13:31 -0700)]
Add performance measurement to crossgen2/SuperILC (dotnet/coreclr#26742)

Crossgen2 changes
- Add PerfEventSource classes to log performance-related events (average time taken to compile, loading time, graph processing time, emitting time, number of nodes added to graph, and number of methods JITed)

SuperILC changes
- Add MeasurePerf flag to measure performance (with 2 warmup runs and averaged over 5 real runs)
- Add PerfEventSourceListener class to listen to PerfEventSource events from crossgen2 and record statistics.
- Add InputFileSearchString flag to select an input file to compile (instead of requiring a folder)

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

4 years agoFix two typos (dotnet/coreclr#26770)
Brian Sullivan [Wed, 18 Sep 2019 18:07:25 +0000 (11:07 -0700)]
Fix two typos (dotnet/coreclr#26770)

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

4 years agoAdd design doc for the Perf Score feature (dotnet/coreclr#26519)
Brian Sullivan [Wed, 18 Sep 2019 18:02:55 +0000 (11:02 -0700)]
Add design doc for the Perf Score feature (dotnet/coreclr#26519)

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

4 years agoImplement PerfScore (dotnet/coreclr#26456)
Brian Sullivan [Wed, 18 Sep 2019 17:59:21 +0000 (10:59 -0700)]
Implement PerfScore (dotnet/coreclr#26456)

* Implement PerScore
 - PerfScore represents an estimate of the dynamic execution cost for the method
    emitter::insExecutionCharacteristics emitter::getInsExecutionCharacteristics(instrDesc* id)
 - We track the BasicBlock weight for each instruction group
 - PerfSCore also uses the codesize as a minor factor, both the hot code size and the cold code size
 - Provides an x64 implementation of getInsExecutionCharacteristics.

* Changes from feedback from tannergooding

* Changes from feedback from CarolEidt

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

4 years agoAdding comments (dotnet/coreclr#23327)
Brian Bohe [Wed, 18 Sep 2019 17:13:38 +0000 (14:13 -0300)]
Adding comments (dotnet/coreclr#23327)

* Adding comments to psiScope functions declarations

* Adding comments on declaration/definition Compiler::compUpdateLife

* Editing CodeGen::genProduceReg header comments

* Editting var Compiler::lvaCount comment

* Adding comments to Compiler::compChangeLife function

* Adding comments when changing variable liveness

* Adding comments in genSetScopeInfo()

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

4 years agoDelete unused .idl files (dotnet/coreclr#26757)
Jan Kotas [Wed, 18 Sep 2019 01:38:15 +0000 (18:38 -0700)]
Delete unused .idl files (dotnet/coreclr#26757)

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

4 years agoRemove assert in SetProfilerMayHaveActivatedNonDefaultCodeVersion (dotnet/coreclr...
David Mason [Wed, 18 Sep 2019 01:38:00 +0000 (18:38 -0700)]
Remove assert in SetProfilerMayHaveActivatedNonDefaultCodeVersion (dotnet/coreclr#26737)

Remove assert that was causing spurious profiler test failures.

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

4 years agoDelete CommonlyUsedGenericInstantiations (dotnet/coreclr#26750)
Stephen Toub [Wed, 18 Sep 2019 00:57:40 +0000 (20:57 -0400)]
Delete CommonlyUsedGenericInstantiations (dotnet/coreclr#26750)

The mechanism is no longer needed, its contents is stale, and it prevents some functionality from being trimmed.

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

4 years agoDisable all EventPipe tests under GCStress (dotnet/coreclr#26741)
John Salem [Tue, 17 Sep 2019 22:39:13 +0000 (15:39 -0700)]
Disable all EventPipe tests under GCStress (dotnet/coreclr#26741)

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

4 years agoRemove buildtools (dotnet/coreclr#26108)
Sven Boemer [Tue, 17 Sep 2019 20:41:03 +0000 (13:41 -0700)]
Remove buildtools (dotnet/coreclr#26108)

Remove the dependency on buildtools.

- Makes a number of common test projects SDK-style, and replaces the buildtools prerelease restore target with the restore logic built in to the SDK. For some projects, we currently restore 5.0 assets that are used for netcoreapp3.0 - this required a workaround to switch the TFM in a few cases.
- Replaces the corefx testhost deps file creation logic with that from the SDK's publish logic.
- Uses a new IL sdk (as the old one used to make many redundant file copies), and uses an .ilproj to restore ilasm/ildasm up-front.
- Uses the UpdateVersions logic from arcade instead of buildtools.
This opens up the possibility of further simplifying some of our msbuild imports in a future change.

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

4 years agoRemove allocations from Dns.* (dotnet/corefxdotnet/coreclr#41061)
Stephen Toub [Tue, 17 Sep 2019 12:20:14 +0000 (08:20 -0400)]
Remove allocations from Dns.* (dotnet/corefxdotnet/coreclr#41061)

This started as an effort to reduce the size of System.Net.NameResolution.dll when publishing a trimmed app.  It's not that big to begin with, but it's carrying around a copy of all of the IAsyncResult helper types, because the Get*Async methods are currently wrappers for the Begin/End* methods.

This PR inverts that, wrapping the Begin/End* methods instead around the Get*Async methods, using the same TaskToApm helper we use in other places in corefx for the same purpose.  This makes the Get*Async methods faster and lighterweight, but it does increase the number/amount of allocation in the Begin/End* APIs.  Since these are considered legacy, I normally would consider that a good trade, however we still use these Begin/End methods in a few places in System.Net.Sockets, and I didn't want to regress those use cases.

So, this also then trims some additional fat, which helps the Get*Async cases even further, and gets the Begin/End* to be even better than before the change.  This includes not allocating an IPHostEntry when we're just going to unwrap it and return its addresses, computing the exact IPAddress[] size we need rather than using a List<> to grow it and ToArray to create the actual array, avoiding creating the HostName if we don't need it, and avoiding an unnecessary SafeHandle allocation.

As part of this, I also noticed that we had some bugs in how some of our interop structures on Windows were defined.  In particular, fields that in the native types were size_t were defined as int rather than IntPtr in the managed code.  It appears we were saved by padding, but I fixed it regardless.

And as long as I was changing pretty much everything else, where I was touching code I also cleaned up some legacy style stuff.

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

4 years agoFix ceeInfoGetCallInfo by incorporating Fadi's commit https://github.com/dotnet/corec...
Tomáš Rylek [Tue, 17 Sep 2019 10:30:30 +0000 (03:30 -0700)]
Fix ceeInfoGetCallInfo by incorporating Fadi's commit https://github.com/dotnet/coreclr/pull/24383 (dotnet/coreclr#26722)

After merging in Jan Vorlicek's fundamental PInvoke transition frame
size fix, I took a look at some of the remaining failures. During
debugging of the test

baseservices/threading/generics/syncdelegate/GCThread16

I noticed a JIT codegen difference I tracked down to Fadi's PR

https://github.com/dotnet/coreclr/pull/24383/files

not present in the Crossgen2 source code. Thankfully the method
is today a line-by-line rewrite of its legacy Crossgen counterpart
so it was pretty trivial to spot this one new bit.

Thanks

Tomas

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

4 years agoFix R2RDump to correctly parse array lower bounds (dotnet/coreclr#26743)
Jan Vorlicek [Tue, 17 Sep 2019 07:55:20 +0000 (09:55 +0200)]
Fix R2RDump to correctly parse array lower bounds (dotnet/coreclr#26743)

There is a an incorrect size (likely a typo) used to create lower bounds
array when parsing signatures. This results in `Index was outside the
bounds of the array.` being printed inside of the array signature
string.

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

4 years agoAdd crossgen2 smoke test
Michal Strehovský [Mon, 9 Sep 2019 11:33:50 +0000 (13:33 +0200)]
Add crossgen2 smoke test

This is the DevUnitTest from the CoreRT repo.

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

4 years agoFix publishing crossgen2 on macOS
Michal Strehovský [Tue, 10 Sep 2019 14:36:48 +0000 (16:36 +0200)]
Fix publishing crossgen2 on macOS

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

4 years agoIBC fixes (dotnet/coreclr#26738)
David Wrighton [Tue, 17 Sep 2019 01:53:47 +0000 (18:53 -0700)]
IBC fixes (dotnet/coreclr#26738)

* IBC fixes
- Support IntPtr and UIntPtr element types in IBC data
- More defensive coding against structurally incorrect IBC data
- Skip compilation of open method definitions
- Generate IBC data without crashing when the first logged item is an InstantiatedMethod and not a token
- Safely shutdown and emit IBC data from a thread that hasn't been given a Thread object

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

4 years agoEnable minidumps on all helix runs. (dotnet/coreclr#26455)
Jeremy Koritzinsky [Mon, 16 Sep 2019 21:45:46 +0000 (14:45 -0700)]
Enable minidumps on all helix runs. (dotnet/coreclr#26455)

* Set COMPlus_DbgEnableMiniDump on all helix test runs.

* Set dump output path for *nix builds.

* Enable collecting dumps for timed-out tests on Windows.

* Enable xunit wrapper to get dumps for timed-out tests on non-Windows.

* Use sudo for createdump

* Update coredump-on-crash pattern to use the $HELIX_WORKITEM_UPLOAD_ROOT environment variable.

* Implement linux-specific path for finding a child process by name.

* Use HELIX_DUMP_FOLDER instead of HELIX_WORKITEM_UPLOAD_ROOT

* Remove empty entries in childrenPidAsStrings.

* Look up createdump in Core_Root

* Implement timeout macOS crash dumps.

* Add ulimit -c unlimited to the Helix script on MacOS.

* Get MacOS timeout dumps working (and enable assert/exception dumps)

* Copy OSX aborted test dumps to crash dump folder.

* Add missing return true.

* Allow overwriting dump files on copy (on macOS).

* Fix accidental shadow.

* Allow multiple spaces in ps output.

* Fix dump on windows hitting an assert on checked coreclr.

* TEMPORARY: Add more logging in macOS case.

* Fix change.

* Fix macOS timeout crash dump creation (at least locally).

* Fix Windows timeout dump collection.

* Explicitly use WChar structures.

* TEMPORARY: Test OSX dumps on 10.14 queue.

* Fix __CrashDumpFolder on OSX

* Don't try to copy the dump if it doesn't exist (10.13 Helix queue doesn't support it yet).

* Remove temporary OSX 10.14 queue usage in prs.

* Add tracking issue for empty HELIX_DUMP_FOLDER env var on OSX.

* PR Feedback

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

4 years agoRemove unused flags on ArrayMarshalInfo only used for type lib… (dotnet/coreclr#26734)
Jeremy Koritzinsky [Mon, 16 Sep 2019 21:22:42 +0000 (14:22 -0700)]
Remove unused flags on ArrayMarshalInfo only used for type lib… (dotnet/coreclr#26734)

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

4 years agoUpdate typo in comment in CultureInfo.cs
Stephen Toub [Mon, 16 Sep 2019 19:39:40 +0000 (15:39 -0400)]
Update typo in comment in CultureInfo.cs

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

4 years agoFix calendar instance inside the culture after cloning (dotnet/coreclr#26721)
Tarek Mahmoud Sayed [Mon, 16 Sep 2019 19:18:17 +0000 (12:18 -0700)]
Fix calendar instance inside the culture after cloning (dotnet/coreclr#26721)

When creating a new culture, we’ll have the equality CultureInfo.DateTimeInfo.Calendar == CultureInfo.calendar be true. After cloning such culture, this equality would not be true. The fix here is to ensure if the equality is true before cloning then should be true after cloning.

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

4 years agoImprove jit tailcall decision reporting (dotnet/coreclr#26149)
Jakob Botsch Nielsen [Mon, 16 Sep 2019 16:36:58 +0000 (09:36 -0700)]
Improve jit tailcall decision reporting (dotnet/coreclr#26149)

* Improve jit decision reporting

On platforms with unsupported helper, report the reason why we did not
do a fast tailcall instead of the fact that no copy args thunk is
available.

* Remove an unnecessary check

* Revert an incorrect change

* Fix formatting

* Actually fix conflict

* Fix build

* [master] Update dependencies from dotnet/core-setup (dotnet/coreclr#26486)

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

- Microsoft.NETCore.App - 5.0.0-alpha1.19454.1

* Fix print when failing to load coredistools. (dotnet/coreclr#26473)

* Restore partial Corelib build support in VS (dotnet/coreclr#26511)

* Fix formatting

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

4 years agoMore SuperIlc fixes and improvements (dotnet/coreclr#26719)
Tomáš Rylek [Mon, 16 Sep 2019 12:07:05 +0000 (05:07 -0700)]
More SuperIlc fixes and improvements (dotnet/coreclr#26719)

1) Set OutputFileName to the same value as InputFileName for
execution runs. This lets use the output file name as a common
test key for both phases.

2) Exclude Core_Root subtree in compile-subtree - this is needed
to avoid compiling Crossgen2.

3) As Anubhav pointed out, I messed up one of my previous
refactorings so that running the legacy Crossgen was no longer
optional based on the --crossgen switch.

4) I removed an unnecessary formatting string I randomly noticed.

5) Add one more classification case to execution bucketing.

Thanks

Tomas

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

4 years agoMerge pull request dotnet/coreclr#26717 from dotnet/darc-master-3fc25abf-8a12-476c...
Matt Mitchell [Sun, 15 Sep 2019 15:43:32 +0000 (08:43 -0700)]
Merge pull request dotnet/coreclr#26717 from dotnet/darc-master-3fc25abf-8a12-476c-aa6d-42a6aa19d865

[master] Update dependencies from dotnet/corefx

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

4 years agoMerge pull request dotnet/coreclr#26720 from dotnet/darc-master-235c35b1-7984-4aa9...
Matt Mitchell [Sun, 15 Sep 2019 15:42:18 +0000 (08:42 -0700)]
Merge pull request dotnet/coreclr#26720 from dotnet/darc-master-235c35b1-7984-4aa9-934a-e66ba37b92a6

[master] Update dependencies from dotnet/core-setup

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

4 years agoFixing a simple typo (dotnet/coreclr#26707)
Andrew Au [Sun, 15 Sep 2019 12:50:03 +0000 (05:50 -0700)]
Fixing a simple typo (dotnet/coreclr#26707)

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

4 years agoMark remaining counter tests as JIT sensitive (dotnet/coreclr#26708)
Sung Yoon Whang [Sun, 15 Sep 2019 08:31:08 +0000 (01:31 -0700)]
Mark remaining counter tests as JIT sensitive (dotnet/coreclr#26708)

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

4 years agoRemove some boxing from tuples with >= 8 elements (dotnet/coreclr#26584)
Stephen Toub [Sun, 15 Sep 2019 01:37:28 +0000 (21:37 -0400)]
Remove some boxing from tuples with >= 8 elements (dotnet/coreclr#26584)

Take advantage of https://github.com/dotnet/coreclr/pull/14698 to avoid boxing the TRest argument and improve devirtualization.

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