-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Avoid CORINFO_..._HANDLEs in JIT helper signatures #116675
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
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 pull request updates several JIT helper signatures and related functions to avoid using CORINFO_..._HANDLE types in favor of more explicit type‐safe parameters. Key changes include:
- Removing and replacing the use of CORINFO_MODULE_HANDLE and CORINFO_CLASS_HANDLE with Module*, EnregisteredTypeHandle, or equivalent types.
- Updating return types and parameter types of functions such as GenericHandleWorkerCore, JIT_GetClassFromMethodParam, and GenericHandleCommon.
- Adjusting helper functions in both core JIT interface and interpreter implementations to ensure consistency with the new type usage.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/coreclr/vm/jitinterface.h | Removal of ConstructStringLiteral declaration to avoid exposing CORINFO_ handles. |
src/coreclr/vm/jitinterface.cpp | Local variable rename and direct use of Module::ResolveStringRef for clarity. |
src/coreclr/vm/jithelpers.cpp | Function signatures updated to replace CORINFO_ handles with EnregisteredTypeHandle and MethodDesc*. |
src/coreclr/vm/interpexec.cpp | Updated type conversions and function signatures to reflect new handle types. |
src/coreclr/vm/appdomainnative.hpp/.cpp | Adjusted the String_StrCns API to use Module* consistently. |
Comments suppressed due to low confidence (6)
src/coreclr/vm/jitinterface.h:1029
- The removal of ConstructStringLiteral from the public header is consistent with avoiding CORINFO_ handles; ensure that all internal references now use the updated approach.
STRINGREF* ConstructStringLiteral(CORINFO_MODULE_HANDLE scopeHnd, mdToken metaTok, void** ppPinnedString = nullptr);
src/coreclr/vm/jitinterface.cpp:12082
- The change to use Module::ResolveStringRef directly (with the renamed pPinnedString) aligns with the PR's goal; please verify that all internal usages are consistent.
STRINGREF* ptr = ((Module*)scopeHnd)->ResolveStringRef(metaTok, &pPinnedString);
src/coreclr/vm/jithelpers.cpp:540
- Changing the return type from CORINFO_GENERIC_HANDLE to DictionaryEntry should be verified against all call sites to ensure that the new type is handled correctly.
DictionaryEntry GenericHandleWorkerCore(MethodDesc * pMD, MethodTable * pMT, LPVOID signature, DWORD dictionaryIndexAndSlot, Module* pModule)
src/coreclr/vm/jithelpers.cpp:767
- Updating JIT_GetClassFromMethodParam to accept a MethodDesc* parameter instead of a CORINFO_METHOD_HANDLE is in line with eliminating CORINFO_ handles; please ensure this change is compatible with all callers.
HCIMPL1(EnregisteredTypeHandle, JIT_GetClassFromMethodParam, MethodDesc* pMD)
src/coreclr/vm/interpexec.cpp:136
- Changing GenericHandleCommon's return type from CORINFO_GENERIC_HANDLE to void* requires verification that all usages correctly handle the new return type.
void* GenericHandleCommon(MethodDesc * pMD, MethodTable * pMT, LPVOID signature)
src/coreclr/vm/appdomainnative.hpp:19
- Updating the parameter of String_StrCns to accept a Module* instead of a CORINFO_MODULE_HANDLE fulfills the PR goal; confirm that all invocations pass a valid Module pointer.
extern "C" STRINGREF* QCALLTYPE String_StrCns(UINT32 rid, Module* pModule);
Tagging subscribers to this area: @mangod9 |
// ppPinnedString: If the string is pinned (e.g. allocated in frozen heap), | ||
// the pointer to the pinned string is returned in *ppPinnedPointer. ppPinnedPointer == nullptr | ||
// means that the caller does not care whether the string is pinned or not. | ||
STRINGREF* ConstructStringLiteral(CORINFO_MODULE_HANDLE scopeHnd, mdToken metaTok, void** ppPinnedString = nullptr); |
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.
Unnecessary wrapper
src/coreclr/vm/jitinterface.cpp
Outdated
@@ -12078,12 +12078,12 @@ InfoAccessType CEECodeGenInfo::constructStringLiteral(CORINFO_MODULE_HANDLE scop | |||
else | |||
{ | |||
// If ConstructStringLiteral returns a pinned reference we can return it by value (IAT_VALUE) |
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.
comment outdated now
CORINFO_..._HANDLEs are meant to be JIT/EE interface abstraction. Using them in JIT helper signatures causes confusion.
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.
LGTM, thank you!
CORINFO_..._HANDLEs are meant to be JIT/EE interface abstraction. Using them in JIT helper signatures causes confusion.