Annotate handle indirections with GTF_IND_INVARIANT and add validation to fgDebugChec...
authorBrian Sullivan <briansul@microsoft.com>
Mon, 21 Sep 2020 18:50:03 +0000 (11:50 -0700)
committerGitHub <noreply@github.com>
Mon, 21 Sep 2020 18:50:03 +0000 (11:50 -0700)
commit755f01659f03196487ec41225de8956911f8049b
tree4b3541e9f1edfc1e30bdf8dc7c874d7ed57d916c
parenta919d52654a2ff04b99e9d9695d6ec5c4f762ce1
Annotate handle indirections with GTF_IND_INVARIANT and add validation to fgDebugCheckFlags (#42021)

* Rename GTF_ICON_PTR_HDL to GTF_ICON_PTR_GLOBAL - Use this whenever we are embedding a pointer to mutable data from the VM state

* Rename GTF_ICON_PSTR_HDL to GTF_ICON_CONST_PTR, use this when the constant is a pointer to immutable data, (e.g. IAT_PPVALUE)

* Use GTF_ICON_TOKEN_HDL only for a constant that is a token handle, other than class, method or field.

* In gtDispConst - print H or I when we have a handle, or O for a field offset
In gtNewStringLiteralNode - Added assert for non-CoreRT case of a IAT_VALUE of a TYP_REF

* In optHoistThisLoop - print if the loop has a single exit or multiple exits
as this can currently significantly limit our hoisting optimization.

* Added assert for later lowering of IAT_PPVALUE in Lowering::LowerDirectCall
and comment in Lowering::LowerNonvirtPinvokeCall where we currently allow this late expansion.

* Added function fgDebugCheckDispFlags to support extra flag checking of GTF_IND_INVARIANT
Disable the GTF_IND_INVARIANT for the cases that currentlt do not set it correctly.

* Added additional support for checking of GTF_IND_NONFAULTING in fgDebugCheckFlags (disabled)
Minor changes with GTF_IND_NONFAULTING
Added assert(!"Check this")
Add check for GTF_ICON_PINVKI_HDL // Eventually remove, as this is immutable

* Changed a GTF_ICON_FIELD_HDL to be invariant in fgMorphField
Added  assert(!"Unreached GTF_IND_INVARIANT") in fgMorphField
Fixed IAT_PPVALUe and modified IAT_PVALUE cases in fgMorphLeaf for GT_FTN_ADDR

* Mark indirection of handles created by gtNewIconEmbHndNode as invariant
This was previously #ifdef out
ran jit-format

* Enable checking of GTF_IND_INVARIANT in fgDebugCheckFlags

* Fix Compiler::fgMorphLeaf for extra fgMorpgTree in GT_FTN_ADDR IAT_VALUE case
Removed #if 0 code

* Reverse the if-the-else block for creating a static field address or value
Remove the unreachable block

* Added asserts to gtNewIndOfIconHandleNode if isInvariant is set incorrectly, set GTF_GLOB_REF for all class static indirections
Check that all class static indirections have GTF_GLOB_REF set
Changed two asserts to be noway_asserts
Changed the indirection that points to the array initialization blob to be a GTF_ICON_CONST_PTR instead of a GTF_ICON_STATIC_HDL.
Changed the indirection that fetches the field offset value for ReadyToRun to be a GTF_ICON_CONST_PTR instead of a GTF_ICON_FIELD_HDL.

* ifdef 0 code to touch the codegen of Generic methods via GTF_DONT_CSE

* Rename of GTF_ICON_PTR_GLOBAL to GTF_ICON_GLOBAL_PTR

* Refactor morph of static field and eliminate the dead code

* Add method header for fgDebugCheckDispFlags
Rename of GTF_ICON_GLOBAL_PTR) for emitarm64.ccp
src/coreclr/src/jit/compiler.cpp
src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/compiler.hpp
src/coreclr/src/jit/emitarm64.cpp
src/coreclr/src/jit/flowgraph.cpp
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/gentree.h
src/coreclr/src/jit/importer.cpp
src/coreclr/src/jit/lower.cpp
src/coreclr/src/jit/morph.cpp
src/coreclr/src/jit/optimizer.cpp