From 94c0a7c13d158eb79d27223f474ec8f8db747f11 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 22 Feb 2022 18:01:04 -0800 Subject: [PATCH] Cleanup platform-specific ifdefs (#65624) --- src/coreclr/binder/assemblybindercommon.cpp | 4 ---- src/coreclr/debug/createdump/datatarget.cpp | 2 -- src/coreclr/debug/daccess/datatargetadapter.cpp | 4 ---- src/coreclr/debug/shim/debugshim.cpp | 8 -------- src/coreclr/dlls/mscorpe/pewriter.cpp | 5 ----- src/coreclr/inc/clrnt.h | 16 ---------------- src/coreclr/pal/inc/pal.h | 3 --- src/coreclr/pal/inc/rt/ntimage.h | 3 ++- src/coreclr/vm/exceptionhandling.cpp | 17 +++++++---------- src/coreclr/vm/exceptionhandling.h | 7 ++----- 10 files changed, 11 insertions(+), 58 deletions(-) diff --git a/src/coreclr/binder/assemblybindercommon.cpp b/src/coreclr/binder/assemblybindercommon.cpp index 7b48a0a90ce83..617bd16a9a07f 100644 --- a/src/coreclr/binder/assemblybindercommon.cpp +++ b/src/coreclr/binder/assemblybindercommon.cpp @@ -24,10 +24,6 @@ #include "stringarraylist.h" #include "configuration.h" -#ifndef IMAGE_FILE_MACHINE_ARM64 -#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian -#endif - #if !defined(DACCESS_COMPILE) #include "defaultassemblybinder.h" // Helper function in the VM, invoked by the Binder, to invoke the host assembly resolver diff --git a/src/coreclr/debug/createdump/datatarget.cpp b/src/coreclr/debug/createdump/datatarget.cpp index 7d2ab1973ff60..3ee3ad6466352 100644 --- a/src/coreclr/debug/createdump/datatarget.cpp +++ b/src/coreclr/debug/createdump/datatarget.cpp @@ -3,8 +3,6 @@ #include "createdump.h" -#define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8) - DumpDataTarget::DumpDataTarget(CrashInfo& crashInfo) : m_ref(1), m_crashInfo(crashInfo) diff --git a/src/coreclr/debug/daccess/datatargetadapter.cpp b/src/coreclr/debug/daccess/datatargetadapter.cpp index 6a014604dffca..59b35766f0d7a 100644 --- a/src/coreclr/debug/daccess/datatargetadapter.cpp +++ b/src/coreclr/debug/daccess/datatargetadapter.cpp @@ -13,10 +13,6 @@ #include #include "dacimpl.h" -#ifndef IMAGE_FILE_MACHINE_ARM64 -#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian -#endif - // // DataTargetAdaptor ctor // diff --git a/src/coreclr/debug/shim/debugshim.cpp b/src/coreclr/debug/shim/debugshim.cpp index 3dcfbcc251078..a162bc65acbc0 100644 --- a/src/coreclr/debug/shim/debugshim.cpp +++ b/src/coreclr/debug/shim/debugshim.cpp @@ -13,14 +13,6 @@ #include //has the CLR_ID_V4_DESKTOP guid in it #include "palclr.h" -#ifndef IMAGE_FILE_MACHINE_ARMNT -#define IMAGE_FILE_MACHINE_ARMNT 0x01c4 // ARM Thumb-2 Little-Endian -#endif - -#ifndef IMAGE_FILE_MACHINE_ARM64 -#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian -#endif - //***************************************************************************** // CLRDebuggingImpl implementation (ICLRDebugging) //***************************************************************************** diff --git a/src/coreclr/dlls/mscorpe/pewriter.cpp b/src/coreclr/dlls/mscorpe/pewriter.cpp index b78b00c2853ff..cf560b598cc00 100644 --- a/src/coreclr/dlls/mscorpe/pewriter.cpp +++ b/src/coreclr/dlls/mscorpe/pewriter.cpp @@ -2,11 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. #include "stdafx.h" -// Enable building with older SDKs that don't have IMAGE_FILE_MACHINE_ARM64 defined. -#ifndef IMAGE_FILE_MACHINE_ARM64 -#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian -#endif - #include "blobfetcher.h" #include "pedecoder.h" diff --git a/src/coreclr/inc/clrnt.h b/src/coreclr/inc/clrnt.h index 2eac3dab2ee6b..0e1480c3cebc5 100644 --- a/src/coreclr/inc/clrnt.h +++ b/src/coreclr/inc/clrnt.h @@ -1012,22 +1012,6 @@ RtlVirtualUnwind( IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL ); -#ifndef IMAGE_FILE_MACHINE_ARM64 -#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian -#endif - -#ifndef IMAGE_REL_ARM64_BRANCH26 -#define IMAGE_REL_ARM64_BRANCH26 0x0003 // 26 bit offset << 2 & sign ext. for B & BL -#endif - -#ifndef IMAGE_REL_ARM64_PAGEBASE_REL21 -#define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004 // ADRP 21 bit PC-relative page address -#endif - -#ifndef IMAGE_REL_ARM64_PAGEOFFSET_12A -#define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006 // ADD 12 bit page offset -#endif - #endif #ifdef TARGET_LOONGARCH64 diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index c0439fc954ed0..9d9a437a79bdb 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -3966,9 +3966,6 @@ typedef POSVERSIONINFOEXA POSVERSIONINFOEX; typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX; #endif -#define IMAGE_FILE_MACHINE_I386 0x014c -#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian - typedef struct _SYSTEM_INFO { WORD wProcessorArchitecture_PAL_Undefined; WORD wReserved_PAL_Undefined; // NOTE: diff from winbase.h - no obsolete dwOemId union diff --git a/src/coreclr/pal/inc/rt/ntimage.h b/src/coreclr/pal/inc/rt/ntimage.h index 6e76745884d6e..cd56b305aed48 100644 --- a/src/coreclr/pal/inc/rt/ntimage.h +++ b/src/coreclr/pal/inc/rt/ntimage.h @@ -222,7 +222,7 @@ typedef struct _IMAGE_FILE_HEADER { #define IMAGE_FILE_MACHINE_SH4 0x01a6 // SH4 little-endian #define IMAGE_FILE_MACHINE_SH5 0x01a8 // SH5 #define IMAGE_FILE_MACHINE_ARM 0x01c0 // ARM Little-Endian -#define IMAGE_FILE_MACHINE_THUMB 0x01c2 +#define IMAGE_FILE_MACHINE_THUMB 0x01c2 // ARM Thumb/Thumb-2 Little-Endian #define IMAGE_FILE_MACHINE_ARMNT 0x01c4 // ARM Thumb-2 Little-Endian #define IMAGE_FILE_MACHINE_AM33 0x01d3 #define IMAGE_FILE_MACHINE_POWERPC 0x01F0 // IBM PowerPC Little-Endian @@ -238,6 +238,7 @@ typedef struct _IMAGE_FILE_HEADER { #define IMAGE_FILE_MACHINE_EBC 0x0EBC // EFI Byte Code #define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8) #define IMAGE_FILE_MACHINE_M32R 0x9041 // M32R little-endian +#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian #define IMAGE_FILE_MACHINE_CEE 0xC0EE // diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp index dcd6681a1b08c..90cac3a5789f6 100644 --- a/src/coreclr/vm/exceptionhandling.cpp +++ b/src/coreclr/vm/exceptionhandling.cpp @@ -654,7 +654,7 @@ UINT_PTR ExceptionTracker::CallCatchHandler(CONTEXT* pContextRecord, bool* pfAbo if (!fIntercepted) { _ASSERTE(m_uCatchToCallPC != 0 && m_pClauseForCatchToken != NULL); - uResumePC = CallHandler(m_uCatchToCallPC, sfStackFp, &m_ClauseForCatch, pMD, Catch X86_ARG(pContextRecord) ARM_ARG(pContextRecord) ARM64_ARG(pContextRecord)); + uResumePC = CallHandler(m_uCatchToCallPC, sfStackFp, &m_ClauseForCatch, pMD, Catch, pContextRecord); } else { @@ -2905,6 +2905,8 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( SetEnclosingClauseInfo(fIsFunclet, pcfThisFrame->GetRelOffset(), GetSP(pcfThisFrame->GetRegisterSet()->pCallerContext)); + + CONTEXT *pContext = NULL; #ifdef USE_FUNCLET_CALL_HELPER // On ARM & ARM64, the OS passes us the CallerSP for the frame for which personality routine has been invoked. // Since IL filters are invoked in the first pass, we pass this CallerSP to the filter funclet which will @@ -2913,8 +2915,6 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( // // Assert our invariants (we had set them up in InitializeCrawlFrame): REGDISPLAY *pCurRegDisplay = pcfThisFrame->GetRegisterSet(); - - CONTEXT *pContext = NULL; #ifndef USE_CURRENT_CONTEXT_IN_FILTER // 1) In first pass, we dont have a valid current context IP _ASSERTE(GetIP(pCurRegDisplay->pCurrentContext) == 0); @@ -2932,7 +2932,7 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( { // CallHandler expects to be in COOP mode. GCX_COOP(); - dwResult = CallHandler(dwFilterStartPC, sf, &EHClause, pMD, Filter X86_ARG(pContext) ARM_ARG(pContext) ARM64_ARG(pContext)); + dwResult = CallHandler(dwFilterStartPC, sf, &EHClause, pMD, Filter, pContext); } } EX_CATCH @@ -3175,7 +3175,7 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame( // Since we also forbid GC during second pass, disable it now since // invocation of managed code can result in a GC. ENDFORBIDGC(); - dwStatus = CallHandler(dwHandlerStartPC, sf, &EHClause, pMD, FaultFinally X86_ARG(pcfThisFrame->GetRegisterSet()->pCurrentContext) ARM_ARG(pcfThisFrame->GetRegisterSet()->pCurrentContext) ARM64_ARG(pcfThisFrame->GetRegisterSet()->pCurrentContext)); + dwStatus = CallHandler(dwHandlerStartPC, sf, &EHClause, pMD, FaultFinally, pcfThisFrame->GetRegisterSet()->pCurrentContext); // Once we return from a funclet, forbid GC again (refer to comment before start of the loop for details) BEGINFORBIDGC(); @@ -3276,11 +3276,8 @@ DWORD_PTR ExceptionTracker::CallHandler( StackFrame sf, EE_ILEXCEPTION_CLAUSE* pEHClause, MethodDesc* pMD, - EHFuncletType funcletType - X86_ARG(PCONTEXT pContextRecord) - ARM_ARG(PCONTEXT pContextRecord) - ARM64_ARG(PCONTEXT pContextRecord) - ) + EHFuncletType funcletType, + PCONTEXT pContextRecord) { STATIC_CONTRACT_THROWS; STATIC_CONTRACT_GC_TRIGGERS; diff --git a/src/coreclr/vm/exceptionhandling.h b/src/coreclr/vm/exceptionhandling.h index c3237de6b67b0..a69740d175f4d 100644 --- a/src/coreclr/vm/exceptionhandling.h +++ b/src/coreclr/vm/exceptionhandling.h @@ -380,11 +380,8 @@ class ExceptionTracker StackFrame sf, EE_ILEXCEPTION_CLAUSE* pEHClause, MethodDesc* pMD, - EHFuncletType funcletType - X86_ARG(PT_CONTEXT pContextRecord) - ARM_ARG(PT_CONTEXT pContextRecord) - ARM64_ARG(PT_CONTEXT pContextRecord) - ); + EHFuncletType funcletType, + PT_CONTEXT pContextRecord); inline static BOOL ClauseCoversPC(EE_ILEXCEPTION_CLAUSE* pEHClause,