-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix passing class handle to RuntimeTypeHandle.GetRuntimeTypeFromHandle for synchronized methods #117675
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
Conversation
…le for synchronized methods - use method class handle
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 fixes a bug where synchronized methods in collectible assemblies were passing an invalid handle to RuntimeTypeHandle.GetRuntimeTypeFromHandle
, causing NullReferenceException
. The fix simplifies the code by removing the getMethodSync
JIT interface method and directly using the class handle instead.
- Removes the
getMethodSync
method from the JIT interface, which was only used for synchronized methods - Changes the JIT code generation to directly use the method's class handle with
CORINFO_HELP_GETSYNCFROMCLASSHANDLE
- Adds a regression test to verify synchronized methods work correctly in collectible assembly load contexts
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/coreclr/jit/flowgraph.cpp | Updated code generation to use class handle directly instead of calling getMethodSync |
src/coreclr/inc/corinfo.h | Removed getMethodSync method declaration from ICorDynamicInfo interface |
src/coreclr/vm/jitinterface.h | Removed getMethodSync method declaration from CEECodeGenInfo class |
src/coreclr/vm/jitinterface.cpp | Removed getMethodSync implementation and GetClassSync helper function |
src/coreclr/inc/jiteeversionguid.h | Updated JIT-EE interface version GUID due to interface change |
src/tests/JIT/Regression/JitBlue/Runtime_117566/Runtime_117566.cs | Added regression test for synchronized methods in collectible assemblies |
src/tests/JIT/Regression/JitBlue/Runtime_117566/Runtime_117566.csproj | Test project configuration |
Multiple generated files | Updated to remove getMethodSync from various JIT interface implementations |
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
….csproj Co-authored-by: Jan Kotas <jkotas@microsoft.com>
/ba-g timeout: #117669 |
After #107667, synchronized methods in collectible assemblies were passing an invalid handle as the class handle to
RuntimeTypeHandle.GetRuntimeTypeFromHandle
(callingCORINFO_HELP_GETSYNCFROMCLASSHANDLE
).getMethodSync
from JIT interface - it was only used in this one place where we actually need the class handleResolves #117566
cc @dotnet/jit-contrib @jkotas @janvorli @davidwrighton