Delete VersionsWithType check from embedClassHandle#116808
Delete VersionsWithType check from embedClassHandle#116808jkotas wants to merge 1 commit intodotnet:mainfrom
Conversation
It should not be needed. Also, embedClassHandle alternative in embedGenericHandle does not have this check.
There was a problem hiding this comment.
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
RequiresRuntimeJitExceptionwhen a type wasn’t inVersionsWithType - Streamlined
embedClassHandleto 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). |
davidwrighton
left a comment
There was a problem hiding this comment.
@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.
Is this a similar kind of versions-with check, or something more involved? |
|
I have spent some time trying to construct a repro that fails with this change. I was not able to construct one. Guarded devirtualization kicks in only after a method gets devirtualized successfully. Devirtualization in crossgen has number of versioning checks that abort devirtualization. In particular, @davidwrighton Am I missing some detail? |
It should not be needed. Also, embedClassHandle alternative in embedGenericHandle does not have this check.