Skip to content

Commit

Permalink
Adding new ReadyToRun helper for static cctor (#76898)
Browse files Browse the repository at this point in the history
* Adding new ReadyToRun helper for static cctor

When accessing a static field the static cctor of the class is
called. Then the helper CORINFO_HELP_READYTORUN_STATIC_BASE
was printed twice during the same block, the first for the cctor
and the second for the getter, as if they were two calls for the
same method.

* Removing helper CORINFO_HELP_STRCNS_CURRENT_MODULE

* Removing CORINFO_HELP_STRCNS_CURRENT_MODULE

* Changing TYP_BYREF to TYP_VOID

* Formatting files

* Splitting up R2R STATIC_BASE in more helpers

* Updating STATIC_BASE R2R helper with new helpers

* Extending getReadyToRunHelper support

Consider the new R2R helpers that were group in
CORINFO_HELP_READYTORUN_STATIC_BASE.

* Keeping the preffered R2R helper constructor

In some cases the R2R helpers already call to the
constructor. In those cases we can insert a repeated
call that will be eliminated by CSE. There are still
cases in which we may need to call the constructor.

* Extending value numbering with new helpers

* Renaming helper

* Replacing STATIC_BASE helper in ilc for NON_GC

* Fixing helper order

* Refactoring code

* Supporting R2R_STATIC_BASE helper in nativeaot

* Moving compiler var initialization to compCompile

* Using new helper names in ILC

* Encapsulating common method

* Removing CORINFO_HELP_READYTORUN_STATIC_BASE helper

* Removing comment

* Moving new helper function to shared code

* Setting undef helper as default

* Repeating same helper call for CSE optimization

Avoid hardcoding the Non-GC helper call, which is used just to
trigger the constructor if it is needed, and use the existing
helper call in the code, so CSE would persist only one.

* Update src/coreclr/jit/compiler.cpp

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>

* Update src/coreclr/tools/Common/Compiler/DependencyAnalysis/CorInfoHelpers.cs

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>

* Update src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>

* Update src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>

* Formatting jithelpers.h

* Renaming function

* Moving CorInfoHelper function to R2R/AOT interface

* Updating preferred helper when is not thread type

* Removing some helper value nums

Static base helper was removed and cctor returns
void.

* Formatting file

* Ensuring void return when the helper is cctor

* Updating preferred helper when when classes matches

* Removing cctor trigger helper from aot,vm and jit

* Updating m_prefferedInitCctor default value

It is initialized with CORINFO_HELP_UNDEF and set to R2R GC or NON
GC Static Base later.

* Updating comments

* Updating comments

Co-authored-by: Brian Bohe <brianbohe@microsoft.com>
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
  • Loading branch information
4 people committed Dec 13, 2022
1 parent ba3ee73 commit c635ae2
Show file tree
Hide file tree
Showing 16 changed files with 138 additions and 47 deletions.
6 changes: 4 additions & 2 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ enum CorInfoHelpFunc
CORINFO_HELP_NEWARR_1_ALIGN8, // like VC, but aligns the array start

CORINFO_HELP_STRCNS, // create a new string literal
CORINFO_HELP_STRCNS_CURRENT_MODULE, // create a new string literal from the current module (used by NGen code)

/* Object model */

Expand Down Expand Up @@ -591,7 +590,10 @@ enum CorInfoHelpFunc
CORINFO_HELP_READYTORUN_NEWARR_1,
CORINFO_HELP_READYTORUN_ISINSTANCEOF,
CORINFO_HELP_READYTORUN_CHKCAST,
CORINFO_HELP_READYTORUN_STATIC_BASE,
CORINFO_HELP_READYTORUN_GCSTATIC_BASE, // static gc field access
CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE, // static non gc field access
CORINFO_HELP_READYTORUN_THREADSTATIC_BASE,
CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR,
CORINFO_HELP_READYTORUN_GENERIC_HANDLE,
CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
#define GUID_DEFINED
#endif // !GUID_DEFINED

constexpr GUID JITEEVersionIdentifier = { /* aaa9536e-1295-4741-a7d9-6c09a5b01512 */
0xaaa9536e,
0x1295,
0x4741,
{0xa7, 0xd9, 0x6c, 0x9, 0xa5, 0xb0, 0x15, 0x12}
constexpr GUID JITEEVersionIdentifier = { /* fd13d4e1-9815-4336-8232-b27878b9ebd4 */
0xfd13d4e1,
0x9815,
0x4336,
{0x82, 0x32, 0xb2, 0x78, 0x78, 0xb9, 0xeb, 0xd4}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/inc/jithelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_ALIGN8, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)

JITHELPER(CORINFO_HELP_STRCNS, JIT_StrCns, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_STRCNS_CURRENT_MODULE, NULL, CORINFO_HELP_SIG_REG_ONLY)

// Object model
JITHELPER(CORINFO_HELP_INITCLASS, JIT_InitClass, CORINFO_HELP_SIG_REG_ONLY)
Expand Down Expand Up @@ -259,7 +258,10 @@
JITHELPER(CORINFO_HELP_READYTORUN_NEWARR_1, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_ISINSTANCEOF, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_CHKCAST, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_GCSTATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_THREADSTATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE, NULL,CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_GENERIC_HANDLE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,8 @@ void Compiler::compInit(ArenaAllocator* pAlloc,
#endif // FEATURE_SIMD

compUsesThrowHelper = false;

m_preferredInitCctor = CORINFO_HELP_UNDEF;
}

/*****************************************************************************
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4661,6 +4661,12 @@ class Compiler
PhaseStatus placeLoopAlignInstructions();
#endif

// This field keep the R2R helper call that would be inserted to trigger the constructor
// of the static class. It is set as nongc or gc static base if they are imported, so
// CSE can eliminate the repeated call, or the chepeast helper function that triggers it.
CorInfoHelpFunc m_preferredInitCctor;
void fgSetPreferredInitCctor();

GenTree* fgInitThisClass();

GenTreeCall* fgGetStaticsCCtorHelper(CORINFO_CLASS_HANDLE cls, CorInfoHelpFunc helper);
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3597,7 +3597,9 @@ inline bool Compiler::IsSharedStaticHelper(GenTree* tree)
helper == CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS ||
helper == CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS ||
#ifdef FEATURE_READYTORUN
helper == CORINFO_HELP_READYTORUN_STATIC_BASE || helper == CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE ||
helper == CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE || helper == CORINFO_HELP_READYTORUN_GCSTATIC_BASE ||
helper == CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE || helper == CORINFO_HELP_READYTORUN_THREADSTATIC_BASE ||
helper == CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE ||
#endif
helper == CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS;
#if 0
Expand Down
17 changes: 15 additions & 2 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,19 @@ GenTreeCall* Compiler::fgGetStaticsCCtorHelper(CORINFO_CLASS_HANDLE cls, CorInfo
return result;
}

//------------------------------------------------------------------------------
// fgSetPreferredInitCctor: Set CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE as the
// preferred call constructure if it is undefined.
//
void Compiler::fgSetPreferredInitCctor()
{
if (m_preferredInitCctor == CORINFO_HELP_UNDEF)
{
// This is the cheapest helper that triggers the constructor.
m_preferredInitCctor = CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE;
}
}

GenTreeCall* Compiler::fgGetSharedCCtor(CORINFO_CLASS_HANDLE cls)
{
#ifdef FEATURE_READYTORUN
Expand All @@ -893,8 +906,8 @@ GenTreeCall* Compiler::fgGetSharedCCtor(CORINFO_CLASS_HANDLE cls)
CORINFO_RESOLVED_TOKEN resolvedToken;
memset(&resolvedToken, 0, sizeof(resolvedToken));
resolvedToken.hClass = cls;

return impReadyToRunHelperToTree(&resolvedToken, CORINFO_HELP_READYTORUN_STATIC_BASE, TYP_BYREF);
fgSetPreferredInitCctor();
return impReadyToRunHelperToTree(&resolvedToken, m_preferredInitCctor, TYP_BYREF);
}
#endif

Expand Down
8 changes: 7 additions & 1 deletion src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4277,7 +4277,13 @@ GenTree* Compiler::impImportStaticFieldAccess(CORINFO_RESOLVED_TOKEN* pResolvedT
callFlags |= GTF_CALL_HOISTABLE;
}

op1 = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_STATIC_BASE, TYP_BYREF);
op1 = gtNewHelperCallNode(pFieldInfo->helper, TYP_BYREF);
if (pResolvedToken->hClass == info.compClassHnd && m_preferredInitCctor == CORINFO_HELP_UNDEF &&
(pFieldInfo->helper == CORINFO_HELP_READYTORUN_GCSTATIC_BASE ||
pFieldInfo->helper == CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE))
{
m_preferredInitCctor = pFieldInfo->helper;
}
op1->gtFlags |= callFlags;

op1->AsCall()->setEntryPoint(pFieldInfo->fieldLookup);
Expand Down
18 changes: 5 additions & 13 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8369,18 +8369,9 @@ GenTree* Compiler::fgMorphConst(GenTree* tree)
{
// For un-important blocks, we want to construct the string lazily

if (helper == CORINFO_HELP_STRCNS_CURRENT_MODULE)
{
tree = gtNewHelperCallNode(helper, TYP_REF,
gtNewIconNode(RidFromToken(tree->AsStrCon()->gtSconCPX), TYP_INT));
}
else
{
tree = gtNewHelperCallNode(helper, TYP_REF,
gtNewIconNode(RidFromToken(tree->AsStrCon()->gtSconCPX), TYP_INT),
gtNewIconEmbScpHndNode(tree->AsStrCon()->gtScpHnd));
}

tree =
gtNewHelperCallNode(helper, TYP_REF, gtNewIconNode(RidFromToken(tree->AsStrCon()->gtSconCPX), TYP_INT),
gtNewIconEmbScpHndNode(tree->AsStrCon()->gtScpHnd));
return fgMorphTree(tree);
}
}
Expand Down Expand Up @@ -14312,7 +14303,8 @@ GenTree* Compiler::fgInitThisClass()
if (!(info.compClassAttr & CORINFO_FLG_SHAREDINST))
{
resolvedToken.hClass = info.compClassHnd;
return impReadyToRunHelperToTree(&resolvedToken, CORINFO_HELP_READYTORUN_STATIC_BASE, TYP_BYREF);
fgSetPreferredInitCctor();
return impReadyToRunHelperToTree(&resolvedToken, m_preferredInitCctor, TYP_BYREF);
}

// We need a runtime lookup.
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/jit/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,10 @@ void HelperCallProperties::init()
case CORINFO_HELP_GETSTATICFIELDADDR_TLS:
case CORINFO_HELP_GETGENERICS_GCSTATIC_BASE:
case CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE:
case CORINFO_HELP_READYTORUN_STATIC_BASE:
case CORINFO_HELP_READYTORUN_GCSTATIC_BASE:
case CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE:
case CORINFO_HELP_READYTORUN_THREADSTATIC_BASE:
case CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE:
case CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE:

// These may invoke static class constructors
Expand Down
18 changes: 15 additions & 3 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10194,7 +10194,10 @@ void Compiler::fgValueNumberHelperCallFunc(GenTreeCall* call, VNFunc vnf, ValueN
}
break;

case VNF_ReadyToRunStaticBase:
case VNF_ReadyToRunStaticBaseGC:
case VNF_ReadyToRunStaticBaseNonGC:
case VNF_ReadyToRunStaticBaseThread:
case VNF_ReadyToRunStaticBaseThreadNonGC:
case VNF_ReadyToRunGenericStaticBase:
case VNF_ReadyToRunIsInstanceOf:
case VNF_ReadyToRunCastClass:
Expand Down Expand Up @@ -10555,8 +10558,17 @@ VNFunc Compiler::fgValueNumberJitHelperMethodVNFunc(CorInfoHelpFunc helpFunc)
case CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR:
vnf = VNF_GetsharedNongcstaticBaseNoctor;
break;
case CORINFO_HELP_READYTORUN_STATIC_BASE:
vnf = VNF_ReadyToRunStaticBase;
case CORINFO_HELP_READYTORUN_GCSTATIC_BASE:
vnf = VNF_ReadyToRunStaticBaseGC;
break;
case CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE:
vnf = VNF_ReadyToRunStaticBaseNonGC;
break;
case CORINFO_HELP_READYTORUN_THREADSTATIC_BASE:
vnf = VNF_ReadyToRunStaticBaseThread;
break;
case CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE:
vnf = VNF_ReadyToRunStaticBaseThreadNonGC;
break;
case CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE:
vnf = VNF_ReadyToRunGenericStaticBase;
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/jit/valuenumfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ ValueNumFuncDef(GetsharedGcstaticBase, 2, false, true, true)
ValueNumFuncDef(GetsharedNongcstaticBase, 2, false, true, true)
ValueNumFuncDef(GetsharedGcstaticBaseNoctor, 1, false, true, true)
ValueNumFuncDef(GetsharedNongcstaticBaseNoctor, 1, false, true, true)
ValueNumFuncDef(ReadyToRunStaticBase, 1, false, true, true)
ValueNumFuncDef(ReadyToRunStaticBaseGC, 1, false, true, true)
ValueNumFuncDef(ReadyToRunStaticBaseNonGC, 1, false, true, true)
ValueNumFuncDef(ReadyToRunStaticBaseThread, 1, false, true, true)
ValueNumFuncDef(ReadyToRunStaticBaseThreadNonGC, 1, false, true, true)
ValueNumFuncDef(ReadyToRunGenericStaticBase, 2, false, true, true)
ValueNumFuncDef(GetsharedGcstaticBaseDynamicclass, 2, false, true, true)
ValueNumFuncDef(GetsharedNongcstaticBaseDynamicclass, 2, false, true, true)
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/tools/Common/JitInterface/CorInfoHelpFunc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ which is the right helper to use to allocate an object of a given type. */
CORINFO_HELP_NEWARR_1_ALIGN8, // like VC, but aligns the array start

CORINFO_HELP_STRCNS, // create a new string literal
CORINFO_HELP_STRCNS_CURRENT_MODULE, // create a new string literal from the current module (used by NGen code)
/* Object model */

CORINFO_HELP_INITCLASS, // Initialize class if not already initialized
Expand Down Expand Up @@ -233,7 +232,10 @@ which is the right helper to use to allocate an object of a given type. */
CORINFO_HELP_READYTORUN_NEWARR_1,
CORINFO_HELP_READYTORUN_ISINSTANCEOF,
CORINFO_HELP_READYTORUN_CHKCAST,
CORINFO_HELP_READYTORUN_STATIC_BASE,
CORINFO_HELP_READYTORUN_GCSTATIC_BASE,
CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE,
CORINFO_HELP_READYTORUN_THREADSTATIC_BASE,
CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR,
CORINFO_HELP_READYTORUN_GENERIC_HANDLE,
CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
Expand Down
23 changes: 23 additions & 0 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3237,6 +3237,29 @@ private uint getThreadTLSIndex(ref void* ppIndirection)
}
}

public static ReadyToRunHelperId GetReadyToRunHelperFromStaticBaseHelper(CorInfoHelpFunc helper)
{
ReadyToRunHelperId res;
switch (helper)
{
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_GCSTATIC_BASE:
res = ReadyToRunHelperId.GetGCStaticBase;
break;
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE:
res = ReadyToRunHelperId.GetNonGCStaticBase;
break;
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_THREADSTATIC_BASE:
res = ReadyToRunHelperId.GetThreadStaticBase;
break;
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE:
res = ReadyToRunHelperId.GetThreadNonGcStaticBase;
break;
default:
throw new NotImplementedException("ReadyToRun: " + helper.ToString());
}
return res;
}

private void getFunctionFixedEntryPoint(CORINFO_METHOD_STRUCT_* ftn, bool isUnsafeFunctionPointer, ref CORINFO_CONST_LOOKUP pResult)
{ throw new NotImplementedException("getFunctionFixedEntryPoint"); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,13 +726,16 @@ private bool getReadyToRunHelper(ref CORINFO_RESOLVED_TOKEN pResolvedToken, ref
pLookup = CreateConstLookupToSymbol(_compilation.SymbolNodeFactory.CreateReadyToRunHelper(ReadyToRunHelperId.CastClass, type));
}
break;
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_STATIC_BASE:
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_GCSTATIC_BASE:
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE:
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_THREADSTATIC_BASE:
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE:
{
var type = HandleToObject(pResolvedToken.hClass);
if (type.IsCanonicalSubtype(CanonicalFormKind.Any))
return false;

pLookup = CreateConstLookupToSymbol(_compilation.SymbolNodeFactory.CreateReadyToRunHelper(ReadyToRunHelperId.CctorTrigger, type));
var helperId = GetReadyToRunHelperFromStaticBaseHelper(id);
pLookup = CreateConstLookupToSymbol(_compilation.SymbolNodeFactory.CreateReadyToRunHelper(helperId, type));
}
break;
case CorInfoHelpFunc.CORINFO_HELP_READYTORUN_GENERIC_HANDLE:
Expand Down Expand Up @@ -1536,7 +1539,7 @@ private void getFieldInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_MET
else
{
fieldAccessor = CORINFO_FIELD_ACCESSOR.CORINFO_FIELD_STATIC_SHARED_STATIC_HELPER;
pResult->helper = CorInfoHelpFunc.CORINFO_HELP_READYTORUN_STATIC_BASE;
pResult->helper = CorInfoHelpFunc.CORINFO_HELP_UNDEF;

ReadyToRunHelperId helperId = ReadyToRunHelperId.Invalid;
CORINFO_FIELD_ACCESSOR intrinsicAccessor;
Expand All @@ -1550,18 +1553,27 @@ private void getFieldInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_MET
{
if (field.HasGCStaticBase)
{
pResult->helper = CorInfoHelpFunc.CORINFO_HELP_READYTORUN_THREADSTATIC_BASE;
helperId = ReadyToRunHelperId.GetThreadStaticBase;
}
else
{
pResult->helper = CorInfoHelpFunc.CORINFO_HELP_READYTORUN_NONGCTHREADSTATIC_BASE;
helperId = ReadyToRunHelperId.GetThreadNonGcStaticBase;
}
}
else
{
helperId = field.HasGCStaticBase ?
ReadyToRunHelperId.GetGCStaticBase :
ReadyToRunHelperId.GetNonGCStaticBase;
if (field.HasGCStaticBase)
{
pResult->helper = CorInfoHelpFunc.CORINFO_HELP_READYTORUN_GCSTATIC_BASE;
helperId = ReadyToRunHelperId.GetGCStaticBase;
}
else
{
pResult->helper = CorInfoHelpFunc.CORINFO_HELP_READYTORUN_NONGCSTATIC_BASE;
helperId = ReadyToRunHelperId.GetNonGCStaticBase;
}
}

if (!_compilation.NodeFactory.CompilationModuleGroup.VersionsWithType(field.OwningType) &&
Expand Down
Loading

0 comments on commit c635ae2

Please sign in to comment.