platform/upstream/dotnet/runtime.git
5 years agofind src/jit -type f -exec sed -i -e 's/gtAddrMode\./AsAddrMode()\./g' {} \; (dotnet...
Sinan Kaya [Thu, 17 Oct 2019 08:21:31 +0000 (01:21 -0700)]
find src/jit -type f -exec sed -i -e 's/gtAddrMode\./AsAddrMode()\./g' {} \; (dotnet/coreclr#27256)

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

5 years agoReplace gtLclFld. with AsLclFld()-> (dotnet/coreclr#27218)
Sinan Kaya [Thu, 17 Oct 2019 08:00:14 +0000 (01:00 -0700)]
Replace gtLclFld. with AsLclFld()-> (dotnet/coreclr#27218)

* find src/jit -type f -exec sed -i -e 's/gtLclFld\./AsLclFld()\./g' {} \;

AsLclFld

* Format patch

* Remove double cast

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

5 years agoUse armarch queue for internal builds (dotnet/coreclr#27244)
Jarret Shook [Thu, 17 Oct 2019 05:07:46 +0000 (22:07 -0700)]
Use armarch queue for internal builds (dotnet/coreclr#27244)

* Use Ubuntu.1804.Armarch for the internal arm32 jobs

* Stop testing arm32 on ubuntu16.04

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

5 years agoUse aligned memory access in JIT_StackProbe (dotnet/coreclr#27235)
Egor Chesakov [Thu, 17 Oct 2019 03:44:55 +0000 (20:44 -0700)]
Use aligned memory access in JIT_StackProbe (dotnet/coreclr#27235)

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

5 years agoDelete ENABLE_WINRT define (dotnet/coreclr#27240)
Jan Kotas [Thu, 17 Oct 2019 03:44:30 +0000 (20:44 -0700)]
Delete ENABLE_WINRT define (dotnet/coreclr#27240)

.NET Native specific code not needed anymore

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

5 years agoFix field offset computation in crossgen2 (dotnet/coreclr#27245)
Jan Vorlicek [Thu, 17 Oct 2019 03:43:09 +0000 (05:43 +0200)]
Fix field offset computation in crossgen2 (dotnet/coreclr#27245)

The logic for determining when to align base offset was not matching the
logic that is used in the coreclr runtime. This resulted in assert
failure: m_alignpad == 0 at runtime in 4 CoreMangLib tests.

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

5 years agoReplace gtLclVar. with AsLclVar()-> (dotnet/coreclr#27222)
Sinan Kaya [Thu, 17 Oct 2019 01:34:42 +0000 (18:34 -0700)]
Replace gtLclVar. with AsLclVar()-> (dotnet/coreclr#27222)

* find src/jit -type f -exec sed -i -e 's/gtLclVar\./AsLclVar()\./g' {} \;

AsClsVar and AsArrElem

* Format patch

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

5 years agofind src/jit -type f -exec sed -i -e 's/gtLngCon\./AsLngCon()\./g' {} \; (dotnet...
Sinan Kaya [Thu, 17 Oct 2019 01:33:39 +0000 (18:33 -0700)]
find src/jit -type f -exec sed -i -e 's/gtLngCon\./AsLngCon()\./g' {} \; (dotnet/coreclr#27219)

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

5 years agoUpdate scripts to include activity ID / related activity ID in generated (dotnet...
Elinor Fung [Thu, 17 Oct 2019 01:06:42 +0000 (18:06 -0700)]
Update scripts to include activity ID / related activity ID in generated (dotnet/coreclr#27209)

native functions for firing runtime events through event pipe

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

5 years agoUpdate UWP Jupiter interaction interface methods defined in .NET Core (dotnet/coreclr...
Aaron Robinson [Thu, 17 Oct 2019 00:52:01 +0000 (17:52 -0700)]
Update UWP Jupiter interaction interface methods defined in .NET Core (dotnet/coreclr#27239)

Update Jupiter host interface method names defined in .NET Core to match officially documented method names. The interface names are still different, but all function names now match.

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

5 years agoReplace gtClsVar. with AsClsVar()-> (dotnet/coreclr#27223)
Sinan Kaya [Wed, 16 Oct 2019 23:21:46 +0000 (16:21 -0700)]
Replace gtClsVar. with AsClsVar()-> (dotnet/coreclr#27223)

* find src/jit -type f -exec sed -i -e 's/gtClsVar\./AsClsVar()\./g' {} \;

* Format patch

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

5 years agoOptimize u>=1 to u!=0 and u<1 to u==0 (dotnet/coreclr#25458)
Egor Bogatov [Wed, 16 Oct 2019 21:58:53 +0000 (00:58 +0300)]
Optimize u>=1 to u!=0 and u<1 to u==0  (dotnet/coreclr#25458)

* Optimize u >= 1 to u != 0 and u < 1 to u == 0 (u - unsigned)

* undo some changes

* make clang-format happy

* Address feedback

* Update morph.cpp

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

5 years agoUse ubuntu 1804 arm64 queue outerloop (dotnet/coreclr#26984)
Jarret Shook [Wed, 16 Oct 2019 21:29:41 +0000 (14:29 -0700)]
Use ubuntu 1804 arm64 queue outerloop (dotnet/coreclr#26984)

* For pr use armarch queue for arm64 linux testing

* Set for pr to test

* Reflect armarch queue name

* Fix typo

* Fix other typo

* Only use armarch queue for outerloop testing

* Correctly use the old queue name

* Use armarch queue for all arm64 jobs

* Use arm32 and arm64 in the friendly names

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

5 years ago[armel/Tizen] Fix broken crossgen2 build (dotnet/coreclr#27227)
Alexander Soldatov [Wed, 16 Oct 2019 20:21:18 +0000 (23:21 +0300)]
[armel/Tizen] Fix broken crossgen2 build (dotnet/coreclr#27227)

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

5 years agoRefactor init/copy block codegen (dotnet/coreclr#27035)
mikedn [Wed, 16 Oct 2019 18:42:45 +0000 (21:42 +0300)]
Refactor init/copy block codegen (dotnet/coreclr#27035)

* Delete INITBLK/CPBLK_STOS_LIMIT

* Treat 0 sized block ops as unrolled

Normally 0 sized block ops should be simply removed during lowering. But these are rare enough that adding special code to deal with them is questionable.

Instead unroll such block ops, the unroll codegen simply won't generate any code for a 0 sized block op. Of course, some registers will still be allocated.

* Cleanup BuildBlockStore

* BlkOpKindHelper is not available on x86

* Use GT_STORE_BLK/unroll consistently

Non-GC GT_STORE_OBJ nodes were changed to GT_STORE_BLK in block copy ops
but not in block init ops. Since block init is effectvely non-GC it is
preferable to be consistent and change to GT_STORE_BLK in both cases.

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

5 years agoPreparation to introduce parallelism into CrossGen2 (dotnet/coreclr#27068)
Anubhav Srivastava [Wed, 16 Oct 2019 18:24:12 +0000 (11:24 -0700)]
Preparation to introduce parallelism into CrossGen2 (dotnet/coreclr#27068)

* Preparation to introduce parallelism into CrossGen2

- Change dictionaries in ReadyToRunCodegenNodeFactory and ReadyToRunSymbolNodeFactory to NodeCaches (i.e. ConcurrentDictionary, at the moment)
- Add structs to act as keys for the above NodeCaches (MethodFixupKey, DynamicHelperKey, ReadyToRunHelperKey)
- Synchronize logger
- Update some Dictionaries to ConcurrentDictionary
- Add .Equals and GetHashCode to SignatureContext.

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

5 years agoFix JIT.superpmi\superpmicollect broken on ReadyToRun jobs (dotnet/coreclr#25218)
Egor Chesakov [Wed, 16 Oct 2019 15:48:02 +0000 (08:48 -0700)]
Fix JIT.superpmi\superpmicollect broken on ReadyToRun jobs (dotnet/coreclr#25218)

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

5 years agoImprove Dictionary TryGetValue size/perfomance (dotnet/coreclr#27195)
Ben Adams [Wed, 16 Oct 2019 15:14:17 +0000 (16:14 +0100)]
Improve Dictionary TryGetValue size/perfomance (dotnet/coreclr#27195)

* Dictionary avoid second bounds check in Get methods

* Add NullRef methods to Unsafe

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

5 years agoManually managed card bundles windows (dotnet/coreclr#27087)
Peter Sollich [Wed, 16 Oct 2019 09:30:15 +0000 (11:30 +0200)]
Manually managed card bundles windows (dotnet/coreclr#27087)

* Changes to set gen0 bricks always. This reduces the time spent in find_first_object when finding the start of objects for marking interior pointers.

* Revert "Changes to set gen0 bricks always. This reduces the time spent in find_first_object when finding the start of objects for marking interior pointers."

This reverts commit dotnet/coreclr@9d53ff910ceb5482c67350a88e6687b8f94d5634.

* Initial check point for manually managed card bundles on x64 Windows.

* Small optimization in JIT_ByRefWriteBarrier - instead of memory access, use lea from a register to restore destination address.

* Fix issue with arm64 - forgot to push my local change.

* Address code review change request - make arm64 Windows write barrier trash only x12 and x15, but not x16 for consistency with Linux.

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

5 years agoHandle glibc sys/sysctl.h deprecation (dotnet/coreclr#27048)
Omair Majid [Wed, 16 Oct 2019 09:25:29 +0000 (05:25 -0400)]
Handle glibc sys/sysctl.h deprecation (dotnet/coreclr#27048)

glibc has deprecated sys/sysctl.h:

    In file included from /coreclr/src/pal/src/misc/sysinfo.cpp:32:
    /usr/include/sys/sysctl.h:21:2: error: "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror,-W#warnings]
    #warning "The <sys/sysctl.h> header is deprecated and will be removed."
     ^
    1 error generated.

Fix that by preferring sysconf and only including sys/sysctl.h if
HAVE_SYSCONF is not true. This mirrors the order of the implementation
code in this file (sysinfo.cpp) which checks for HAVE_SYSCONF
before HAVE_SYSCTL.

Fixes dotnet/coreclr#27008

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

5 years agoFix DecoderNLS.Convert to out the correct value for 'completed' (dotnet/coreclr#27210)
Levi Broderick [Wed, 16 Oct 2019 03:02:27 +0000 (20:02 -0700)]
Fix DecoderNLS.Convert to out the correct value for 'completed' (dotnet/coreclr#27210)

This is a complementary fix to https://github.com/dotnet/coreclr/issues/23020

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

5 years agoAdding tests and fixing codegen for the Arm 'Aes' and 'ArmBase' hwintrinsics (dotnet...
Tanner Gooding [Wed, 16 Oct 2019 01:46:44 +0000 (18:46 -0700)]
Adding tests and fixing codegen for the Arm 'Aes' and 'ArmBase' hwintrinsics (dotnet/coreclr#27151)

* Adding arm hwintrinsic tests for AdvSimd.LoadVector64 and AdvSimd.LoadVector128

* Adding arm hwintrinsic tests for Aes.Decrypt, Aes.Encrypt, Aes.InverseMixColumns, and Aes.MixColumns

* Fixing compSetProcessor to support the Arm AES instruction set

* Adding arm hwintrinsic tests for ArmBase.LeadingZeroCount, ArmBase.Arm64.LeadingSignCount, and ArmBase.Arm64.LeadingZeroCount

* Improving the arm hwintrinsic test generator

* Regenerating the arm hwintrinsic tests

* Fixing the arm hwintrinsic codegen to support scalar and aes intrinsics

* Applying formatting patch.

* Don't pass in opts to INS_mov

* Ensure the arm Aes.Decrypt and Aes.Encrypt intrinsics set tgtPrefUse for op1 and mark op2 as delay free

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

5 years agoAdd STRESS_PROFILER_CALLBACKS JIT stress mode (dotnet/coreclr#26549)
Egor Chesakov [Wed, 16 Oct 2019 01:35:18 +0000 (18:35 -0700)]
Add STRESS_PROFILER_CALLBACKS JIT stress mode (dotnet/coreclr#26549)

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

5 years agoFix RBM_PROFILER_TAILCALL_TRASH on x86 in src/jit/target.h (dotnet/coreclr#27190)
Egor Chesakov [Wed, 16 Oct 2019 01:34:31 +0000 (18:34 -0700)]
Fix RBM_PROFILER_TAILCALL_TRASH on x86 in src/jit/target.h (dotnet/coreclr#27190)

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

5 years agoEnable ETW/EventSource logging of task IDs for boxed state machines (dotnet/coreclr...
Del Myers [Wed, 16 Oct 2019 01:12:56 +0000 (18:12 -0700)]
Enable ETW/EventSource logging of task IDs for boxed state machines (dotnet/coreclr#27115)

* Wrap MoveNext Action for TPL event tracing

Wraps the MoveNext action of the AsyncStateMachineBox in a
continuation wrapper when async causality tracing is on so that the
TPL event source can find the task that is associated with a
continuation. Does not wrap otherwise.

* Clarifying comment

* removing trailing whitespace

* code review feedback.

Makes AsyncMethodBuilderCore.TryFindContinuationTask check to
whether the target of a continuation is itself a task, as a fall-back
to checking to see if the continuation is a ContinuationWrapper

* Got rid of unnecessary null checks

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

5 years agoFix Compare and gtHashValue handling of BLK & OBJ (dotnet/coreclr#27196)
mikedn [Wed, 16 Oct 2019 00:07:23 +0000 (03:07 +0300)]
Fix Compare and gtHashValue handling of BLK & OBJ (dotnet/coreclr#27196)

* These 2 are GTK_UNOP so they do not belong under "if (kind & GTK_BINOP)".
* OBJ  was already present under "if (kind & GTK_UNOP)" but not BLK.
* BLK was marked GTK_UNOP but not GTK_EXOP so its size was simply ignored by Compare.
* DYN_BLK nodes are GTK_SPECIAL but appeared in the GTK_BINOP section of gtHashValue
* Also fix indir/block node classes in gtlist.h (only used by MEASURE_NODE_SIZE & co.)

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

5 years agoFix some optimization warnings in jit. (dotnet/coreclr#27193)
Sergey Andreenko [Tue, 15 Oct 2019 22:48:42 +0000 (15:48 -0700)]
Fix some optimization warnings in jit. (dotnet/coreclr#27193)

* Do not pass structs by value where you can use const ref.

* Optimize struct layouts.

Gives 0.09% release memory consumtion decrease.

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

5 years agoReplace gtCall. with AsCall()-> (dotnet/coreclr#27172)
Sinan Kaya [Tue, 15 Oct 2019 21:45:13 +0000 (14:45 -0700)]
Replace gtCall. with AsCall()-> (dotnet/coreclr#27172)

* find src/jit -type f -exec sed -i -e 's/gtCall\./AsCall()\./g' {} \;

ascall

* Format patch

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

5 years agoRewrite some blocks exposed by dotnet/coreclr#27122. (dotnet/coreclr#27197)
Sergey Andreenko [Tue, 15 Oct 2019 21:40:04 +0000 (14:40 -0700)]
Rewrite some blocks exposed by dotnet/coreclr#27122. (dotnet/coreclr#27197)

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

5 years agoReplace gtSIMD. with AsSIMD()-> (dotnet/coreclr#27165)
Sinan Kaya [Tue, 15 Oct 2019 19:22:01 +0000 (12:22 -0700)]
Replace gtSIMD. with AsSIMD()-> (dotnet/coreclr#27165)

* find src/jit -type f -exec sed -i -e 's/gtSIMD\./AsSIMD()\./g' {} \;

* too early

* Format patch

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

5 years agoReplace gtCast. with AsCast()-> (dotnet/coreclr#27166)
Sinan Kaya [Tue, 15 Oct 2019 19:21:09 +0000 (12:21 -0700)]
Replace gtCast. with AsCast()-> (dotnet/coreclr#27166)

* find src/jit -type f -exec sed -i -e 's/gtCast\./AsCast()\./g' {} \;

* Format patch

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

5 years agoUpdate Utf8String to match latest prototype (dotnet/coreclr#27046)
Levi Broderick [Tue, 15 Oct 2019 17:51:07 +0000 (10:51 -0700)]
Update Utf8String to match latest prototype (dotnet/coreclr#27046)

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

5 years agoCleanup LowerBlockStore (dotnet/coreclr#27170)
mikedn [Tue, 15 Oct 2019 15:52:38 +0000 (18:52 +0300)]
Cleanup LowerBlockStore (dotnet/coreclr#27170)

* Add initblk 0 init test

* Cleanup LowerBlockStore

* Improve comment about the need for ClearContained

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

5 years agoUse stackalloc expressions with builder ctors (dotnet/coreclr#27194)
Stephen Toub [Tue, 15 Oct 2019 12:53:04 +0000 (08:53 -0400)]
Use stackalloc expressions with builder ctors (dotnet/coreclr#27194)

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

5 years agoReplace `gtArrLen` with `AsArrLen`.
Sinan Kaya [Tue, 15 Oct 2019 04:20:35 +0000 (21:20 -0700)]
Replace `gtArrLen` with `AsArrLen`.

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

5 years agoReplace gtBox. with AsBox() (dotnet/coreclr#27161)
Sinan Kaya [Tue, 15 Oct 2019 04:18:06 +0000 (21:18 -0700)]
Replace gtBox. with AsBox() (dotnet/coreclr#27161)

* find src/jit -type f -exec sed -i -e 's/gtBox\./AsBox()\./g' {} \;

* Cleanup cast

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

5 years agoBuildwork to remove dir.props files (dotnet/coreclr#26960)
David Wrighton [Tue, 15 Oct 2019 03:21:20 +0000 (20:21 -0700)]
Buildwork to remove dir.props files (dotnet/coreclr#26960)

- Remove dir.props and dir.targets
- Move all hierarchical build work into Directory.Build.props and Directory.Build.targets
- Remove some vestiges of BuildTools
- Remove concept of "Arcade" build. All product components (and nearly all of test) now include the Arcade Sdk
- Convert test tree to use nuget.config instead of RestoreSources
- Managed binaries now use the arcade convention for storing their intermediates

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

5 years agoReplace gtRetExpr. with AsRetExpr()-> (dotnet/coreclr#27162)
Sinan Kaya [Tue, 15 Oct 2019 01:44:56 +0000 (18:44 -0700)]
Replace gtRetExpr. with AsRetExpr()-> (dotnet/coreclr#27162)

* find src/jit -type f -exec sed -i -e 's/gtRetExpr\./AsRetExpr()\./g' {} \;

* Format patch

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

5 years agoUpdate first-class-structs doc (dotnet/coreclr#27189)
Carol Eidt [Tue, 15 Oct 2019 00:14:46 +0000 (17:14 -0700)]
Update first-class-structs doc (dotnet/coreclr#27189)

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

5 years agoFix 2 small Statement issues (dotnet/coreclr#27183)
mikedn [Mon, 14 Oct 2019 23:10:23 +0000 (02:10 +0300)]
Fix 2 small Statement issues (dotnet/coreclr#27183)

1. Statement data members have "incorrect" order that leads to unnecessary alignment holes
2. LocalAddressVisitor dumps the statement tree twice

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

5 years agoHandle the case where customAttributeConstructorHandle could be a MemberRef (dotnet...
Andrew Au [Mon, 14 Oct 2019 23:06:53 +0000 (16:06 -0700)]
Handle the case where customAttributeConstructorHandle could be a MemberRef (dotnet/coreclr#27181)

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

5 years agoReplace gtIntConCommon. with AsIntConCommon()-> (dotnet/coreclr#27160)
Sinan Kaya [Mon, 14 Oct 2019 23:02:01 +0000 (16:02 -0700)]
Replace gtIntConCommon. with AsIntConCommon()-> (dotnet/coreclr#27160)

* find src/jit -type f -exec sed -i -e 's/gtIntConCommon\./AsIntConCommon()\./g' {} \;

IntConCommon

* Format patch

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

5 years agoReplace gtDblCon. with AsDblCon()
Sinan Kaya [Mon, 14 Oct 2019 23:01:39 +0000 (16:01 -0700)]
Replace gtDblCon. with AsDblCon()

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

5 years agoAdd regression test for https://github.com/dotnet/coreclr/issues/26491 (dotnet/corec...
Egor Chesakov [Mon, 14 Oct 2019 22:12:58 +0000 (15:12 -0700)]
Add regression test for https://github.com/dotnet/coreclr/issues/26491  (dotnet/coreclr#26518)

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

5 years agoRemove unused binder code (dotnet/coreclr#27180)
Elinor Fung [Mon, 14 Oct 2019 21:56:09 +0000 (14:56 -0700)]
Remove unused binder code (dotnet/coreclr#27180)

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

5 years agoConditionally remove the GC transition from a P/Invoke (dotnet/coreclr#26458)
Aaron Robinson [Mon, 14 Oct 2019 20:33:59 +0000 (13:33 -0700)]
Conditionally remove the GC transition from a P/Invoke (dotnet/coreclr#26458)

* Provide mechanism to remove the GC transition from a P/Invoke.
  New Attribute: 'System.Runtime.InteropServices.SuppressGCTransitionAttribute'

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

5 years agoWrap PerfEventSource usage in IsEnabled checks (dotnet/coreclr#27177)
Michal Strehovský [Mon, 14 Oct 2019 20:08:06 +0000 (22:08 +0200)]
Wrap PerfEventSource usage in IsEnabled checks (dotnet/coreclr#27177)

After the recent start/stop event refactoring, this is the only use of PerfEventSource that is not wrapped in a IsEnabled call.

Tools like IL Linker are able to strip EventSource usage to make the app smaller and the way they do it is by replacing IsEnabled to always return false and making Write methods always throw. If we don't wrap EventSource usage in IsEnabled checks, this results in a broken app.

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

5 years agoFix integer conversion issues (dotnet/coreclr#27173)
Sinan Kaya [Mon, 14 Oct 2019 18:08:21 +0000 (11:08 -0700)]
Fix integer conversion issues (dotnet/coreclr#27173)

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

5 years agoCopy exception regions in the copy constructor (dotnet/coreclr#27176)
Michal Strehovský [Mon, 14 Oct 2019 18:07:16 +0000 (20:07 +0200)]
Copy exception regions in the copy constructor (dotnet/coreclr#27176)

This is used to create MethodIL for the interop stubs. I introduced this field in dotnet/coreclr#27109 but forgot to make a copy here.

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

5 years agoReplace primitive Array fcalls with managed implementations (dotnet/coreclr#27123)
Jan Kotas [Mon, 14 Oct 2019 05:32:46 +0000 (22:32 -0700)]
Replace primitive Array fcalls with managed implementations (dotnet/coreclr#27123)

Prep-work for dotnet/coreclr#27106

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

5 years agoUpdate Jit formatting link (dotnet/coreclr#27171)
Ben Adams [Sun, 13 Oct 2019 23:01:24 +0000 (00:01 +0100)]
Update Jit formatting link (dotnet/coreclr#27171)

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

5 years agoReplace gt## with As## (dotnet/coreclr#27122)
Sinan Kaya [Sat, 12 Oct 2019 08:39:11 +0000 (01:39 -0700)]
Replace gt## with As## (dotnet/coreclr#27122)

* Replace gt## with Get##

* Format patch

* minor cleanups

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

5 years agoCleanup unrolled block op codegen (dotnet/coreclr#27146)
mikedn [Fri, 11 Oct 2019 22:16:32 +0000 (01:16 +0300)]
Cleanup unrolled block op codegen (dotnet/coreclr#27146)

* Move genCodeForInitBlkUnroll to codegenarmarch

* Cleanup unrolled block op codegen

* Fix comment header

* Delete GT_INIT_VAL support from genConsumeRegs

* Add XArch TODO

* Use explicit size in instruction selection

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

5 years agoRemove duplicate code from emitIns_R_AR[R|X]/AR[R|X]_R (dotnet/coreclr#27145)
mikedn [Fri, 11 Oct 2019 21:23:03 +0000 (00:23 +0300)]
Remove duplicate code from emitIns_R_AR[R|X]/AR[R|X]_R (dotnet/coreclr#27145)

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

5 years agoRun tests on Alpine 3.10. (dotnet/coreclr#27093)
Jeremy Koritzinsky [Fri, 11 Oct 2019 20:43:25 +0000 (13:43 -0700)]
Run tests on Alpine 3.10. (dotnet/coreclr#27093)

* Run tests on Alpine 3.10.

* Only run Alpine 3.10 in public PR/CI.

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

5 years agoEnable fast-paths on Mono for Array (dotnet/coreclr#27144)
Egor Bogatov [Fri, 11 Oct 2019 20:29:56 +0000 (23:29 +0300)]
Enable fast-paths on Mono for Array (dotnet/coreclr#27144)

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

5 years agoReplace regNum with GetRegNum() (dotnet/coreclr#27120)
Sinan Kaya [Fri, 11 Oct 2019 18:05:10 +0000 (11:05 -0700)]
Replace regNum with GetRegNum() (dotnet/coreclr#27120)

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

Add forgotten regNum<-> getRegNum

* GetRegNum fix

* more forgotten

* more forgotten

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

5 years agoAdd support for emitting finally regions in ILEmitter (dotnet/coreclr#27109)
Michal Strehovský [Fri, 11 Oct 2019 15:16:53 +0000 (17:16 +0200)]
Add support for emitting finally regions in ILEmitter (dotnet/coreclr#27109)

This will be needed to properly do cleanups in marshalling stubs.

The usage goes like (I couldn't come up with anything better):

```
var b = codeStream.BeginTry();
//...
codeStream.EndTry(b);
codeStream.BeginHandler(b);
// ...
codeStream.EndHandler(b);

emit.NewFinallyRegion(b);
```

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

5 years agoClose unused diagnostic server thread handle (dotnet/coreclr#27141)
Jan Kotas [Fri, 11 Oct 2019 14:13:10 +0000 (07:13 -0700)]
Close unused diagnostic server thread handle (dotnet/coreclr#27141)

Fixes dotnet/coreclr#27135

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

5 years agoMerge pull request dotnet/coreclr#27114 from erozenfeld/Fix27027
Eugene Rozenfeld [Fri, 11 Oct 2019 07:50:31 +0000 (00:50 -0700)]
Merge pull request dotnet/coreclr#27114 from erozenfeld/Fix27027

Jit: Fix SetIndirExceptionFlags.

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

5 years agoReplace lvArgReg with GetArgReg() (dotnet/coreclr#27097)
Sinan Kaya [Fri, 11 Oct 2019 06:58:32 +0000 (23:58 -0700)]
Replace lvArgReg with GetArgReg() (dotnet/coreclr#27097)

* find src/jit -type f -exec sed -i -e 's/.*declspec.*lvArgReg.*//g' {} \;

lvArgReg->GetArgReg

lvArgReg = GetArgReg

* Format patch

* Prefer _lvArgReg

* casting

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

5 years agoRefactoring the ARM intrinsics to match API review and share code with x86 (dotnet...
Tanner Gooding [Fri, 11 Oct 2019 03:44:47 +0000 (20:44 -0700)]
Refactoring the ARM intrinsics to match API review and share code with x86 (dotnet/coreclr#25508)

* Rewriting the ARM64 HWIntrinsic JIT infrastructure to share with and mirror the x86 infrastructure where possible.

* Lowercasing the hwintrinsicarm64 and hwintrinsiclistarm64 files.

* Applying formatting patch.

* Fixing up some names in the PAL and VM that were missed.

* Adding support for AdvSimd.Add

* Ensure impSpecialIntrinsic returns nullptr for unsupported base types.

* Rewording various method headers and simplifying some code.

* Fixing getEmitter to GetEmitter

* Adding support for the ld1 instruction

* Applying formatting patch

* Clarifying a todo comment and removing a stray newline

* Fixing the Arm64 impSpecialIntrinsic to not assert for helper intrinsics

* Fixing some intrinsic signatures that were incorrect

* Adding the initial template files for generating Arm HWIntrinsic tests

* Generating the initial batch of Arm HWIntrinsic tests

* Replace gtRegNum with GetRegNum()

* Fixing the test template alignment checks for Arm

* Regenerating the Arm HWIntrinsic tests

* Fixing the namespace checked for Arm intrinsics

* Changing Base to ArmBase and fixing some Arm hwintrinsic metadata

* Fixing the arm emitter and lowering to not assert for hwintrinsics

* Fixing the arm intrinsics to not set the number of vector elements for SIMDScalar intrinsics

* Updating the AdvSimd.Abs tests to use negative input values

* Regenerating the arm hwintrinsic tests

* Fixing the arm hwintrinsic codegen to use the element size for simd scalar operations.

* Fixing the arm scalar intrinsic tests to check for 0 on upper bits

* Regenerating the ARM intrinsic tests

* Fixing AdvSimd.AbsScalar and AdvSimd.AddScalar to be recursive

* Marking AdvSimd.Arm64 and ArmBase.Arm64 as implemented

* Ensure that AdvSimd.Arm64.Abs is marked as variable size

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

5 years agoDo not create diagnostics server thread and pipe if EnableDiagnostics is set to 0...
Sung Yoon Whang [Fri, 11 Oct 2019 03:42:06 +0000 (20:42 -0700)]
Do not create diagnostics server thread and pipe if EnableDiagnostics is set to 0 (dotnet/coreclr#27137)

* Do not create diagnostics server thread and pipe if EnableDiagnostics is set to 0

* Remove unnecessary check for config var in DiagnosticServer::Shutdown

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

5 years agoRemove unnecessary cleanup on diagnostics server thread during shutdown (dotnet/corec...
Sung Yoon Whang [Fri, 11 Oct 2019 03:39:14 +0000 (20:39 -0700)]
Remove unnecessary cleanup on diagnostics server thread during shutdown (dotnet/coreclr#27136)

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

5 years agoJit: Fix SetIndirExceptionFlags.
Eugene Rozenfeld [Fri, 4 Oct 2019 23:04:33 +0000 (16:04 -0700)]
Jit: Fix SetIndirExceptionFlags.

SetIndirExceptionFlags should not set `GTF_IND_NONFAULTING` flag if the
address has `GTF_EXCEPT` flag.

The failing scenario was:

We were setting `GTF_IND_NONFAULTING` on this indirection (since `ADDR` Node
can't be null)

```
               [000003] *--XG-------              *  IND       int
               [000002] ---XG-------              \--*  ADDR      byref  Zero Fseq[i]
               [000001] ---XG-------                 \--*  FIELD     struct s
               [000000] ------------                    \--*  LCL_VAR   ref    V00 arg0
```
this was then transformed to

```
               [000003] *---G-------              *  IND       int
               [000013] -----+------              \--*  ADD       byref
               [000000] -----+------                 +--*  LCL_VAR   ref    V00 arg0
               [000012] -----+------                 \--*  CNS_INT   long   8 field offset Fseq[s, i]
```
The `GTF_EXCEPT` flag was cleared on `IND` because it had `GTF_IND_NONFAULTING`set
and the address no longer had  `GTF_EXCEPT` flag.

Fixes dotnet/coreclr#27027.

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

5 years agoJIT: only tail recursive calls become loops (dotnet/coreclr#27079)
Andy Ayers [Thu, 10 Oct 2019 06:46:23 +0000 (23:46 -0700)]
JIT: only tail recursive calls become loops (dotnet/coreclr#27079)

Importer was a bit too liberal marking recursive calls as loop-inducing, at
least from the standpoint of enforcing backward-branch constraints. This would
sometimes lead us to inline into cold paths like throws. Only tail-recursive
calls will turn into loops.

Also, future-proof the propagation of simple loopness the root compiler, in
case we ever decide to enable inlining at Tier0.

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

5 years ago[crossgen2] Attribute Presence Filter (dotnet/coreclr#27084)
Andrew Au [Thu, 10 Oct 2019 06:26:50 +0000 (23:26 -0700)]
[crossgen2] Attribute Presence Filter (dotnet/coreclr#27084)

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

5 years agoMerge pull request dotnet/coreclr#27117 from erozenfeld/RenameTest
Eugene Rozenfeld [Thu, 10 Oct 2019 05:27:50 +0000 (22:27 -0700)]
Merge pull request dotnet/coreclr#27117 from erozenfeld/RenameTest

Rename tests for issue 27107.

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

5 years agoFinish `Statement` rework. (dotnet/coreclr#26876)
Sergey Andreenko [Thu, 10 Oct 2019 04:13:02 +0000 (21:13 -0700)]
Finish `Statement` rework. (dotnet/coreclr#26876)

* Delete a leftover for STMT and update dump examples.

* Prepare `GetNextStmt` and `GetPrevStmt` to be used as main read accesors.

* Rename `Statement->gtNext` to `m_nextStmt` and make private.

* Rename `Statement->gtPrev` to `m_prev` and make private.

* Rename `gtStmtLastILoffs` to `m_lastILOffset` and make it private.

* Rename `gtStmtILoffsx` to `m_ILOffsetX` and make it private.

* Rename `compilerAdded` to `m_compilerAdded` and make it private.

* Rename `gtInlineContext` to `m_inlineContext` and make it private.

* Rename `gtStmtList` to `m_treeList` and make it private.

* Rename `gtStmtExpr` to `m_rootTree` and make it private.

* Update the class layout acording to our spec.

* Update the docs.

* Delete another forgotten line.

* Rename `m_rootTree` to `m_TreeRoot`.

Keep it consistent with `m_treeList` .

* Rename `m_TreeRoot` to `m_rootNode`.

* Add comments.

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

5 years agoFix crossgen2 skipped methods NullReferenceException (dotnet/coreclr#27028)
Simon Nattress [Thu, 10 Oct 2019 00:11:42 +0000 (17:11 -0700)]
Fix crossgen2 skipped methods NullReferenceException (dotnet/coreclr#27028)

* Fix crossgen2 skipped methods NullReferenceException

https://github.com/dotnet/coreclr/pull/26756 introduced skipping methods based on filtering criteria, publishing empty code for methods which are skipped.
`ShouldSkipCompilation` reads properties on types and methods and can trigger type loads and thus throw `TypeLoadException`. Currently when that happens, we will not publish empty code for the method and hit the catch in `ComputeDependencyNodeDependencies`. Later when the node is scanned for dependencies, it is in a zombie state with `_methodCode` still null.

Move the `ShouldSkipCompilation` check under the `CompileMethodInternal` try/catch which will appropriately call `PublishEmptyCode` if there's a `TypeSystemException`.

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

5 years agoRename tests for issue 27107.
Eugene Rozenfeld [Wed, 9 Oct 2019 23:17:06 +0000 (16:17 -0700)]
Rename tests for issue 27107.

dotnet/coreclr#27108 fixed dotnet/coreclr#27107 but the tests had an incorrect placeholder name.

Rename the test directory and files.

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

5 years agoJIT: allow block cloning opt in methods with EH (dotnet/coreclr#27088)
Andy Ayers [Wed, 9 Oct 2019 22:34:54 +0000 (15:34 -0700)]
JIT: allow block cloning opt in methods with EH (dotnet/coreclr#27088)

Update `fgOptimizeUncondBranchToSimpleCond` to handle methods with EH. Also
rework the helpers a bit to make them more time-efficient.

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

5 years agoMerge pull request dotnet/coreclr#27108 from erozenfeld/Fix27107
Eugene Rozenfeld [Wed, 9 Oct 2019 22:13:20 +0000 (15:13 -0700)]
Merge pull request dotnet/coreclr#27108 from erozenfeld/Fix27107

Fix ADDR(IND(tree))=>tree transformation in morph.

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

5 years agoFix ADDR(IND(tree))=>tree transformation in morph.
Eugene Rozenfeld [Wed, 9 Oct 2019 19:36:47 +0000 (12:36 -0700)]
Fix ADDR(IND(tree))=>tree transformation in morph.

ADDR(IND(tree)) => tree transformation was losing zero field
sequence annotation that was causing incorrect value numbering
and asserts in the CSE optimization.

Fixes dotnet/coreclr#27107.

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

5 years agoFix F5 experience in VS for crossgen2 (dotnet/coreclr#27104)
Michal Strehovský [Wed, 9 Oct 2019 19:24:10 +0000 (21:24 +0200)]
Fix F5 experience in VS for crossgen2 (dotnet/coreclr#27104)

Ever since dotnet/coreclr#26792 I wasn't able to F5 launch the crossgen2 project from the src\tools\crossgen2\crossgen2.sln solution. I tried git clean, updating VS, etc. until I convinced myself this is really broken for everyone.

The error was:

```
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.0.0' was not found.
  - No frameworks were found.
```

I narrowed this down to the various json config file gunk. Not generating the json file gunk makes the old setup work again. We likely don't need the crossgen2/libs hack anymore either.

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

5 years agoAdd new ready to run helper to managed tools (dotnet/coreclr#27102)
Michal Strehovský [Wed, 9 Oct 2019 14:17:05 +0000 (16:17 +0200)]
Add new ready to run helper to managed tools (dotnet/coreclr#27102)

Follow up to dotnet/coreclr#26807.

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

5 years agoEnsure that GC suspension does not modify last error (dotnet/coreclr#27099)
Jan Kotas [Wed, 9 Oct 2019 12:47:03 +0000 (05:47 -0700)]
Ensure that GC suspension does not modify last error (dotnet/coreclr#27099)

There are no known bugs that this is fixing. These fixes are based on codereview.

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

5 years agoReplace isHfaArg with IsHfaArg()
Sinan Kaya [Wed, 9 Oct 2019 08:17:55 +0000 (01:17 -0700)]
Replace isHfaArg with IsHfaArg()

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

5 years agoRemove some unused code in binder (dotnet/coreclr#27095)
Elinor Fung [Wed, 9 Oct 2019 02:47:43 +0000 (19:47 -0700)]
Remove some unused code in binder (dotnet/coreclr#27095)

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

5 years agocleanup: remove several redundant conditions found by cppcheck (dotnet/coreclr#27001)
Ilya Shipitsin [Wed, 9 Oct 2019 00:14:04 +0000 (05:14 +0500)]
cleanup: remove several redundant conditions found by cppcheck (dotnet/coreclr#27001)

* src/utilcode/ilformatter.cpp: remove redundant condition

[src/utilcode/ilformatter.cpp:274] -> [src/utilcode/ilformatter.cpp:278]: (warning) Identical inner 'if' condition is always true.
[src/utilcode/ilformatter.cpp:285] -> [src/utilcode/ilformatter.cpp:287]: (warning) Identical inner 'if' condition is always true.

* src/utilcode/regutil.cpp: remove redundant condition

[src/utilcode/regutil.cpp:57] -> [src/utilcode/regutil.cpp:64]: (style) The if condition is the same as the previous if condition

* src/utilcode/loaderheap.cpp: remove redundant condition

[src/utilcode/loaderheap.cpp:860] -> [src/utilcode/loaderheap.cpp:865]: (style) The if condition is the same as the previous if condition

* src/pal/src/synchobj/mutex.cpp: remove redundant condition

[src/pal/src/synchobj/mutex.cpp:1273] -> [src/pal/src/synchobj/mutex.cpp:1298]: (style) The if condition is the same as the previous if condition

* src/utilcode/ilformatter.cpp: add closing bracket back
(occasionaely deleted in previous commit)

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

5 years agoOptimize ToString() for byte, ushort, uint and ulong (dotnet/coreclr#27056)
Egor Bogatov [Wed, 9 Oct 2019 00:02:45 +0000 (03:02 +0300)]
Optimize ToString() for byte, ushort, uint and ulong (dotnet/coreclr#27056)

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

5 years agoReplace InternalLoadUnmanagedDllFromPath with NativeLibrary.Load (dotnet/coreclr...
Ryan Lucia [Tue, 8 Oct 2019 23:23:06 +0000 (19:23 -0400)]
Replace InternalLoadUnmanagedDllFromPath with NativeLibrary.Load (dotnet/coreclr#27090)

Both just call into NDirect::LoadLibraryFromPath, and so this simplifies the code by removing a superfluous QCall

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

5 years agoRename genAlignLoops (dotnet/coreclr#27030)
Sinan Kaya [Tue, 8 Oct 2019 23:09:24 +0000 (16:09 -0700)]
Rename genAlignLoops (dotnet/coreclr#27030)

* find src/jit -type f -exec sed -i -e 's/.*declspec.*genAlignLoops.*//g' {} \;

* Go back to doAlignLoops

* Rename to ShouldAlignLoops

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

5 years agoReplace gtRegNum with GetRegNum() (dotnet/coreclr#27086)
Sinan Kaya [Tue, 8 Oct 2019 23:08:04 +0000 (16:08 -0700)]
Replace gtRegNum with GetRegNum() (dotnet/coreclr#27086)

* find src/jit -type f -exec sed -i -e 's/.*declspec.*gtRegNum.*//g' {} \;

Regnum

gtRegNum

GetRegNum

gtRegNum

Format patch

Align document

Rename

* Use Set function

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

5 years agoEnable optimized single-proc allocation helpers for single-proc x86/x64 systems only...
Jan Kotas [Tue, 8 Oct 2019 02:04:18 +0000 (19:04 -0700)]
Enable optimized single-proc allocation helpers for single-proc x86/x64 systems only (dotnet/coreclr#27014)

Use maximum number of processors the process may run on to determine whether it is ok to use
single-proc allocation helpers. It is not sufficient to depend on current process affinity since
that can change during the process lifetime.

Also, the single-proc allocation helpers work well on x86/x64 systems only because of they depend
on atomic non-interlocked increment instruction for good performance. Such instruction is available
on x86/x64 only. Disable them everywhere else.

Fixes dotnet/coreclr#26990

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

5 years agoAdd crossgen2 option to specify JIT library path (dotnet/coreclr#26967)
Anton Lapounov [Tue, 8 Oct 2019 01:11:39 +0000 (18:11 -0700)]
Add crossgen2 option to specify JIT library path (dotnet/coreclr#26967)

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

5 years agoRemove SQL callout cookie from JIT. (dotnet/coreclr#27069)
Aaron Robinson [Tue, 8 Oct 2019 00:05:31 +0000 (17:05 -0700)]
Remove SQL callout cookie from JIT. (dotnet/coreclr#27069)

* Remove SQL callout cookie from JIT.

* Update CLR ABI documentation.

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

5 years agoExplicitly make our minimum ICU version be the version availab… (dotnet/coreclr#27042)
Jeremy Koritzinsky [Mon, 7 Oct 2019 23:11:51 +0000 (16:11 -0700)]
Explicitly make our minimum ICU version be the version availab… (dotnet/coreclr#27042)

* Explicitly make our minimum ICU version be the version available in Alpine 3.6.

* Also check the lower end of the supported version range (to make sure that the range is accurate. Use #error instead of static_assert since we're in C.

* Only define minimum ICU version on Alpine.

* Update ICU version range based on PR feedback.

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

5 years agoRevert "Preparatory changes for implementing Crossgen2 pipeline (dotnet/coreclr#26908...
Tomáš Rylek [Mon, 7 Oct 2019 22:27:57 +0000 (15:27 -0700)]
Revert "Preparatory changes for implementing Crossgen2 pipeline (dotnet/coreclr#26908)" (dotnet/coreclr#27073)

This reverts commit dotnet/coreclr@6ab52d607a3e2a65030b8668a759f717a7bf6ee8.

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

5 years agoFix crossgen2 for methods with StackCrawlMark (dotnet/coreclr#27050)
Jan Vorlicek [Mon, 7 Oct 2019 19:44:47 +0000 (21:44 +0200)]
Fix crossgen2 for methods with StackCrawlMark (dotnet/coreclr#27050)

* Fix crossgen2 for methods with StackCrawlMark

Methods using StackCrawlMark (like Assembly.GetExecutingAssembly)
require that the method is not inlined. Such methods are marked by
System.Security.DynamicSecurityMethod attribute.

This change adds proper handling of such methods, mimicking exactly what
old crossgen does.

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

5 years agoImprove superilc test copying speed and cleanup (dotnet/coreclr#27025)
Jan Vorlicek [Mon, 7 Oct 2019 19:39:46 +0000 (21:39 +0200)]
Improve superilc test copying speed and cleanup (dotnet/coreclr#27025)

The superilc is copying all files that are not found to be managed
assemblies from the original test folder to the target folder.
This includes .pdb and .ilk files that are huge and slow down the
copying process significantly. And they are not needed anyways. So this
change filters these files out.

During cleanup, superilc was removing all .out folders. But I've found
that in most cases, I want it to remove only these folders for crossgen or
crossgen2 based on the compiler types selected using command line
options. This allows me to keep crossgen results and keep comparing them
with new crossgen2 results as I work on fixing issues.
So I have added such a functionality.

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

5 years agoClean up our CMake scripts using features introduced between 3… (dotnet/coreclr#26980)
Jeremy Koritzinsky [Mon, 7 Oct 2019 19:11:15 +0000 (12:11 -0700)]
Clean up our CMake scripts using features introduced between 3… (dotnet/coreclr#26980)

* Try to remove the CLR_CMAKE_COMPILER weirdness.

* Cleanup phase 1.

Fixes CMake's incremental build, but makes MSBuild complain about it's incremental build possibly not working.

* Drive dac and crossgen-specific defines through target properties.

* First pass of consolidation of singularly nested CMakeLists.txt files.

* Convert metadata libraries to not use leaf folders for dac/runtime/crossgen/dbi variations.

* Clean up some of the non-arm assembly file handling.

* Encapsulate arm/arm64 manual preprocessing and compilation of assembly files into a cmake function preprocess_compile_asm.

* Fix typo.

* Convert usages of add_precompiled_header to target_precompile_header everywhere except the jit.

* Clean up/remove some leaf CMake files that are just simple target creation (where most of the work was done in the parent).

* Remove unused CMakeLists file and folder.

* Clean up coreclr/CMakeLists.txt

* Remove conditions based on CMake version (since we're unifying on CMake 3.14)

* Convert final usages of add_precompiled_header to target_precompile_header and remove add_precompiled_header.

* Handle the AsmConstants.inc inclusion in cee_wks by marking it a header file instead of making a custom target.

* Move from deprecated FindPythonInterp module to FindPython module.

* Remove unused jitpch.cpp

* Fix typo.

* Have get_compile_definitions correctly split out generator expressions for multiple-valued generator expressions.

* preprocess_def_file -> preprocess_file and make it work xplat.

* Fix test build.

* Fix typo in flag.

* Fix resource building on non-windows.

* Fix other linker flag typo I missed.

* Add missing eventing_headers dependency.

* Fix multivalued generator expression.

* Use CMake 3.x features to significantly simplify toolchain.cmake.

* Remove references to LLDB from gen-buildsys-* (these aren't needed since SOS moved out of the repo).

* Remove debugging line

* Check check_pie_supported

* Clean up link flags.

* Fix copy-paste typo

* Cleanup. Change some conditions in configurecompiler to check for MSVC specifically, not Windows.

* Restore the llldb include and library path searching.

* Restore asmconstants_inc custom target.

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

5 years agoRename isSplit (dotnet/coreclr#27011)
Sinan Kaya [Mon, 7 Oct 2019 17:38:39 +0000 (13:38 -0400)]
Rename isSplit (dotnet/coreclr#27011)

* __declspec(property(get = getIsSplit, put = setIsSplit)) bool isSplit;

* Format patch

* SetSplit

* GetSplit

* Forgotten conversions

* Add more forgotten

* Rename agein

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

5 years agoPrint tier in DumpJittedMethods. (dotnet/coreclr#27017)
Sergey Andreenko [Mon, 7 Oct 2019 17:30:55 +0000 (10:30 -0700)]
Print tier in DumpJittedMethods. (dotnet/coreclr#27017)

* Print tier in DumpJittedMethods.

I found that useful when reproducing bugs that require `complus_TieredCompilation=1`.

Example:
```
Compiling    0 System.SpanHelpers::IndexOf, IL size = 902, hsh=0xda613814 for Tier-1
Compiling    1 System.Text.Unicode.Utf16Utility::GetPointerToFirstInvalidChar, IL size = 1107, hsh=0xe576e43d
Compiling    2 System.Runtime.Intrinsics.Vector128::CreateScalarUnsafe, IL size = 21, hsh=0x6746a268 for Tier-0
```

* Fix JitFunctionTrace printing.

The opening is using decimal number, but the closing was using hex.

* Add compGetTieringName.

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

5 years agoInitial perf jitdump implementation (dotnet/coreclr#26897)
Steve MacLean [Mon, 7 Oct 2019 17:12:16 +0000 (13:12 -0400)]
Initial perf jitdump implementation (dotnet/coreclr#26897)

* Initial perf jitdump implementation

When COMPlus_PerfMapEnabled is enabled, generate jitdump file.

Usage:

export COMPlus_PerfMapEnabled=1
perf record -k 1 -g corerun helloworld.dll
perf --debug verbose=10 inject --input perf.data --jit --output perfjit.data
perf report --input perfjit.data

Works best with latest perf with patches:

Repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
Branch: perf/urgent
Patches:
- https://lkml.org/lkml/2019/10/2/875

cd tools/perf && make DEBUG=1

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

5 years agoImplement stack probing using helpers on (win|linux)-(x86|x64) (dotnet/coreclr#26807)
Egor Chesakov [Mon, 7 Oct 2019 16:46:35 +0000 (09:46 -0700)]
Implement stack probing using helpers on (win|linux)-(x86|x64) (dotnet/coreclr#26807)

* Implement JIT_StackProbe (CORINFO_HELP_STACK_PROBE) helper in assembly on win-x64, win-x86, linux-x64, linux-x86 in src/vm/amd64 and src/vm/i386

* Insert a call to CORINFO_HELP_STACK_PROBE helper instead of inlining a stack probing loop in src/jit/codegenxarch.cpp

* Add READYTORUN_HELPER_StackProbe and its mapping to CORINFO_HELP_STACK_PROBE in src/inc/readytorun.h and src/inc/readytorunhelpers.h

* Update crossgen2 JitInterface and JITEEVersionIdentifier in src/inc/corinfo.h and src/tools/crossgen2/jitinterface/jitwrapper.cpp

* Add test templates (T4) for stack probing tests in tests/src/JIT/Regression/JitBlue/GitHub_21061/GitHub_21061_StackOverflowIn(Function|Funclet)Prolog.tt

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

5 years agoAdd csproj and bash script for crossgen2 ThunkGenerator (dotnet/coreclr#26916)
Jakob Botsch Nielsen [Mon, 7 Oct 2019 16:11:23 +0000 (18:11 +0200)]
Add csproj and bash script for crossgen2 ThunkGenerator (dotnet/coreclr#26916)

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

5 years agoMake it possible to compile apps that target WindowsDesktop SDK (dotnet/coreclr#27037)
Michal Strehovský [Mon, 7 Oct 2019 15:05:52 +0000 (17:05 +0200)]
Make it possible to compile apps that target WindowsDesktop SDK (dotnet/coreclr#27037)

We were missing some p/invoke related stuff.

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

5 years agoMore CompareInfo.IndexOf globalization fixes (dotnet/coreclr#27049)
Jan Kotas [Sun, 6 Oct 2019 19:01:55 +0000 (12:01 -0700)]
More CompareInfo.IndexOf globalization fixes (dotnet/coreclr#27049)

Apply earlier CompareInfo.StartsWith fixes onto CompareInfo.IndexOf as well

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

5 years ago[master] Update dependencies from dotnet/corefx (dotnet/coreclr#26965)
dotnet-maestro[bot] [Sun, 6 Oct 2019 14:05:27 +0000 (14:05 +0000)]
[master] Update dependencies from dotnet/corefx (dotnet/coreclr#26965)

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

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19480.12
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19480.12

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

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19501.13
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19501.13

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

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19502.6
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19502.6

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

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19503.5
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19503.5

* Disable newly added Utf8SpanTests

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

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19504.9
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19504.9

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

- Microsoft.NETCore.Platforms - 5.0.0-alpha1.19505.5
- Microsoft.Private.CoreFx.NETCoreApp - 5.0.0-alpha1.19505.5

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