Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine nearby loops to prevent crash building dotnet/runtime #46980

Closed
wants to merge 1 commit into from

Conversation

RikkiGibson
Copy link
Contributor

@RikkiGibson RikkiGibson commented Aug 19, 2020

Related to #46575 (not closing till we are able to root-cause and make sure we have a tracking issue in the appropriate place).

I have verified locally that this resolves the crash when building dotnet/runtime. It's somewhat inconvenient to publish this build where dotnet/runtime can readily consume it, so I won't be able to verify in CI until after this is merged to master-vs-deps.

We currently believe this is working around a JIT bug.

@RikkiGibson RikkiGibson marked this pull request as ready for review August 20, 2020 15:38
@RikkiGibson RikkiGibson requested a review from a team as a code owner August 20, 2020 15:38

MethodSymbol uniqueClassOverride = null;
foreach (MethodSymbol method in explicitlyOverriddenMethods)
{
if (method.ContainingType.IsClassType())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if [](start = 24, length = 2)

else if

@cston
Copy link
Member

cston commented Aug 20, 2020

                            break;

We're skipping any trailing explicit interface implementations. Is that an issue? Consider adding a test.


Refers to: src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs:1233 in fd91c43. [](commit_id = fd91c43, deletion_comment = False)

@@ -1242,6 +1237,8 @@ public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations
}
}

explicitInterfaceImplementations = explicitInterfaceImplementationsBuilder.ToImmutableAndFree();
Copy link
Member

@cston cston Aug 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicitInterfaceImplementations [](start = 20, length = 32)

Would it be easier to remove the loop entirely from the method, to avoid the complexity of handling both in the same loop:

explicitInterfaceImplementations = explicitlyOverriddenMethods.WhereAsArray(
    m => m.ContainingType.IsInterface);
MethodSymbol uniqueClassOverride = getUniqueClassOverride(explicitlyOverriddenMethods);

static MethodSymbol getUniqueClassOverride(ImmutableArray<MethodSymbol> explicitlyOverriddenMethods)
{
    ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're skipping any trailing explicit interface implementations. Is that an issue? Consider adding a test.

Refers to: src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEMethodSymbol.cs:1233 in fd91c43. [](commit_id = fd91c43, deletion_comment = False)

Thanks for catching this. I did change semantics by accident. 😉 I am thinking perhaps we should try @davidwrighton's suggestion for now to just apply [MethodImpl(MethodImplOptions.NoOptimization)] to this method as well as perhaps a WorkItem link to track removing it once the related JIT bug is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants