-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
base: main
Are you sure you want to change the base?
Conversation
It should not be needed. Also, embedClassHandle alternative in embedGenericHandle does not have this check.
There was a problem hiding this 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 inVersionsWithType
- 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);
Context: #116651 |
@davidwrighton This was introduced in https://github.com/dotnet/runtime/pull/51284/files#diff-01e22eff46505ee20d75dd64c72a9eb57d67f28f22a76258300bbe44dca59a14R2168-R2169 . Is there a reason why this check is needed for PGO? |
/azp run runtime-coreclr crossgen2 outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this 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.
It should not be needed. Also, embedClassHandle alternative in embedGenericHandle does not have this check.