Skip to content

Commit

Permalink
Don't call HasCustomModifier when the argument type is something norm…
Browse files Browse the repository at this point in the history
…alized to ELEMENT_TYPE_PTR or ELEMENT_TYPE_BYREF (#108610)
  • Loading branch information
jkoritzinsky authored Oct 7, 2024
1 parent ba28992 commit 46f3c10
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9539,7 +9539,17 @@ CorInfoTypeWithMod CEEInfo::getArgType (
FALLTHROUGH;

case ELEMENT_TYPE_BYREF:
IfFailThrow(ptr.GetElemType(NULL));
// PeekElemTypeClosed above normalized ELEMENT_TYPE_INTERNAL back to the underlying type handle's signature representation.
// This normalization can also occur for generic instantiatations, but we don't support pointer or byref types
// as generic arguments.
// All of the element types that can be normalized above can't have custom modifiers embedded in this location,
// so we don't need to check for them here.
CorElementType nonNormalizedType;
IfFailThrow(ptr.GetElemType(&nonNormalizedType));
if (type != nonNormalizedType)
{
break;
}
if (ptr.HasCustomModifier(pModule, "Microsoft.VisualC.NeedsCopyConstructorModifier", ELEMENT_TYPE_CMOD_REQD) ||
ptr.HasCustomModifier(pModule, "System.Runtime.CompilerServices.IsCopyConstructed", ELEMENT_TYPE_CMOD_REQD))
{
Expand Down

0 comments on commit 46f3c10

Please sign in to comment.