Repository navigation
Labels
area-VM-coreclrin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
Benefits:
- Performance: QCalls are generally faster than FCalls with HELPER_METHOD_FRAME
- Eliminate duplication: These are redundant mechanism. Once all of them are converted, we can eliminate the duplication.
- Complexity of stackwalking algorithm: HELPER_METHOD_FRAMEs make the stackwalking algorithm with all its dependencies more complicated than it needs to be. (See nibblemapmacros do a linear scan #93550 for more context.)
- We want to work towards unification of CoreCLR stackwalker and native AOT stackwalker. Native AOT has much simpler stackwalker and it does not have HELPER_METHOD_FRAMEs.
Work
List of JIT helpers that need the removal of explicit HMFs:
-
JIT_GetFieldAddr_Framed,JIT_NewMDArrRemove HMFs from JIT helpers #111034 -
JIT_NewShare allocation helpers between CoreCLR and NativeAOT #115339 -
JIT_NewMaybeFrozenShare allocation helpers between CoreCLR and NativeAOT #115339 -
FramedAllocateStringShare allocation helpers between CoreCLR and NativeAOT #115339 -
JIT_StrCnsConvert JitHelperJIT_StrCnsto QCall #113674 -
JIT_NewArr1Share allocation helpers between CoreCLR and NativeAOT #115339 -
JIT_NewArr1MaybeFrozenShare allocation helpers between CoreCLR and NativeAOT #115339 -
JIT_BoxConvert JIT_Box* to C# #115134 -
JIT_StressGC,JIT_GetRuntimeFieldStub,JIT_GetRuntimeMethodStubRemove HMFs from JIT helpers #111088 -
JIT_UserBreakpointJIT_GetRuntimeType_FramedRemove HMFs from JIT helpers #111134 -
JIT_MonEnter_HelperRemove helper method frames from Monitors #113242 -
JIT_MonTryEnter_HelperRemove helper method frames from Monitors #113242 -
JIT_MonExit_HelperRemove helper method frames from Monitors #113242 -
JIT_MonExit_SignalRemove helper method frames from Monitors #113242 -
IL_Throw,IL_RethrowRemove HMF from IL_Throw/IL_ThrowExact/IL_Rethrow #115253 -
JIT_ThrowMethodAccessException,JIT_ThrowFieldAccessException,JIT_ThrowClassAccessExceptionRemove HMFs from JIT helpers #111075 -
JIT_PollGC_FramedGc enter/leave/poll without HELPER_METHOD_FRAME #109378 -
JIT_PInvokeEndRarePathGc enter/leave/poll without HELPER_METHOD_FRAME #109378 -
JIT_RareDisableHelper/JIT_RareDisableHelperWorkerGc enter/leave/poll without HELPER_METHOD_FRAME #109378 -
JIT_Patchpoint_FramedReplace HELPER_METHOD_FRAME with DynamicHelperFrame in patchpoints #112025 -
JIT_PartialCompilationPatchpointReplace HELPER_METHOD_FRAME with DynamicHelperFrame in patchpoints #112025
List of JIT helpers with implicit HMFs through a use of FCThrow.
-
JIT_Div,JIT_Mod,JIT_UDiv,JIT_UMod,JIT_LDiv,JIT_LMod,JIT_ULDiv,JIT_ULMod- Move arithmetic helpers to managed code #109087 or Alternate approach for HELPER_METHOD_FRAME removal for arithmetic div… #113286
Remove all remaining explicit calls to GCPoll (that is, FC_GC_POLL and FC_GC_POLL_RET):
-
Buffer::BulkMoveWithWriteBarrier,GCInterface::SuppressFinalize,GCInterface::GetGenerationInternal,GCInterface::GetSegmentSize,GCInterface::CollectionCount,ObjectNative::ContentEquals- Remove all explicit GC Poll calls in unmanaged code. #113715
The following clean-up can occur after all the above is complete:
- Removal of any
HELPER_METHOD_FRAMErelated infrastrcture infcall.handfcall.cppCleanup HMF definitions #116085 - Update BoTR to remove description of the
HELPER_METHOD_FRAMEconcept. Cleanup HMF definitions #116085
Reacted by Adeel Mujahid, Paulus Pärssinen, David Wrighton, Igor Bagdamyan, Zagrthos, Simon Felix, Pent Ploompuu, hendrik and Rogier van der Hee
Reacted by Jeremy Koritzinsky
Metadata
Metadata
Assignees
Labels
area-VM-coreclrin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Activity
hughbe commentedon Dec 6, 2023
This is cool! Is the plan to eventually remove FCall functionality from the runtime?
danmoseley commentedon Dec 6, 2023
Good to see you around here again @hughbe! 😀
jkotas commentedon Dec 6, 2023
FCalls with HELPER_METHOD_FRAME. I think FCalls without HELPER_METHOD_FRAME are needed for perf reasons.
davidwrighton commentedon Dec 6, 2023
I think we also might be able to move to QCalls with SuppressGCTransition instead of FCalls without HELPER_METHOD_FRAME for the perf critical ones, but that's a bridge to examine and consider crossing once we've removed HELPER_METHOD_FRAME from the situation.
jkotas commentedon Dec 7, 2023
I agree. It would require modifying rules for how GC tracked pointers are passed to and from P/Invokes and we would need to deal with managed/unmanaged calling convention differences somehow. I think it would be just a cosmetic change at the end. It would not be a significant simplification of the system (compared to getting rid of HELPER_METHOD_FRAMEs).
Remove uses of FCThrow in interlocked helpers
13 remaining items
AaronRobinsonMSFT commentedon Dec 17, 2024
See #110767 for some additional context/notes.
AaronRobinsonMSFT commentedon Dec 17, 2024
From: #110767 (comment)
@am11 Agree. The goal for any converted HCalls, likely needed in assembly, is that they could be shared with native AOT.
Yep, the
JIT_PatchpointcallsJIT_Patchpoint_Framed. This is a common pattern when an FCall/HCall was frameless and then it needs one to perform a throwable or GC action, a new function was written with the_Framedor_Helpersuffix and called.am11 commentedon May 3, 2025
IL_Throw,IL_RethrowandJIT_Boxcan be checked.filipnavara commentedon May 5, 2025
Just a heads up, I will submit a PR to convert the allocation helpers soon. I have about half of the platforms done.
AaronRobinsonMSFT commentedon May 5, 2025
@filipnavara That is great news. Thanks!
Share allocation helpers between CoreCLR and NativeAOT (#115339)
filipnavara commentedon Jun 3, 2025
We are one PR away from wrapping up this effort!
Cleanup HMF definitions (dotnet#116085)