@@ -2206,25 +2206,6 @@ static int32_t GetLdindForType(InterpType interpType)
22062206 return -1 ;
22072207}
22082208
2209- static bool DoesValueTypeContainGCRefs (COMP_HANDLE compHnd, CORINFO_CLASS_HANDLE clsHnd)
2210- {
2211- unsigned size = compHnd->getClassSize (clsHnd);
2212- // getClassGClayout assumes it's given a buffer of exactly this size
2213- unsigned maxGcPtrs = (size + sizeof (void *) - 1 ) / sizeof (void *);
2214- BYTE *gcLayout = (BYTE *)alloca (maxGcPtrs + 1 );
2215- uint32_t numSlots = compHnd->getClassGClayout (clsHnd, gcLayout);
2216-
2217- for (uint32_t i = 0 ; i < numSlots; ++i)
2218- {
2219- if (gcLayout[i] != TYPE_GC_NONE)
2220- {
2221- return true ;
2222- }
2223- }
2224-
2225- return false ;
2226- }
2227-
22282209bool InterpCompiler::EmitNamedIntrinsicCall (NamedIntrinsic ni, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO sig)
22292210{
22302211 bool mustExpand = (method == m_methodHnd);
@@ -2320,13 +2301,9 @@ bool InterpCompiler::EmitNamedIntrinsicCall(NamedIntrinsic ni, CORINFO_CLASS_HAN
23202301 case NI_System_Runtime_CompilerServices_RuntimeHelpers_IsReferenceOrContainsReferences:
23212302 {
23222303 CORINFO_CLASS_HANDLE clsHnd = sig.sigInst .methInst [0 ];
2323- bool isValueType = (m_compHnd->getClassAttribs (clsHnd) & CORINFO_FLG_VALUECLASS) != 0 ;
2324- bool hasGCRefs = false ;
2325-
2326- if (isValueType)
2327- {
2328- hasGCRefs = DoesValueTypeContainGCRefs (m_compHnd, clsHnd);
2329- }
2304+ uint32_t clsAttribs = m_compHnd->getClassAttribs (clsHnd);
2305+ bool isValueType = (clsAttribs & CORINFO_FLG_VALUECLASS) != 0 ;
2306+ bool hasGCRefs = (clsAttribs & CORINFO_FLG_CONTAINS_GC_PTR) != 0 ;
23302307
23312308 int32_t result = (!isValueType || hasGCRefs) ? 1 : 0 ;
23322309
0 commit comments