Skip to content

Delete VersionsWithType check from embedClassHandle #116808

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jun 19, 2025

It should not be needed. Also, embedClassHandle alternative in embedGenericHandle does not have this check.

It should not be needed. Also, embedClassHandle alternative in embedGenericHandle does not have this check.
@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 06:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the unnecessary VersionsWithType check and associated exception from embedClassHandle to align its behavior with embedGenericHandle.

  • Deleted the guard that threw RequiresRuntimeJitException when a type wasn’t in VersionsWithType
  • Streamlined embedClassHandle to always emit a ready-to-run helper for the type handle
Comments suppressed due to low confidence (1)

src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs:2739

  • With the removal of the VersionsWithType guard, add tests covering cases where a type previously would have failed this check to ensure that embedClassHandle still behaves correctly without requiring a runtime JIT.
            TypeDesc type = HandleToObject(handle);

@jkotas
Copy link
Member Author

jkotas commented Jun 19, 2025

Context: #116651

@jkotas
Copy link
Member Author

jkotas commented Jun 19, 2025

@jkotas
Copy link
Member Author

jkotas commented Jun 19, 2025

/azp run runtime-coreclr crossgen2 outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@davidwrighton davidwrighton left a comment

Choose a reason for hiding this comment

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

@jkotas, yes this is needed for PGO scenarios. Notably, there is a problem where we can identify via PGO that a particular path is most desireable, and devirtualize, but if the devirtualization target isn't within the current version bubble, we cannot safely do a devirtualize. If we make this change(which I think makes sense, we need to adjust the devirtualization logic to explicitly check that it is only devirtualizing types which are safe to do so.

We don't have good coverage for this sort of scenario in any of our test suites, so actually writing the test case would be a good to have although decidedly tricky to do.

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