Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion src/coreclr/ToolBox/superpmi/superpmi-shared/lwmlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ LWM(IsDelegateCreationAllowed, DLDL, DWORD)
LWM(IsFieldStatic, DWORDLONG, DWORD)
LWM(IsIntrinsicType, DWORDLONG, DWORD)
LWM(IsSDArray, DWORDLONG, DWORD)
LWM(IsStructRequiringStackAllocRetBuf, DWORDLONG, DWORD)
LWM(IsValidStringRef, DLD, DWORD)
LWM(GetStringLiteral, DLD, DD)
LWM(IsValidToken, DLD, DWORD)
Expand Down
23 changes: 0 additions & 23 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1813,29 +1813,6 @@ bool MethodContext::repIsValueClass(CORINFO_CLASS_HANDLE cls)
return value != 0;
}

void MethodContext::recIsStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls, bool result)
{
if (IsStructRequiringStackAllocRetBuf == nullptr)
IsStructRequiringStackAllocRetBuf = new LightWeightMap<DWORDLONG, DWORD>();

DWORDLONG key = CastHandle(cls);
DWORD value = result ? 1 : 0;
IsStructRequiringStackAllocRetBuf->Add(key, value);
DEBUG_REC(dmpIsStructRequiringStackAllocRetBuf(key, value));
}
void MethodContext::dmpIsStructRequiringStackAllocRetBuf(DWORDLONG key, DWORD value)
{
printf("IsStructRequiringStackAllocRetBuf key cls-%016llX, value res-%u", key, value);
}
bool MethodContext::repIsStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls)
{
DWORDLONG key = CastHandle(cls);
AssertMapAndKeyExist(IsStructRequiringStackAllocRetBuf, key, ": key %016llX", key);
DWORD value = IsStructRequiringStackAllocRetBuf->Get(key);
DEBUG_REP(dmpIsStructRequiringStackAllocRetBuf(key, value));
return value != 0;
}

void MethodContext::recGetClassSize(CORINFO_CLASS_HANDLE cls, unsigned result)
{
if (GetClassSize == nullptr)
Expand Down
6 changes: 1 addition & 5 deletions src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ class MethodContext
void dmpIsValueClass(DWORDLONG key, DWORD value);
bool repIsValueClass(CORINFO_CLASS_HANDLE cls);

void recIsStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls, bool result);
void dmpIsStructRequiringStackAllocRetBuf(DWORDLONG key, DWORD value);
bool repIsStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls);

void recGetClassSize(CORINFO_CLASS_HANDLE cls, unsigned result);
void dmpGetClassSize(DWORDLONG key, DWORD val);
unsigned repGetClassSize(CORINFO_CLASS_HANDLE cls);
Expand Down Expand Up @@ -1009,7 +1005,7 @@ enum mcPackets
Packet_IsCompatibleDelegate = 99,
//Packet_IsInstantiationOfVerifiedGeneric = 100,
Packet_IsSDArray = 101,
Packet_IsStructRequiringStackAllocRetBuf = 102,
//Packet_IsStructRequiringStackAllocRetBuf = 102,
Packet_IsValidStringRef = 103,
//Retired6 = 104,
Packet_IsValueClass = 105,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,20 +550,6 @@ uint32_t interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls)
return temp;
}

// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value
// of this type must be stack-allocated. This will generally be true only if the struct
// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows
// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate
// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return
// buffers do not require GC write barriers.
bool interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("isStructRequiringStackAllocRetBuf");
bool temp = original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls);
mc->recIsStructRequiringStackAllocRetBuf(cls, temp);
return temp;
}

CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getClassModule");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,6 @@ uint32_t interceptor_ICJI::getClassAttribs(
return original_ICorJitInfo->getClassAttribs(cls);
}

bool interceptor_ICJI::isStructRequiringStackAllocRetBuf(
CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("isStructRequiringStackAllocRetBuf");
return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls);
}

CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(
CORINFO_CLASS_HANDLE cls)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,6 @@ uint32_t interceptor_ICJI::getClassAttribs(
return original_ICorJitInfo->getClassAttribs(cls);
}

bool interceptor_ICJI::isStructRequiringStackAllocRetBuf(
CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls);
}

CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(
CORINFO_CLASS_HANDLE cls)
{
Expand Down
12 changes: 0 additions & 12 deletions src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,18 +482,6 @@ uint32_t MyICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls)
return jitInstance->mc->repGetClassAttribs(cls);
}

// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value
// of this type must be stack-allocated. This will generally be true only if the struct
// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows
// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate
// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return
// buffers do not require GC write barriers.
bool MyICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("isStructRequiringStackAllocRetBuf");
return jitInstance->mc->repIsStructRequiringStackAllocRetBuf(cls);
}

CORINFO_MODULE_HANDLE MyICJI::getClassModule(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getClassModule");
Expand Down
10 changes: 0 additions & 10 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ enum CorInfoHelpFunc

CORINFO_HELP_GETFIELDADDR,

CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, // Helper for context-static fields
CORINFO_HELP_GETSTATICFIELDADDR_TLS, // Helper for PE TLS fields

// There are a variety of specialized helpers for accessing static fields. The JIT should use
Expand Down Expand Up @@ -886,7 +885,6 @@ enum CorInfoIntrinsics
CORINFO_INTRINSIC_Array_Get, // Get the value of an element in an array
CORINFO_INTRINSIC_Array_Address, // Get the address of an element in an array
CORINFO_INTRINSIC_Array_Set, // Set the value of an element in an array
CORINFO_INTRINSIC_InitializeArray, // initialize an array from static data
CORINFO_INTRINSIC_RTH_GetValueInternal,
CORINFO_INTRINSIC_Object_GetType,
CORINFO_INTRINSIC_StubHelpers_GetStubContext,
Expand Down Expand Up @@ -2302,14 +2300,6 @@ class ICorStaticInfo
CORINFO_CLASS_HANDLE cls
) = 0;

// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value
// of this type must be stack-allocated. This will generally be true only if the struct
// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows
// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate
// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return
// buffers do not require GC write barriers.
virtual bool isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls) = 0;

virtual CORINFO_MODULE_HANDLE getClassModule (
CORINFO_CLASS_HANDLE cls
) = 0;
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ CorInfoInlineTypeCheck canInlineTypeCheck(
uint32_t getClassAttribs(
CORINFO_CLASS_HANDLE cls) override;

bool isStructRequiringStackAllocRetBuf(
CORINFO_CLASS_HANDLE cls) override;

CORINFO_MODULE_HANDLE getClassModule(
CORINFO_CLASS_HANDLE cls) override;

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 = { /* 3df3e3ec-b1f6-4e6d-8439-2e7f3f7fa2ac */
0x3df3e3ec,
0xb1f6,
0x4e6d,
{0x84, 0x39, 0x2e, 0x7f, 0x3f, 0x7f, 0xa2, 0xac}
constexpr GUID JITEEVersionIdentifier = { /* 0c6f2d8d-f1b7-4c28-bbe8-36c8f6b35fbf */
0xc6f2d8d,
0xf1b7,
0x4c28,
{ 0xbb, 0xe8, 0x36, 0xc8, 0xf6, 0xb3, 0x5f, 0xbf}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/inc/jithelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@

JITHELPER(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,CORINFO_HELP_SIG_REG_ONLY)

JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)

JITHELPER(CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, JIT_GetGenericsGCStaticBase,CORINFO_HELP_SIG_REG_ONLY)
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/ICorJitInfo_API_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ DEF_CLR_API(appendClassName)
DEF_CLR_API(isValueClass)
DEF_CLR_API(canInlineTypeCheck)
DEF_CLR_API(getClassAttribs)
DEF_CLR_API(isStructRequiringStackAllocRetBuf)
DEF_CLR_API(getClassModule)
DEF_CLR_API(getModuleAssembly)
DEF_CLR_API(getAssemblyName)
Expand Down
9 changes: 0 additions & 9 deletions src/coreclr/jit/ICorJitInfo_API_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,15 +455,6 @@ uint32_t WrapICorJitInfo::getClassAttribs(
return temp;
}

bool WrapICorJitInfo::isStructRequiringStackAllocRetBuf(
CORINFO_CLASS_HANDLE cls)
{
API_ENTER(isStructRequiringStackAllocRetBuf);
bool temp = wrapHnd->isStructRequiringStackAllocRetBuf(cls);
API_LEAVE(isStructRequiringStackAllocRetBuf);
return temp;
}

CORINFO_MODULE_HANDLE WrapICorJitInfo::getClassModule(
CORINFO_CLASS_HANDLE cls)
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10003,7 +10003,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bool compInitMem : 1; // Is the CORINFO_OPT_INIT_LOCALS bit set in the method info options?
bool compProfilerCallback : 1; // JIT inserted a profiler Enter callback
bool compPublishStubParam : 1; // EAX captured in prolog will be available through an intrinsic
bool compRetBuffDefStack : 1; // The ret buff argument definitely points into the stack.
bool compHasNextCallRetAddr : 1; // The NextCallReturnAddress intrinsic is used.

var_types compRetType; // Return type of the method as declared in IL
Expand Down
5 changes: 2 additions & 3 deletions src/coreclr/jit/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3622,9 +3622,8 @@ inline bool Compiler::IsSharedStaticHelper(GenTree* tree)
helper == CORINFO_HELP_STRCNS || helper == CORINFO_HELP_BOX ||

// helpers being added to IsSharedStaticHelper
helper == CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT || helper == CORINFO_HELP_GETSTATICFIELDADDR_TLS ||
helper == CORINFO_HELP_GETGENERICS_GCSTATIC_BASE || helper == CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE ||
helper == CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE ||
helper == CORINFO_HELP_GETSTATICFIELDADDR_TLS || helper == CORINFO_HELP_GETGENERICS_GCSTATIC_BASE ||
helper == CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE || helper == CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE ||
helper == CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE ||

helper == CORINFO_HELP_GETSHARED_GCSTATIC_BASE || helper == CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE ||
Expand Down
23 changes: 0 additions & 23 deletions src/coreclr/jit/gcinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,29 +728,6 @@ GCInfo::WriteBarrierForm GCInfo::gcWriteBarrierFormFromTargetAddress(GenTree* tg
assert(varDsc->TypeGet() == TYP_BYREF);
return GCInfo::WBF_NoBarrier;
}

// We don't eliminate for inlined methods, where we (can) know where the "retBuff" points.
if (!compiler->compIsForInlining() && lclNum == compiler->info.compRetBuffArg)
{
assert(compiler->info.compRetType == TYP_STRUCT); // Else shouldn't have a ret buff.

// Are we assured that the ret buff pointer points into the stack of a caller?
if (compiler->info.compRetBuffDefStack)
{
#if 0
// This is an optional debugging mode. If the #if 0 above is changed to #if 1,
// every barrier we remove for stores to GC ref fields of a retbuff use a special
// helper that asserts that the target is not in the heap.
#ifdef DEBUG
return WBF_NoBarrier_CheckNotHeapInDebug;
#else
return WBF_NoBarrier;
#endif
#else // 0
return GCInfo::WBF_NoBarrier;
#endif // 0
}
}
}
if (tgtAddr->TypeGet() == TYP_REF)
{
Expand Down
19 changes: 13 additions & 6 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3629,7 +3629,6 @@ const char* Compiler::impGetIntrinsicName(CorInfoIntrinsics intrinsicID)
"CORINFO_INTRINSIC_Array_Get",
"CORINFO_INTRINSIC_Array_Address",
"CORINFO_INTRINSIC_Array_Set",
"CORINFO_INTRINSIC_InitializeArray",
"CORINFO_INTRINSIC_RTH_GetValueInternal",
"CORINFO_INTRINSIC_Object_GetType",
"CORINFO_INTRINSIC_StubHelpers_GetStubContext",
Expand Down Expand Up @@ -3925,7 +3924,9 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
return new (this, GT_LABEL) GenTree(GT_LABEL, TYP_I_IMPL);
}

if ((ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan) && IsTargetAbi(CORINFO_CORERT_ABI))
if (((ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan) ||
(ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray)) &&
IsTargetAbi(CORINFO_CORERT_ABI))
{
// CreateSpan must be expanded for NativeAOT
mustExpand = true;
Expand Down Expand Up @@ -3953,10 +3954,6 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
{
GenTree* op1;

case CORINFO_INTRINSIC_InitializeArray:
retNode = impInitializeArrayIntrinsic(sig);
break;

case CORINFO_INTRINSIC_Array_Address:
case CORINFO_INTRINSIC_Array_Get:
case CORINFO_INTRINSIC_Array_Set:
Expand Down Expand Up @@ -4205,6 +4202,12 @@ GenTree* Compiler::impIntrinsic(GenTree* newobjThis,
break;
}

case NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray:
{
retNode = impInitializeArrayIntrinsic(sig);
break;
}

case NI_System_Span_get_Item:
case NI_System_ReadOnlySpan_get_Item:
{
Expand Down Expand Up @@ -5328,6 +5331,10 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
{
result = NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan;
}
else if (strcmp(methodName, "InitializeArray") == 0)
{
result = NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray;
}
}
else if (strncmp(namespaceName, "System.Runtime.Intrinsics", 25) == 0)
{
Expand Down
18 changes: 1 addition & 17 deletions src/coreclr/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,24 +557,8 @@ void Compiler::lvaInitRetBuffArg(InitVarDscInfo* varDscInfo, bool useFixedRetBuf
#endif
varDsc->lvOnFrame = true; // The final home for this incoming register might be our local stack frame

info.compRetBuffDefStack = 0;
if (info.compRetType == TYP_STRUCT)
{
CORINFO_SIG_INFO sigInfo;
info.compCompHnd->getMethodSig(info.compMethodHnd, &sigInfo);
assert(JITtype2varType(sigInfo.retType) == info.compRetType); // Else shouldn't have a ret buff.

info.compRetBuffDefStack = (info.compCompHnd->isStructRequiringStackAllocRetBuf(sigInfo.retTypeClass));
if (info.compRetBuffDefStack)
{
// If we're assured that the ret buff argument points into a callers stack, we will type it as
// "TYP_I_IMPL"
// (native int/unmanaged pointer) so that it's not tracked as a GC ref.
varDsc->lvType = TYP_I_IMPL;
}
}
#ifdef FEATURE_SIMD
else if (supportSIMDTypes() && varTypeIsSIMD(info.compRetType))
if (supportSIMDTypes() && varTypeIsSIMD(info.compRetType))
{
varDsc->lvSIMDType = true;

Expand Down
Loading