Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
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
3 changes: 3 additions & 0 deletions src/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,9 @@ enum CORINFO_FIELD_ACCESSOR

CORINFO_FIELD_INTRINSIC_ZERO, // intrinsic zero (IntPtr.Zero, UIntPtr.Zero)
CORINFO_FIELD_INTRINSIC_EMPTY_STRING, // intrinsic emptry string (String.Empty)
#if COR_JIT_EE_VERSION > 460
CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN, // intrinsic BitConverter.IsLittleEndian
#endif
};

// Set of flags returned in CORINFO_FIELD_INFO::fieldFlags
Expand Down
14 changes: 14 additions & 0 deletions src/jit/importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13263,6 +13263,20 @@ void Compiler::impImportBlockCode(BasicBlock* block)
}
break;

#if COR_JIT_EE_VERSION > 460
case CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN:
{
assert(aflags & CORINFO_ACCESS_GET);
#if BIGENDIAN
op1 = gtNewIconNode(0, lclTyp);
#else
op1 = gtNewIconNode(1, lclTyp);
#endif
goto FIELD_DONE;
}
break;
#endif

default:
assert(!"Unexpected fieldAccessor");
}
Expand Down
5 changes: 5 additions & 0 deletions src/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,11 @@ static CORINFO_FIELD_ACCESSOR getFieldIntrinsic(FieldDesc * field)
{
return CORINFO_FIELD_INTRINSIC_ZERO;
}
else
if (MscorlibBinder::GetField(FIELD__BITCONVERTER__ISLITTLEENDIAN) == field)
{
return CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN;
}

return (CORINFO_FIELD_ACCESSOR)-1;
}
Expand Down
2 changes: 2 additions & 0 deletions src/vm/mscorlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,8 @@ DEFINE_FIELD(INTPTR, ZERO, Zero)
// DEFINE_CLASS(UINTPTR, System, UIntPtr)
DEFINE_FIELD(UINTPTR, ZERO, Zero)

DEFINE_CLASS(BITCONVERTER, System, BitConverter)
DEFINE_FIELD(BITCONVERTER, ISLITTLEENDIAN, IsLittleEndian)
// Defined as element type alias
// DEFINE_CLASS(STRING, System, String)
DEFINE_FIELD(STRING, M_FIRST_CHAR, m_firstChar)
Expand Down
1 change: 1 addition & 0 deletions src/zap/zapinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,7 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,

case CORINFO_FIELD_INTRINSIC_ZERO:
case CORINFO_FIELD_INTRINSIC_EMPTY_STRING:
case CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN:
break;

default:
Expand Down