Skip to content
Merged
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
12 changes: 11 additions & 1 deletion src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3898,8 +3898,18 @@ uint32_t CEEInfo::getClassAttribsInternal (CORINFO_CLASS_HANDLE clsHnd)
if (pMT->IsByRefLike())
ret |= CORINFO_FLG_BYREF_LIKE;

if (pClass->IsUnsafeValueClass())
// In Reverse P/Invoke stubs, we are generating the code
// and we are not generating the code patterns that the GS checks
// are meant to catch.
// As a result, we can skip setting this flag.
// We do this as the GS checks (emitted when this flag is set)
// can break C++/CLI's copy-constructor semantics by missing copies.
if (pClass->IsUnsafeValueClass()
&& !(m_pMethodBeingCompiled->IsILStub()
&& dac_cast<PTR_DynamicMethodDesc>(m_pMethodBeingCompiled)->GetILStubType() == DynamicMethodDesc::StubNativeToCLRInterop))
{
ret |= CORINFO_FLG_UNSAFE_VALUECLASS;
}
}
if (pClass->HasExplicitFieldOffsetLayout() && pClass->HasOverlaidField())
ret |= CORINFO_FLG_OVERLAPPING_FIELDS;
Expand Down