Skip to content

Commit

Permalink
Cleanup platform-specific ifdefs (#65624)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored Feb 23, 2022
1 parent e069de8 commit 94c0a7c
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 58 deletions.
4 changes: 0 additions & 4 deletions src/coreclr/binder/assemblybindercommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/createdump/datatarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/debug/daccess/datatargetadapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
#include <clrdata.h>
#include "dacimpl.h"

#ifndef IMAGE_FILE_MACHINE_ARM64
#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
#endif

//
// DataTargetAdaptor ctor
//
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/debug/shim/debugshim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
#include <clrinternal.h> //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)
//*****************************************************************************
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/dlls/mscorpe/pewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
16 changes: 0 additions & 16 deletions src/coreclr/inc/clrnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/pal/inc/rt/ntimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

//
Expand Down
17 changes: 7 additions & 10 deletions src/coreclr/vm/exceptionhandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 2 additions & 5 deletions src/coreclr/vm/exceptionhandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 94c0a7c

Please sign in to comment.