Skip to content

Delete unnecessary null checks #105382

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

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/coreclr/vm/eepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage
// Fire an ETW FailFast event
FireEtwFailFast(pszMessage,
(const PVOID)address,
((pExceptionInfo && pExceptionInfo->ExceptionRecord) ? pExceptionInfo->ExceptionRecord->ExceptionCode : 0),
pExceptionInfo->ExceptionRecord ? pExceptionInfo->ExceptionRecord->ExceptionCode : 0,
exitCode,
GetClrInstanceId());
}
Expand Down Expand Up @@ -477,7 +477,7 @@ void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage
else
{
WCHAR addressString[MaxIntegerDecHexString + 1];
FormatInteger(addressString, ARRAY_SIZE(addressString), "%p", pExceptionInfo ? (SIZE_T)pExceptionInfo->ExceptionRecord->ExceptionAddress : (SIZE_T)address);
FormatInteger(addressString, ARRAY_SIZE(addressString), "%p", (SIZE_T)pExceptionInfo->ExceptionRecord->ExceptionAddress);

// We should always have the reference to the runtime's instance
_ASSERTE(GetClrModuleBase() != NULL);
Expand Down Expand Up @@ -610,6 +610,8 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE

WRAPPER_NO_CONTRACT;

_ASSERTE(pExceptionInfo != NULL);

// Disable GC stress triggering GC at this point, we don't want the GC to start running
// on this thread when we have only a very limited space left on the stack
GCStressPolicy::InhibitHolder iholder;
Expand All @@ -620,7 +622,7 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE
#if defined(FEATURE_EH_FUNCLETS)
*((&fef)->GetGSCookiePtr()) = GetProcessGSCookie();
#endif // FEATURE_EH_FUNCLETS
if (pExceptionInfo && pExceptionInfo->ContextRecord)
if (pExceptionInfo->ContextRecord)
{
GCX_COOP();
CONTEXT *pExceptionContext = pExceptionInfo->ContextRecord;
Expand Down Expand Up @@ -689,8 +691,8 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE
{
// Fire an ETW FailFast event
FireEtwFailFast(W("StackOverflowException"),
(const PVOID)((pExceptionInfo && pExceptionInfo->ContextRecord) ? GetIP(pExceptionInfo->ContextRecord) : 0),
((pExceptionInfo && pExceptionInfo->ExceptionRecord) ? pExceptionInfo->ExceptionRecord->ExceptionCode : 0),
(const PVOID)(pExceptionInfo->ContextRecord ? GetIP(pExceptionInfo->ContextRecord) : 0),
pExceptionInfo->ExceptionRecord ? pExceptionInfo->ExceptionRecord->ExceptionCode : 0,
COR_E_STACKOVERFLOW,
GetClrInstanceId());
}
Expand Down Expand Up @@ -728,8 +730,6 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE
#ifndef TARGET_UNIX
if (IsWatsonEnabled() && (g_pDebugInterface != NULL))
{
_ASSERTE(pExceptionInfo != NULL);

ResetWatsonBucketsParams param;
param.m_pThread = pThread;
param.pExceptionRecord = pExceptionInfo->ExceptionRecord;
Expand Down