Fix GCStress coverage for multi reg returns. (dotnet/coreclr#24826)
authorSergey Andreenko <seandree@microsoft.com>
Thu, 6 Jun 2019 00:25:24 +0000 (17:25 -0700)
committerGitHub <noreply@github.com>
Thu, 6 Jun 2019 00:25:24 +0000 (17:25 -0700)
commitd3e1142b3946005ab8e4fec251a2fa8f5285e558
tree41c931b11069a5936b83deb80b9375c1b2a6d909
parent1136c840cd5fc0a53009a315996539e43d197c7f
Fix GCStress coverage for multi reg returns. (dotnet/coreclr#24826)

* Extract ReplaceInstrAfterCall.

* Avoid GCStress when return multireg with pointers.

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

* Add a repro test.

* Reenable MethodImplOptionsTests.

* Extract IsGcCoveregeInterruptInstruction.

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

* Tolerate direct call to JIT_RareDisableHelper.

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

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

* Fix arm64.

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

* Fix review1.

* Fix review2.

* Change the test as Andy suggested.

* Fix some typos.

* Replace all SLOT with PBYTE.

* Disable assert that can fail because of multithreading.

Commit migrated from https://github.com/dotnet/coreclr/commit/3dd303f0004ed4771bc29167df30efda07e4cf7e
src/coreclr/src/inc/gcinfotypes.h
src/coreclr/src/vm/gccover.cpp
src/coreclr/src/vm/gccover.h
src/coreclr/src/vm/method.cpp
src/coreclr/src/vm/method.hpp
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_23199/GitHub_23199.csproj [new file with mode: 0644]
src/coreclr/tests/src/ilasm/System/Runtime/CompilerServices/MethodImplOptionsTests.csproj