Skip to content

Commit

Permalink
Merge pull request dotnet#146 from janvorli/fix-crossgen2-devirt
Browse files Browse the repository at this point in the history
Fix devirtualization in crossgen2
  • Loading branch information
janvorli authored Nov 21, 2019
2 parents 028c433 + e70db4c commit 5e5a0d4
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ protected virtual MethodDesc ResolveVirtualMethod(MethodDesc declMethod, DefType
else
{
impl = implType.FindVirtualFunctionTargetMethodOnObjectType(declMethod);
if (impl != null && (impl != declMethod))
{
MethodDesc slotDefiningMethodImpl = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(impl);
MethodDesc slotDefiningMethodDecl = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(declMethod);

if (slotDefiningMethodImpl != slotDefiningMethodDecl)
{
// We cannot resolve virtual method in case the impl is a different slot from the declMethod
impl = null;
}
}
}

return impl;
Expand Down

0 comments on commit 5e5a0d4

Please sign in to comment.