-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Convert all FCalls with HELPER_METHOD_FRAME to QCalls #95695
Comments
This is cool! Is the plan to eventually remove FCall functionality from the runtime? |
Good to see you around here again @hughbe! 😀 |
FCalls with HELPER_METHOD_FRAME. I think FCalls without HELPER_METHOD_FRAME are needed for perf reasons. |
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. |
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). |
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix dotnet#95695.
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix #95695.
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix dotnet#95695.
I believe this was closed unintentionally 😄 In addition, I'd like to see some documentation about the more and more unmanaged-like unsafe code in CoreLib. I'm still learning and trying case by case. |
What would you like to see? The documentation about QCalls and related topics is in https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/botr/corelib.md . |
The existing documentation is about "manual managed" code. Nowadays there are more "manual unmanaged" code in CoreLib, for example, dealing with MethodTable and manipulating GC refs as bytes. |
Feel free to propose documentation update in a PR. The examples do not look unique to CoreLib. MethodTable is an example of an unmanaged resource with lifetime associated with managed object. These situations occur in interop quite frequently. GC.KeepAlive documentation has an example with COM. |
The managed side was deleted in 2017: dotnet/coreclr@ee5862c#diff-f3cc002d15620a31440d8091873e5a2eff9f0223cd11cce621eb1eb1efda52c2 Contributes a little to dotnet#95695
The managed side was deleted in 2017: dotnet/coreclr@ee5862c#diff-f3cc002d15620a31440d8091873e5a2eff9f0223cd11cce621eb1eb1efda52c2 Contributes a little to #95695
This has a similar structure to FailFast as converted in dotnet#98908. Contributes to dotnet#95695
* Convert GetCurrentMethod to QCALL This has a similar structure to FailFast as converted in #98908. Contributes to #95695 * Simplify code for QCALL Co-authored-by: Jan Kotas <[email protected]> --------- Co-authored-by: Jan Kotas <[email protected]>
Below is a list of various PRs that can be referenced that demonstrate this effort across multiple authors and releases. #70000, #70055, #71873, #87166, #95038, #96926, #97590, #100116, #101353, #106793, #107058, #107218, #107648, #108167, #109135, #109996, #110064, #110211, #110377, #110481, #110627, #110766 |
See #110767 for some additional context/notes. |
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 |
Benefits:
Work
List of JIT helpers that need the removal of explicit HMFs:
JIT_GetFieldAddr_Framed
JIT_New
JIT_NewMaybeFrozen
FramedAllocateString
JIT_StrCns
JIT_NewArr1
JIT_NewArr1MaybeFrozen
JIT_NewMDArr
JIT_Box
JIT_GetRuntimeFieldStub
JIT_GetRuntimeMethodStub
JIT_GetRuntimeType_Framed
JIT_MonEnter_Helper
JIT_MonTryEnter_Helper
JIT_MonExit_Helper
JIT_MonExit_Signal
IL_Throw
IL_Rethrow
JIT_ThrowMethodAccessException
JIT_ThrowFieldAccessException
JIT_ThrowClassAccessException
JIT_UserBreakpoint
JIT_PollGC_Framed
JIT_PInvokeEndRarePath
JIT_RareDisableHelper
/JIT_RareDisableHelperWorker
JIT_StressGC
JIT_Patchpoint_Framed
JIT_PartialCompilationPatchpoint
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 #109087The following clean-up can occur after all the above is complete:
fcall.h
andfcall.cpp
The text was updated successfully, but these errors were encountered: