-
Notifications
You must be signed in to change notification settings - Fork 5k
Intrinsic support for transient codegen. #115639
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
Intrinsic support for transient codegen. #115639
Conversation
The previous transient codegen paths only handled lifetime management when the method had no metadata back IL (that is, RVA == 0). The InstanceCalli logic is marked as an intrinsic and has metadata, but that metadata is copied and then modified falling back to a middle ground that the existing logic didn't handle properly. The tricky scenario is when these new instrinsic types were inlined (lifetimes were being ignored). This change fixes that up but did require a bit of clean-up in the UnsafeJitFunction as it relates to the JIT and interpreter interaction.
Tagging subscribers to this area: @mangod9 |
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 adds intrinsic support for transient codegen by consolidating method-info retrieval into a new worker function, renaming the helper context, and refactoring the JIT/interpreter code path to handle transient lifetimes and jump-stub overflow more cleanly.
- Rename
MethodInfoHelperContext
toMethodInfoWorkerContext
and unify handling ingetMethodInfoWorker
. - Refactor
UnsafeJitFunctionWorker
andUnsafeJitFunction
to useMethodInfoWorkerContext
and introduceJumpStubOverflowCheck
. - Remove legacy debug buffers and simplify constructor signatures by removing default parameters.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/coreclr/vm/jitinterface.h | Forward-declare MethodInfoWorkerContext , replace getTransientMethodInfo with getMethodInfoWorker , update ctor signatures |
src/coreclr/vm/jitinterface.cpp | Rename helper class, implement getMethodInfoWorker , remove old transient logic, add JumpStubOverflowCheck , refactor UnsafeJitFunction |
Comments suppressed due to low confidence (4)
src/coreclr/vm/jitinterface.cpp:7497
- The new
getMethodInfoWorker
path, including transient-method handling and inlining logic, isn't covered by existing tests. Add unit or integration tests to validate behavior for both metadata-backed and transient IL methods.
void CEEInfo::getMethodInfoWorker(
src/coreclr/vm/jitinterface.cpp:13446
- [nitpick] The retry loop in
UnsafeJitFunction
useswhile(true)
withcontinue
, which can obscure control flow. Consider ado { ... } while (overflowDetected)
pattern or an explicit retry label to improve readability.
while (true)
src/coreclr/vm/jitinterface.cpp:13314
- The static flag
g_fAllowRel32
is mutated byDetected()
without synchronization, leading to potential race conditions in multi-threaded JIT scenarios. Consider using thread-local storage or a lock to guard modifications.
BOOL JumpStubOverflowCheck::g_fAllowRel32 = TRUE;
src/coreclr/vm/jitinterface.h:520
- Removing the default
allowInlining = true
parameter in these constructors changes their API and may break existing call sites. Verify all callers have been updated or restore the default to preserve backward compatibility.
CEECodeGenInfo(MethodDesc* fd, COR_ILMETHOD_DECODER* header, EECodeGenManager* jm, bool allowInlining)
The failure looks related
|
/azp list |
/azp run runtime-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
Please fix the typo in the title of the PR before merging ;-) |
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.
Thank you!
/ba-g Unrelated CoreCLR Android timeout. |
The previous transient codegen paths only handled lifetime management when the method had no metadata back IL (that is, RVA == 0). The InstanceCalli scenario creates intrinsic methods which have metadata, but that metadata is copied and then modified falling into a middle ground that the existing logic didn't handle properly. The tricky scenario is when these new instrinsic types were inlined (lifetimes were being ignored). This change fixes that up but did require a bit of clean-up in the
UnsafeJitFunction
as it relates to the JIT and interpreter interaction.Fixes #115429