-
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
Cleanup unused JIT stubs in vm #111237
Cleanup unused JIT stubs in vm #111237
Conversation
# <NOTE> | ||
# | ||
# </NOTE> | ||
LEAF_ENTRY JIT_ProfilerEnterLeaveTailcallStub, _TEXT |
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.
UNIX_AMD64 was the only platform not implementing this in ASM.
What's the requirement for this method? Can it be implemented in C for all platforms?
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.
This method has custom calling convention - it has to preserve more register than the default calling convention is guaranteed to preserve. It cannot be implemented in C in general.
I think we just got lucky on UNIX_AMD64 or this profiling scenario is not tested on Unix Amd64.
src/coreclr/vm/i386/excepcpu.h
Outdated
@@ -89,9 +89,9 @@ EXTERN_C LPVOID STDCALL COMPlusEndCatch(LPVOID ebp, DWORD ebx, DWORD edi, DWORD | |||
// RedirectedHandledJITCaseForXXX_Stub's. | |||
// | |||
PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(CONTEXT * pContext); | |||
#ifdef FEATURE_EH_FUNCLETS | |||
#if defined(FEATURE_EH_FUNCLETS) && !defined(TARGET_UNIX) |
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.
Would it be possible to port Windows x86 to new EH in the future?
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.
Yes, it is something we have in our backlog
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.
I think it is better to delete this since there is no implementation.
This method has to more to do with low-level implementation of EH and thread suspension than funclets. If I am reading the code correctly, this method is only called from FixRedirectContextHandler that is only used on Windows x64. It can be probably deleted everywhere else as well.
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.
It can be probably deleted everywhere else as well.
I do plan to delete it on UNIX. Including in this PR should be fine.
For Windows x86, leaving a stub may be useful for future implementation. Deleting it should also be fine because there should be more missing definitions for new EH on Windows x86.
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.
I do not think it will be needed for new EH on Windows x86
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.
It seems that GetFrameFromRedirectedStubStackFrame
and more related code are not used for UNIX.
Before including more, I'd like to confirm that would we ever want them on UNIX?
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.
It seems that FEF comes from initial coreclr commit, and there's intend to eliminate it. Making sure I'm in the right direction.
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.
DISPATCHER_CONTEXT
is a Windows SEH specific type. We try to stay away from building more Windows emulators for Unix, so I do not think that it will be ever needed on Unix.
I would leave FEF alone. I am not sure whether it is a good idea to try to eliminate it.
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.
FEF is still used in stack overflow handler. DISPATCHER_CONTEXT
is also used by a bit more components. I think it's better to keep the scope of this PR.
@@ -5891,7 +5891,7 @@ void FixupDispatcherContext(DISPATCHER_CONTEXT* pDispatcherContext, CONTEXT* pCo | |||
|
|||
pDispatcherContext->ControlPc = (UINT_PTR) GetIP(pDispatcherContext->ContextRecord); | |||
|
|||
#if defined(TARGET_ARM) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64) | |||
#if defined(TARGET_ARM64) |
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.
Nit: It would be nice to change the ifdef around this method to #ifdef TARGET_WINDOWS
to match the rest
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.
Thanks!
498e83c
to
b2b2ebc
Compare
* main: JIT: Model GT_RETURN kills with contained operand (dotnet#111230) Update dependencies from https://github.com/dotnet/runtime-assets build 20250110.2 (dotnet#111290) [NativeAOT/ARM64] Generate frames compatible with Apple compact unwinding (dotnet#107766) Cleanup unused JIT stubs in vm (dotnet#111237) Ensure that Shuffle is marked as HW_Flag_CanBenefitFromConstantProp (dotnet#111303) Fix CMP0173 policy warning with cmake 3.31 (dotnet#110522) [RISC-V] Fix HostActivation.Tests unknown-rid (dotnet#110687) Fix accidentally duplicated global-build-step.yml in runtime-official.yml (dotnet#111302) JIT: run extra SPMI queries for arrays (dotnet#111293) Split the Runtime Shared Framework project and combine legs in the official build (dotnet#111136) Do not ignore `MemoryMarshal.TryWrite` result (dotnet#108661) Update dependencies from https://github.com/dotnet/emsdk build 20250109.1 (dotnet#111263) Clean up in Number.Formatting.cs (dotnet#110955)
The JIT_TailCall helpers are only used on Windows x86. Removing all stub definitions on other platforms.
GetCONTEXTFromRedirectedStubStackFrame(DISPATCH_CONTEXT) is only used on Windows.