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

Open types can exist as entries in interface map #55372

Merged
merged 2 commits into from
Jul 13, 2021

Conversation

davidwrighton
Copy link
Member

  • While invalid via the ECMA spec, the runtime currently represents a type explicitly instantiated over its own generic type parameters via the open type MethodTable
  • This is not strictly correct, as per the spec, these should be represented via an instantiated type, but changing that detail at this time is considered highly risky
  • This conflicts with the perf optimization around partial interface loading which uses the open type of an interface to represent a type instantiated in the curiously recurring fashion.
  • The fix is to detect types instantiated over generic variables, and make them ineligible for the optimization, and to detect those cases where the optimization is ineligible, and revert back to the non-optimized behavior

Fixes #55323

- While invalid via the ECMA spec, the runtime currently represents a type explicitly instantiated over its own generic type parameters via the open type MethodTable
- This is not strictly correct, as per the spec, these should be represented via an instantiated type, but changing that detail at this time is considered highly risky
- This conflicts with the perf optimization around partialy interface loading which uses the open type of an interface to represent a type instantiated in the curiously recurring fashion.
- The fix is to detect types instantiated over generic variables, and make them ineligible for the optimization, and to detect those cases where the optimization is ineligible, and revert back to the non-optimized behavior

Fixes dotnet#55323
Copy link
Member

@trylek trylek left a comment

Choose a reason for hiding this comment

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

OMG, that's pretty awful, thanks for fixing this!

@davidwrighton
Copy link
Member Author

Hmm, well, that seems to have caused more problems. I'll have a fix put together for Tuesday.

@NinoFloris
Copy link
Contributor

This is not strictly correct, as per the spec, these should be represented via an instantiated type, but changing that detail at this time is considered highly risky

Should this be tracked to be fixed in a future version?

@davidwrighton
Copy link
Member Author

@NinoFloris Well, the issue that we know of is actually to the runtime internal data structures. Those are not actually visible to customers in a direct fashion. From what I can see, we may have a bug around looking at via reflection the set of interfaces on the open type of one of the types in the new test. However, we've had 16 years with the existing behavior, and no-one has ever noticed. In general, we don't track fixing/identifiying precisely this sort of spec violation without some known impact to a customer.

@NinoFloris
Copy link
Contributor

I understand and from that viewpoint you're probably right if it hasn't come up before. I can only speculate about the potential perf lost by barring these types from this optimization and maybe it's irrelevant :)

@davidwrighton davidwrighton merged commit 002370b into dotnet:main Jul 13, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 12, 2021
@davidwrighton davidwrighton deleted the fix_55323 branch April 13, 2023 18:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet hang in JIT
3 participants