-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use EXCEPTION_HANDLER_IMPL/DECL macros for declaring exception handlers #113826
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
} | ||
|
||
EXTERN_C EXCEPTION_DISPOSITION | ||
UMThunkStubUnwindFrameChainHandler( |
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 handler is no longer used.
This is extracted from the x86 funclet prototype (#113576). It's one of the changes that makes the diff quite unreadable and distracts from the imporant parts. |
c042745
to
fd2ea20
Compare
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.
Overall, I would prefer just making the exception handlers have the __cdecl
on x86 and not make any other changes. The functions definitions by the macro without the arguments are more difficult to follow. I don't also see a problem with the pEstablisherFrame
being PVOID, as it is just a pointer to a stack location. The fact that it is some struct pointer on x86 doesn't seem to be a good reason for changing to that type everywhere. You can easily cast it to the struct pointer for x86 if you need it.
{ | ||
OBJECTREF oref = ExceptionTracker::CreateThrowable(pExceptionRecord, FALSE); | ||
DispatchManagedException(oref, pContextRecord, pExceptionRecord); | ||
DispatchManagedException(oref, pContext, pExceptionRecord); |
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.
A nit - can we please keep the name pContextRecord
at places where you have renamed it? It would make this change much smaller and it would match the Windows naming (e.g. in RtlVirtualUnwind
and other similar functions). It is also usually used in locations where the exception record so that the two names match.
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 renamed it to follow the existing macro. If I were to change the macro then an equal number of places elsewhere would have the be modified.
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 would prefer taking the non-x86 stuff as the standard. The x86 has always been a bit different at various places for historical reasons.
// Perform unwinding of the current frame | ||
disposition = ProcessCLRException(exceptionRecord, | ||
(void*)establisherFrame, | ||
(struct _EXCEPTION_REGISTRATION_RECORD *)establisherFrame, |
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 looks strange, the establisherFrame
isn't a struct like this. Is is purely a stack pointer.
I don't have strong preference. The macros were already there so I tried to reuse the existing infrastructure instead of inventing something else.
It's |
I'll try to rework my other PR to use that and then likely close this and submit the other variant. |
The current declaration of the exception handlers are incorrect on x86. They are missing
__cdecl
calling convention and the second parameter is declared asPVOID
instead ofstruct _EXCEPTION_REGISTRATION_RECORD *
.We have two options - either we fix every single of these declarations to match the required prototype or we use the existing macros. The macros have the flexibility of chosing between
struct _EXCEPTION_REGISTRATION_RECORD *
andPVOID
for the second parameter if we ever need that distinction.I assume this won't break IntelliSense completions due to the use of
src/coreclr/cpp.hint
.