Emit type layout check fixups (#34927)
authorSimon Nattress <nattress@gmail.com>
Tue, 21 Apr 2020 17:42:16 +0000 (10:42 -0700)
committerGitHub <noreply@github.com>
Tue, 21 Apr 2020 17:42:16 +0000 (10:42 -0700)
commitb7046a2463dc37eee457436a7f5cab00c5066d95
treea9feb85e13a7014b25affb9f79295f87266ac4b9
parentf66207384a3081f7184c2375edf9bac823002271
Emit type layout check fixups (#34927)

* Emit type layout check fixups

When a ready-to-run compiled method uses value types from other version bubbles, emit a precode fixup to check at runtime that the type is still compatible (same size, alignment, GC layout).

Bring over `GCPointerMap*.cs` from CoreRT repo to get the compute the GC layout bytes that match what the runtime expects in the layout blob.

Simplify the behavior of the Crossgen test scripting. If tests opt out of crossgen by setting `<CrossGenTest>false</CrossGenTest>`, skip emitting the crossgen commands into the test run script. Also, stop setting the `RunCrossGen` and `RunCrossGen2` environment variables in the test script based on compile-time settings. These get set by runtest.py anyway. This set of tweaks allow for crossgen tests which we don't want to run the default crossgen commands on, and allow choosing either crossgen or crossgen2 as part of test execution.
src/coreclr/src/tools/Common/JitInterface/CorInfoImpl.cs
src/coreclr/src/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
src/coreclr/src/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs [new file with mode: 0644]
src/coreclr/src/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.cs [new file with mode: 0644]
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/TypeFixupSignature.cs
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunSymbolNodeFactory.cs
src/coreclr/src/tools/crossgen2/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
src/coreclr/src/tools/crossgen2/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj
src/coreclr/tests/src/CLRTest.CrossGen.targets
src/coreclr/tests/src/readytorun/tests/mainv1.csproj
src/coreclr/tests/src/readytorun/tests/mainv2.csproj