Skip to content

Commit

Permalink
Move fgHasOptStaticInit to morph
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Mar 8, 2021
1 parent a3ca77d commit 15318fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ PhaseStatus Compiler::fgInsertClsInitChecks()
if ((isInitAddr == 0) || (isInitMask == 0))
{
JITDUMP("getIsClassInitedFieldAddress: returned empty isInitAddr or isInitedMask.");
return PhaseStatus::MODIFIED_NOTHING;
continue;
}
assert(isInitMask > 0);

Expand Down Expand Up @@ -1163,7 +1163,6 @@ GenTreeCall* Compiler::fgGetStaticsCCtorHelper(CORINFO_CLASS_HANDLE cls, CorInfo
{
// Save cls for this helper for fgInsertClsInitChecks phase
result->gtRetClsHnd = cls;
fgHasOptStaticInit = true;
}

// If we're importing the special EqualityComparer<T>.Default or Comparer<T>.Default
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9237,6 +9237,17 @@ GenTree* Compiler::fgMorphCall(GenTreeCall* call)
optMethodFlags |= OMF_NEEDS_GCPOLLS;
}

// Look for candidates for fgInsertClsInitChecks phase.
if (fgGlobalMorph && (call->gtCallType == CT_HELPER) && (call->gtRetClsHnd != nullptr))
{
CorInfoHelpFunc helper = eeGetHelperNum(call->gtCallMethHnd);
if ((helper == CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE) ||
(helper == CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS))
{
fgHasOptStaticInit = true;
}
}

// Morph Type.op_Equality, Type.op_Inequality, and Enum.HasFlag
//
// We need to do these before the arguments are morphed
Expand Down

0 comments on commit 15318fa

Please sign in to comment.