Improve SuperPMI handling of CORINFO_SIG_INST handle arrays (#46604)
authorBruce Forstall <brucefo@microsoft.com>
Fri, 8 Jan 2021 00:13:49 +0000 (14:13 -1000)
committerGitHub <noreply@github.com>
Fri, 8 Jan 2021 00:13:49 +0000 (16:13 -0800)
commit08631794ecd7155afa1f2401fe5c7ee1af785a6d
treef70e9536ee940b7613f09401f6bf2912ae37bd37
parent51f90ab4069c434a183f3f837dc38907f75c74e0
Improve SuperPMI handling of CORINFO_SIG_INST handle arrays (#46604)

* Improve SuperPMI handling of CORINFO_SIG_INST handle arrays

CORINFO_SIG_INST, used by the CORINFO_SIG_INFO struct, contains
two pointers to arrays of handles. SuperPMI was saving/restoring
these assuming 8-byte pointers. This worked fine for same-bitness
record/playback (although on 32-bit it saved/restored twice as
much data as it should, reading beyond the actual arrays when
saving). However, when recording on 32-bit and replaying on 64-bit,
this didn't work.

Change the CORINFO_SIG_INST recording to record the handle arrays
in a new dense DWORDLONG map, SigInstHandleMap, in "agnostic" format (64-bit pointers),
and store an index into this map to the base of the array. The handle array
can then be serialized/deserialized properly for cross-bitness scenarios.
The map contains only unique array sequences, which is required so when
we look up an array we find the unique map index.

Create helpers for all the CORINFO_SIG_INST related serialization/deserialization/
dump/formatting.

Also, implement record/playback of getExpectedTargetArchitecture().

Added "-simple" option to "mcs -dump" to not print the function name/signature
for a method context. Useful for debugging problems where constructing that
name/signature causes mcs crashes/asserts.

Record on arm, playback on x64, using cross-compiler, now works.

* Change the JIT/EE GUID

The JIT/EE interface hasn't changed, but the SuperPMI data format
has changed incompatibly, so force a recollection that won't be
confused with the old collections.

* Fix non-Windows build
15 files changed:
src/coreclr/ToolBox/superpmi/mcs/commandline.cpp
src/coreclr/ToolBox/superpmi/mcs/commandline.h
src/coreclr/ToolBox/superpmi/mcs/mcs.cpp
src/coreclr/ToolBox/superpmi/mcs/verbdump.cpp
src/coreclr/ToolBox/superpmi/mcs/verbdump.h
src/coreclr/ToolBox/superpmi/superpmi-shared/lightweightmap.h
src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h
src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h
src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.cpp
src/coreclr/ToolBox/superpmi/superpmi-shared/spmidumphelper.h
src/coreclr/ToolBox/superpmi/superpmi-shared/spmirecordhelper.h
src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
src/coreclr/inc/jiteeversionguid.h