Skip to content

Commit 21f033a

Browse files
EgorBojakobbotsch
andauthored
Fold IND(frozenObj, CNS) (#85127)
Co-authored-by: Jakob Botsch Nielsen <[email protected]>
1 parent 7a70d5a commit 21f033a

File tree

23 files changed

+525
-220
lines changed

23 files changed

+525
-220
lines changed

src/coreclr/inc/corinfo.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,7 +3224,7 @@ class ICorDynamicInfo : public ICorStaticInfo
32243224
) = 0;
32253225

32263226
//------------------------------------------------------------------------------
3227-
// getReadonlyStaticFieldValue: returns true and the actual field's value if the given
3227+
// getStaticFieldContent: returns true and the actual field's value if the given
32283228
// field represents a statically initialized readonly field of any type.
32293229
//
32303230
// Arguments:
@@ -3236,14 +3236,21 @@ class ICorDynamicInfo : public ICorStaticInfo
32363236
// Return Value:
32373237
// Returns true if field's constant value was available and successfully copied to buffer
32383238
//
3239-
virtual bool getReadonlyStaticFieldValue(
3239+
virtual bool getStaticFieldContent(
32403240
CORINFO_FIELD_HANDLE field,
32413241
uint8_t *buffer,
32423242
int bufferSize,
32433243
int valueOffset = 0,
32443244
bool ignoreMovableObjects = true
32453245
) = 0;
32463246

3247+
virtual bool getObjectContent(
3248+
CORINFO_OBJECT_HANDLE obj,
3249+
uint8_t* buffer,
3250+
int bufferSize,
3251+
int valueOffset
3252+
) = 0;
3253+
32473254
// If pIsSpeculative is NULL, return the class handle for the value of ref-class typed
32483255
// static readonly fields, if there is a unique location for the static and the class
32493256
// is already initialized.

src/coreclr/inc/icorjitinfoimpl_generated.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,19 @@ unsigned getClassDomainID(
636636
CORINFO_CLASS_HANDLE cls,
637637
void** ppIndirection) override;
638638

639-
bool getReadonlyStaticFieldValue(
639+
bool getStaticFieldContent(
640640
CORINFO_FIELD_HANDLE field,
641641
uint8_t* buffer,
642642
int bufferSize,
643643
int valueOffset,
644644
bool ignoreMovableObjects) override;
645645

646+
bool getObjectContent(
647+
CORINFO_OBJECT_HANDLE obj,
648+
uint8_t* buffer,
649+
int bufferSize,
650+
int valueOffset) override;
651+
646652
CORINFO_CLASS_HANDLE getStaticFieldCurrentClass(
647653
CORINFO_FIELD_HANDLE field,
648654
bool* pIsSpeculative) override;

src/coreclr/inc/jiteeversionguid.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ typedef const GUID *LPCGUID;
4343
#define GUID_DEFINED
4444
#endif // !GUID_DEFINED
4545

46-
constexpr GUID JITEEVersionIdentifier = { /* 7925c4a8-129f-48ef-b48a-262d60ef84b0 */
47-
0x7925c4a8,
48-
0x129f,
49-
0x48ef,
50-
{ 0xb4, 0x8a, 0x26, 0x2d, 0x60, 0xef, 0x84, 0xb0 }
46+
constexpr GUID JITEEVersionIdentifier = { /* 387bcec3-9a71-4422-a11c-e7ce3b73c592 */
47+
0x387bcec3,
48+
0x9a71,
49+
0x4422,
50+
{0xa1, 0x1c, 0xe7, 0xce, 0x3b, 0x73, 0xc5, 0x92}
5151
};
5252

5353
//////////////////////////////////////////////////////////////////////////////////////////////////////////

src/coreclr/jit/ICorJitInfo_names_generated.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ DEF_CLR_API(getCallInfo)
159159
DEF_CLR_API(canAccessFamily)
160160
DEF_CLR_API(isRIDClassDomainID)
161161
DEF_CLR_API(getClassDomainID)
162-
DEF_CLR_API(getReadonlyStaticFieldValue)
162+
DEF_CLR_API(getStaticFieldContent)
163+
DEF_CLR_API(getObjectContent)
163164
DEF_CLR_API(getStaticFieldCurrentClass)
164165
DEF_CLR_API(getVarArgsHandle)
165166
DEF_CLR_API(canGetVarArgsHandle)

src/coreclr/jit/ICorJitInfo_wrapper_generated.hpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,16 +1522,28 @@ unsigned WrapICorJitInfo::getClassDomainID(
15221522
return temp;
15231523
}
15241524

1525-
bool WrapICorJitInfo::getReadonlyStaticFieldValue(
1525+
bool WrapICorJitInfo::getStaticFieldContent(
15261526
CORINFO_FIELD_HANDLE field,
15271527
uint8_t* buffer,
15281528
int bufferSize,
15291529
int valueOffset,
15301530
bool ignoreMovableObjects)
15311531
{
1532-
API_ENTER(getReadonlyStaticFieldValue);
1533-
bool temp = wrapHnd->getReadonlyStaticFieldValue(field, buffer, bufferSize, valueOffset, ignoreMovableObjects);
1534-
API_LEAVE(getReadonlyStaticFieldValue);
1532+
API_ENTER(getStaticFieldContent);
1533+
bool temp = wrapHnd->getStaticFieldContent(field, buffer, bufferSize, valueOffset, ignoreMovableObjects);
1534+
API_LEAVE(getStaticFieldContent);
1535+
return temp;
1536+
}
1537+
1538+
bool WrapICorJitInfo::getObjectContent(
1539+
CORINFO_OBJECT_HANDLE obj,
1540+
uint8_t* buffer,
1541+
int bufferSize,
1542+
int valueOffset)
1543+
{
1544+
API_ENTER(getObjectContent);
1545+
bool temp = wrapHnd->getObjectContent(obj, buffer, bufferSize, valueOffset);
1546+
API_LEAVE(getObjectContent);
15351547
return temp;
15361548
}
15371549

src/coreclr/jit/importer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,7 +3869,7 @@ GenTree* Compiler::impImportStaticReadOnlyField(CORINFO_FIELD_HANDLE field, CORI
38693869
if (varTypeIsIntegral(fieldType) || varTypeIsFloating(fieldType) || (fieldType == TYP_REF))
38703870
{
38713871
assert(bufferSize >= genTypeSize(fieldType));
3872-
if (info.compCompHnd->getReadonlyStaticFieldValue(field, buffer, genTypeSize(fieldType)))
3872+
if (info.compCompHnd->getStaticFieldContent(field, buffer, genTypeSize(fieldType)))
38733873
{
38743874
GenTree* cnsValue = impImportCnsTreeFromBuffer(buffer, fieldType);
38753875
if (cnsValue != nullptr)
@@ -3899,7 +3899,7 @@ GenTree* Compiler::impImportStaticReadOnlyField(CORINFO_FIELD_HANDLE field, CORI
38993899
}
39003900

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

3952-
JITDUMP("getReadonlyStaticFieldValue returned false - bail out.");
3952+
JITDUMP("getStaticFieldContent returned false - bail out.");
39533953
return nullptr;
39543954
}
39553955

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

3983-
if ((totalSize > bufferSize) || !info.compCompHnd->getReadonlyStaticFieldValue(field, buffer, totalSize))
3983+
if ((totalSize > bufferSize) || !info.compCompHnd->getStaticFieldContent(field, buffer, totalSize))
39843984
{
39853985
return nullptr;
39863986
}

0 commit comments

Comments
 (0)