Skip to content

Commit

Permalink
JIT: Model string literal objects as invariant and non-GLOB_REF (#70986)
Browse files Browse the repository at this point in the history
* Model string literals as invariant/non GLOB_REF

* String literals are never null
  • Loading branch information
jakobbotsch committed Jun 20, 2022
1 parent df53937 commit 81cf5ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6873,8 +6873,10 @@ GenTree* Compiler::gtNewStringLiteralNode(InfoAccessType iat, void* pValue)
tree = gtNewOperNode(GT_IND, TYP_REF, tree);
// This indirection won't cause an exception.
tree->gtFlags |= GTF_IND_NONFAULTING;
// This indirection points into the gloabal heap (it is String Object)
tree->gtFlags |= GTF_GLOB_REF;
// String literal objects are also ok to model as invariant.
tree->gtFlags |= GTF_IND_INVARIANT;
// ..and they are never null.
tree->gtFlags |= GTF_IND_NONNULL;
break;

default:
Expand Down

0 comments on commit 81cf5ad

Please sign in to comment.