Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new ReadyToRun helper for static cctor #76898

Merged
merged 40 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1211cb1
Adding new ReadyToRun helper for static cctor
Oct 11, 2022
9a7c991
Removing helper CORINFO_HELP_STRCNS_CURRENT_MODULE
Oct 11, 2022
409da4e
Removing CORINFO_HELP_STRCNS_CURRENT_MODULE
Oct 11, 2022
d055d55
Changing TYP_BYREF to TYP_VOID
Oct 11, 2022
1903862
Formatting files
Oct 12, 2022
cb78ee9
Splitting up R2R STATIC_BASE in more helpers
Oct 27, 2022
53c73de
Updating STATIC_BASE R2R helper with new helpers
Oct 28, 2022
933dd93
Extending getReadyToRunHelper support
Oct 28, 2022
70e9bfe
Keeping the preffered R2R helper constructor
Oct 28, 2022
b7a8ffc
Extending value numbering with new helpers
Oct 28, 2022
1332980
Renaming helper
Oct 31, 2022
d189215
Replacing STATIC_BASE helper in ilc for NON_GC
Oct 31, 2022
b1d54eb
Fixing helper order
Oct 31, 2022
648fa16
Refactoring code
Nov 1, 2022
5bc789d
Supporting R2R_STATIC_BASE helper in nativeaot
Nov 1, 2022
ab6f1d9
Moving compiler var initialization to compCompile
Nov 1, 2022
ad4cbb7
Using new helper names in ILC
Nov 1, 2022
dd0ccdf
Encapsulating common method
Nov 2, 2022
bc065d0
Removing CORINFO_HELP_READYTORUN_STATIC_BASE helper
Nov 2, 2022
a632385
Removing comment
Nov 2, 2022
1fe4ddd
Moving new helper function to shared code
Nov 2, 2022
5b61fa5
Setting undef helper as default
Nov 2, 2022
3f1d67f
Repeating same helper call for CSE optimization
Nov 4, 2022
24f8e53
Update src/coreclr/jit/compiler.cpp
BrianBohe Nov 16, 2022
8e94962
Update src/coreclr/tools/Common/Compiler/DependencyAnalysis/CorInfoHe…
BrianBohe Nov 16, 2022
5dea605
Update src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoIm…
BrianBohe Nov 16, 2022
a6ed1fc
Update src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorIn…
BrianBohe Nov 16, 2022
ea284bc
Formatting jithelpers.h
Nov 16, 2022
8665faf
Renaming function
Nov 16, 2022
f91a24e
Moving CorInfoHelper function to R2R/AOT interface
Nov 16, 2022
7396d94
Updating preferred helper when is not thread type
Nov 16, 2022
a10f64e
Removing some helper value nums
Nov 16, 2022
1ee3002
Formatting file
Nov 16, 2022
ddaab33
Ensuring void return when the helper is cctor
Nov 16, 2022
a206b9f
Updating preferred helper when when classes matches
Nov 17, 2022
abb0e3d
Removing cctor trigger helper from aot,vm and jit
Nov 22, 2022
1d8d7b9
Updating m_prefferedInitCctor default value
BrianBohe Dec 9, 2022
593ac75
Updating comments
BrianBohe Dec 10, 2022
485f1a1
Merge branch 'main' into issue-69635
BrianBohe Dec 10, 2022
1e26ed1
Updating comments
BrianBohe Dec 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4661,6 +4661,11 @@ class Compiler
PhaseStatus placeLoopAlignInstructions();
#endif

// We use this field to set the desired R2R helper call, which can be the constructor
// helper, or the same helper we are using the code, so the CSE will eliminate one of both.
CorInfoHelpFunc m_preferredInitCctor;
BrianBohe marked this conversation as resolved.
Show resolved Hide resolved
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);
BrianBohe marked this conversation as resolved.
Show resolved Hide resolved
}
#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 @@ -14311,7 +14302,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