Skip to content

Conversation

@davidwrighton
Copy link
Member

  • Multi-thread handling of UnboxingMethodDesc was incorrect. It would result in incorrect caching of fixups to unboxing methods. This would cause asserts and determinism failures.
  • ldtoken of a static method on a valuetype should not refer to an unboxing stub, This is unlikely to cause a failure, but will cause asserts to fire

… with debug build of compiler

- Multi-thread handling of UnboxingMethodDesc was incorrect. It would result in incorrect caching of fixups to unboxing methods
- ldtoken of a static method on a valuetype should not refer to an unboxing stub
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.

Looks great, thanks for fixing!

@trylek trylek merged commit 8edd202 into dotnet:master Apr 12, 2020
@MichalStrehovsky
Copy link
Member

Per the comment for the UnboxingMethodDesc:

    /// This class is for internal purposes within the JitInterface. It's not expected
    /// for it to escape the JitInterface.

Is this MethodDesc escaping the local CorInfoImpl class?

I don't think the rest of the system is prepared to handle a MethodDesc to an unboxing method. We explicitly designed the type system not to have a unboxing MethodDesc (and @davidwrighton was one of the proponents of that approach). I don't think the rest of the system is prepared to handle seeing it and we really don't want it to escape. We only have unboxing MethodDescs as a local wart so that we can hand something to RyuJIT while compiling a method and it's supposed to go away after.

CorInfoImpl is expected to unwrap it into things the rest of the system can handle (a bool specifying whether this is an unboxing thunk - like most of crossgen2 is doing). The fact that this is not happening sounds like the bug we should fix instead of introducing a static holding onto type system object. I really wish there was a Roslyn analyzer to block static fields - we should never have statics holding onto type system objects.

Can you please CC crossgen-contrib on crossgen2 changes in the future?

@davidwrighton
Copy link
Member Author

It IS escaping the CorInfoImpl class. I had forgotten about that portion of the design. We should open a bug and fix the problem.

@MichalStrehovsky
Copy link
Member

We should open a bug and fix the problem.

Filed #35531.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
@davidwrighton davidwrighton deleted the fix_crossgen2_asserts branch April 20, 2021 17:42
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.

4 participants