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

Fold IND(frozenObj, CNS) #85127

Merged
merged 15 commits into from
Apr 26, 2023
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
11 changes: 9 additions & 2 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -3224,7 +3224,7 @@ class ICorDynamicInfo : public ICorStaticInfo
) = 0;

//------------------------------------------------------------------------------
// getReadonlyStaticFieldValue: returns true and the actual field's value if the given
// getStaticFieldContent: returns true and the actual field's value if the given
// field represents a statically initialized readonly field of any type.
//
// Arguments:
Expand All @@ -3236,14 +3236,21 @@ class ICorDynamicInfo : public ICorStaticInfo
// Return Value:
// Returns true if field's constant value was available and successfully copied to buffer
//
virtual bool getReadonlyStaticFieldValue(
virtual bool getStaticFieldContent(
CORINFO_FIELD_HANDLE field,
uint8_t *buffer,
int bufferSize,
int valueOffset = 0,
bool ignoreMovableObjects = true
) = 0;

virtual bool getObjectContent(
CORINFO_OBJECT_HANDLE obj,
uint8_t* buffer,
int bufferSize,
int valueOffset
) = 0;

// If pIsSpeculative is NULL, return the class handle for the value of ref-class typed
// static readonly fields, if there is a unique location for the static and the class
// is already initialized.
Expand Down
8 changes: 7 additions & 1 deletion src/coreclr/inc/icorjitinfoimpl_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,19 @@ unsigned getClassDomainID(
CORINFO_CLASS_HANDLE cls,
void** ppIndirection) override;

bool getReadonlyStaticFieldValue(
bool getStaticFieldContent(
CORINFO_FIELD_HANDLE field,
uint8_t* buffer,
int bufferSize,
int valueOffset,
bool ignoreMovableObjects) override;

bool getObjectContent(
CORINFO_OBJECT_HANDLE obj,
uint8_t* buffer,
int bufferSize,
int valueOffset) override;

CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(
CORINFO_FIELD_HANDLE field,
bool* pIsSpeculative) 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 = { /* 7925c4a8-129f-48ef-b48a-262d60ef84b0 */
0x7925c4a8,
0x129f,
0x48ef,
{ 0xb4, 0x8a, 0x26, 0x2d, 0x60, 0xef, 0x84, 0xb0 }
constexpr GUID JITEEVersionIdentifier = { /* 387bcec3-9a71-4422-a11c-e7ce3b73c592 */
0x387bcec3,
0x9a71,
0x4422,
{0xa1, 0x1c, 0xe7, 0xce, 0x3b, 0x73, 0xc5, 0x92}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/ICorJitInfo_names_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ DEF_CLR_API(getCallInfo)
DEF_CLR_API(canAccessFamily)
DEF_CLR_API(isRIDClassDomainID)
DEF_CLR_API(getClassDomainID)
DEF_CLR_API(getReadonlyStaticFieldValue)
DEF_CLR_API(getStaticFieldContent)
DEF_CLR_API(getObjectContent)
DEF_CLR_API(getStaticFieldCurrentClass)
DEF_CLR_API(getVarArgsHandle)
DEF_CLR_API(canGetVarArgsHandle)
Expand Down
20 changes: 16 additions & 4 deletions src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1522,16 +1522,28 @@ unsigned WrapICorJitInfo::getClassDomainID(
return temp;
}

bool WrapICorJitInfo::getReadonlyStaticFieldValue(
bool WrapICorJitInfo::getStaticFieldContent(
CORINFO_FIELD_HANDLE field,
uint8_t* buffer,
int bufferSize,
int valueOffset,
bool ignoreMovableObjects)
{
API_ENTER(getReadonlyStaticFieldValue);
bool temp = wrapHnd->getReadonlyStaticFieldValue(field, buffer, bufferSize, valueOffset, ignoreMovableObjects);
API_LEAVE(getReadonlyStaticFieldValue);
API_ENTER(getStaticFieldContent);
bool temp = wrapHnd->getStaticFieldContent(field, buffer, bufferSize, valueOffset, ignoreMovableObjects);
API_LEAVE(getStaticFieldContent);
return temp;
}

bool WrapICorJitInfo::getObjectContent(
CORINFO_OBJECT_HANDLE obj,
uint8_t* buffer,
int bufferSize,
int valueOffset)
{
API_ENTER(getObjectContent);
bool temp = wrapHnd->getObjectContent(obj, buffer, bufferSize, valueOffset);
API_LEAVE(getObjectContent);
return temp;
}

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3869,7 +3869,7 @@ GenTree* Compiler::impImportStaticReadOnlyField(CORINFO_FIELD_HANDLE field, CORI
if (varTypeIsIntegral(fieldType) || varTypeIsFloating(fieldType) || (fieldType == TYP_REF))
{
assert(bufferSize >= genTypeSize(fieldType));
if (info.compCompHnd->getReadonlyStaticFieldValue(field, buffer, genTypeSize(fieldType)))
if (info.compCompHnd->getStaticFieldContent(field, buffer, genTypeSize(fieldType)))
{
GenTree* cnsValue = impImportCnsTreeFromBuffer(buffer, fieldType);
if (cnsValue != nullptr)
Expand Down Expand Up @@ -3899,7 +3899,7 @@ GenTree* Compiler::impImportStaticReadOnlyField(CORINFO_FIELD_HANDLE field, CORI
}

uint8_t buffer[MaxStructSize] = {0};
if (info.compCompHnd->getReadonlyStaticFieldValue(field, buffer, totalSize))
if (info.compCompHnd->getStaticFieldContent(field, buffer, totalSize))
{
#ifdef FEATURE_SIMD
// First, let's check whether field is a SIMD vector and import it as GT_CNS_VEC
Expand Down Expand Up @@ -3949,7 +3949,7 @@ GenTree* Compiler::impImportStaticReadOnlyField(CORINFO_FIELD_HANDLE field, CORI
return gtNewLclvNode(structTempNum, realType);
}

JITDUMP("getReadonlyStaticFieldValue returned false - bail out.");
JITDUMP("getStaticFieldContent returned false - bail out.");
return nullptr;
}

Expand Down Expand Up @@ -3980,7 +3980,7 @@ GenTree* Compiler::impImportStaticReadOnlyField(CORINFO_FIELD_HANDLE field, CORI
const int bufferSize = TARGET_POINTER_SIZE;
uint8_t buffer[bufferSize] = {0};

if ((totalSize > bufferSize) || !info.compCompHnd->getReadonlyStaticFieldValue(field, buffer, totalSize))
if ((totalSize > bufferSize) || !info.compCompHnd->getStaticFieldContent(field, buffer, totalSize))
{
return nullptr;
}
Expand Down
Loading