Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/coreclr/debug/createdump/crashinfounix.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -376,8 +376,8 @@ CrashInfo::VisitProgramHeader(uint64_t loadbias, uint64_t baseAddress, Phdr* phd
TRACE("VisitProgramHeader: ehFrameHdrStart %016llx ehFrameHdrSize %08llx\n", ehFrameHdrStart, ehFrameHdrSize);
InsertMemoryRegion(ehFrameHdrStart, ehFrameHdrSize);

uint64_t ehFrameStart;
uint64_t ehFrameSize;
ULONG64 ehFrameStart;
ULONG64 ehFrameSize;
if (PAL_GetUnwindInfoSize(baseAddress, ehFrameHdrStart, ReadMemoryAdapter, &ehFrameStart, &ehFrameSize))
{
TRACE("VisitProgramHeader: ehFrameStart %016llx ehFrameSize %08llx\n", ehFrameStart, ehFrameSize);
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/inc/dacdbistructures.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -640,8 +640,6 @@ void FieldData::ClearFields()
m_pFldStaticAddress = NULL;
}

typedef ULONG_PTR SIZE_T;

inline
BOOL FieldData::OkToGetOrSetInstanceOffset()
{
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/inc/check.inl
Original file line numberDiff line numberDiff line change
Expand Up@@ -220,6 +220,14 @@ inline CHECK CheckOverflow(const void *address, UINT64 offset)
CHECK_OK;
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.
inline CHECK CheckOverflow(const void *address, SIZE_T offset)
{
CHECK((UINT64) address + offset >= (UINT64) address);

CHECK_OK;
}
#endif // HOST_UNIX && HOST_BIT64

inline CHECK CheckUnderflow(UINT value1, UINT value2)
{
Expand Down
26 changes: 26 additions & 0 deletions src/coreclr/inc/clrtypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -338,6 +338,15 @@ inline UINT64 AlignUp(UINT64 value, UINT alignment)
return (value+alignment-1)&~(UINT64)(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline SIZE_T AlignUp(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return (value+alignment-1)&~(SIZE_T)(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignDown(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand DownExpand Up@@ -381,6 +390,14 @@ inline UINT AlignmentPad(UINT64 value, UINT alignment)
return (UINT) (AlignUp(value, alignment) - value);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentPad(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_WRAPPER;
return (UINT) (AlignUp(value, alignment) - value);
}
#endif // HOST_UNIX && HOST_BIT64

inline UINT AlignmentTrim(UINT value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
Expand All@@ -406,4 +423,13 @@ inline UINT AlignmentTrim(UINT64 value, UINT alignment)
return ((UINT)value)&(alignment-1);
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline UINT AlignmentTrim(SIZE_T value, UINT alignment)
{
STATIC_CONTRACT_LEAF;
STATIC_CONTRACT_SUPPORTS_DAC;
return ((UINT)value)&(alignment-1);
}
#endif // HOST_UNIX && HOST_BIT64

#endif // CLRTYPES_H_
6 changes: 6 additions & 0 deletions src/coreclr/inc/daccess.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -1027,6 +1027,12 @@ class __DPtrBase : public __TPtrBase
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#if defined(HOST_UNIX) && defined(HOST_64BIT)
DPtrType operator+(unsigned long long val)
{
return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
}
#endif // HOST_UNIX && HOST_BIT64
DPtrType operator+(short val)
{
return DPtrType(m_addr + val * sizeof(type));
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/regdisp.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -561,7 +561,7 @@ inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
return (PTR_size_t)(PTR_BYTE(regs) + OFFSET_OF_REGISTERS[regNum]);
#elif defined(TARGET_AMD64)
_ASSERTE(regNum < 16);
return &regs->Rax + regNum;
return (size_t *)&regs->Rax + regNum;
#elif defined(TARGET_ARM)
_ASSERTE(regNum < 16);
return (size_t *)&regs->R0 + regNum;
Expand Down
10 changes: 9 additions & 1 deletion src/coreclr/jit/compiler.hpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -233,6 +233,13 @@ inline unsigned genLog2(unsigned __int64 value)
#endif
}

#if defined(HOST_UNIX) && defined(HOST_64BIT)
inline unsigned genLog2(size_t value)
{
return genLog2((unsigned __int64)value);
}
#endif // HOST_UNIX && HOST_BIT64

/*****************************************************************************
*
* Return the lowest bit that is set in the given register mask.
Expand DownExpand Up@@ -1536,7 +1543,8 @@ void GenTree::BashToConst(T value, var_types type /* = TYP_UNDEF */)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, long long>::value || std::is_same<T, float>::value ||
std::is_same<T, double>::value));
std::is_same<T, ssize_t>::value || std::is_same<T, double>::value));

static_assert_no_msg(sizeof(int64_t) == sizeof(long long));

var_types typeOfValue = TYP_UNDEF;
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/jit/gentree.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -3287,7 +3287,8 @@ inline void GenTreeIntConCommon::SetIntegralValue(int64_t value)
template <typename T>
inline void GenTreeIntConCommon::SetValueTruncating(T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value));
static_assert_no_msg(
(std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value || std::is_same<T, ssize_t>::value));

if (TypeIs(TYP_LONG))
{
Expand Down
11 changes: 9 additions & 2 deletions src/coreclr/jit/jit.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,6 +219,8 @@
#error Unsupported or unset target architecture
#endif

typedef ptrdiff_t ssize_t;

// Include the AMD64 unwind codes when appropriate.
#if defined(TARGET_AMD64)
#include "win64unwind.h"
Expand DownExpand Up@@ -349,8 +351,6 @@ typedef int NATIVE_OFFSET;
// this is used for native code sizes.
typedef unsigned UNATIVE_OFFSET;

typedef ptrdiff_t ssize_t;

// Type used for weights (e.g. block and edge weights)
typedef double weight_t;

Expand DownExpand Up@@ -630,9 +630,16 @@ inline unsigned int unsigned_abs(int x)

#ifdef TARGET_64BIT
inline size_t unsigned_abs(ssize_t x)
{
return ((size_t)abs((__int64)x));
}

#ifdef HOST_UNIX
inline size_t unsigned_abs(__int64 x)
{
return ((size_t)abs(x));
}
#endif // HOST_UNIX
#endif // TARGET_64BIT

/*****************************************************************************/
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/register.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,10 +68,10 @@ REGALIAS(EDI, RDI)

#ifdef TARGET_AMD64
#define XMMBASE 16
#define XMMMASK(x) (__int64(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int64)(1) << ((x)+XMMBASE))
#else // !TARGET_AMD64
#define XMMBASE 8
#define XMMMASK(x) (__int32(1) << ((x)+XMMBASE))
#define XMMMASK(x) ((__int32)(1) << ((x)+XMMBASE))
#endif // !TARGET_AMD64

REGDEF(XMM0, 0+XMMBASE, XMMMASK(0), "mm0" )
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/utils.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -821,6 +821,7 @@ template <typename T>
bool FitsIn(var_types type, T value)
{
static_assert_no_msg((std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
std::is_same<T, size_t>::value || std::is_same<T, ssize_t>::value ||
std::is_same<T, uint32_t>::value || std::is_same<T, uint64_t>::value));

switch (type)
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/pal/inc/pal.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -4323,6 +4323,12 @@ inline __int64 abs(__int64 _X) {
return llabs(_X);
}

#ifdef HOST_64BIT
inline __int64 abs(SSIZE_T _X) {
return llabs((__int64)_X);
}
#endif

}
#endif

Expand Down
27 changes: 13 additions & 14 deletions src/coreclr/pal/inc/pal_mstypes.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -195,12 +195,7 @@ extern "C" {
// they must be either signed or unsigned) and we want to be able to use
// __int64 as though it were intrinsic

#ifdef HOST_64BIT

@shushanhfshushanhfOct 19, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an error after deleting this on LoongArch64.

In file included from /home/qiao/work_qiao/runtime/src/coreclr/debug/di/platformspecific.cpp:37:
/home/qiao/work_qiao/runtime/src/coreclr/debug/di/loongarch64/cordbregisterset.cpp:272:18: error: cannot initialize a variable of type 'ULONG64 *'
(aka 'unsigned long long *') with an rvalue of type 'SIZE_T *' (aka 'unsigned long *')
ULONG64* pSrc = &m_rd->A0;
^ ~~~~~~~~~
1 error generated.

@shushanhfshushanhfOct 21, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas
Why define the ULONG64 as unsigned long long ?
While define SIZE_T as unsigned long ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkotas Why define the ULONG64 as unsigned long long ? While define SIZE_T as unsigned long ?

Thanks
I had noted #77268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been special cased to MacOS only in this PR: #77268, so guessing that should solve your issue?

Yes, it's ok for LA64 now.
Thanks.

#define __int64 long
#else // HOST_64BIT
#define __int64 long long
#endif // HOST_64BIT

#define __int32 int
#define __int16 short int
#define __int8 char // assumes char is signed
Expand DownExpand Up@@ -543,8 +538,16 @@ typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR;
#define UlongToPtr(ul) ULongToPtr(ul)
#define UintToPtr(ui) UIntToPtr(ui)

typedef ULONG_PTR SIZE_T, *PSIZE_T;
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#ifdef HOST_64BIT
typedef unsigned long SIZE_T;
typedef long SSIZE_T;
#else
typedef unsigned int SIZE_T;
typedef int SSIZE_T;
#endif
Comment thread
AaronRobinsonMSFT marked this conversation as resolved.

static_assert(sizeof(SIZE_T) == sizeof(void*), "SIZE_T should be pointer sized");
static_assert(sizeof(SSIZE_T) == sizeof(void*), "SSIZE_T should be pointer sized");

#ifndef SIZE_T_MAX
#define SIZE_T_MAX ULONG_PTR_MAX
Expand All@@ -559,18 +562,14 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif

#ifndef PAL_STDCPP_COMPAT
#if defined(__APPLE_CC__) || defined(__linux__)
#ifdef HOST_64BIT
typedef unsigned long size_t;
typedef long ssize_t;
typedef long ptrdiff_t;
#else // !HOST_64BIT
typedef unsigned int size_t;
typedef int ptrdiff_t;
#endif // !HOST_64BIT
#else
typedef ULONG_PTR size_t;
typedef LONG_PTR ptrdiff_t;
#endif
#endif // !PAL_STDCPP_COMPAT
#define _SIZE_T_DEFINED

Expand All@@ -596,8 +595,8 @@ typedef int intptr_t;
typedef unsigned int uintptr_t;
#endif // !HOST_64BIT
#else
typedef INT_PTR intptr_t;
typedef UINT_PTR uintptr_t;
typedef long int intptr_t;
typedef unsigned long int uintptr_t;
#endif

#endif // PAL_STDCPP_COMPAT
Expand Down
114 changes: 57 additions & 57 deletions src/coreclr/pal/src/exception/remote-unwind.cpp
Original file line numberDiff line numberDiff line change
Expand Up@@ -1820,12 +1820,12 @@ static void GetContextPointer(unw_cursor_t *cursor, unw_context_t *unwContext, i
static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
#if defined(TARGET_AMD64)
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, &contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, &contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBP, (SIZE_T**)&contextPointers->Rbp);
GetContextPointer(cursor, unwContext, UNW_X86_64_RBX, (SIZE_T**)&contextPointers->Rbx);
GetContextPointer(cursor, unwContext, UNW_X86_64_R12, (SIZE_T**)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_X86_64_R13, (SIZE_T**)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_X86_64_R14, (SIZE_T**)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_X86_64_R15, (SIZE_T**)&contextPointers->R15);
#elif defined(TARGET_X86)
GetContextPointer(cursor, unwContext, UNW_X86_EBX, &contextPointers->Ebx);
GetContextPointer(cursor, unwContext, UNW_X86_EBP, &contextPointers->Ebp);
Expand All@@ -1841,60 +1841,60 @@ static void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext,
GetContextPointer(cursor, unwContext, UNW_ARM_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_ARM_R11, &contextPointers->R11);
#elif defined(TARGET_ARM64)
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, &contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, &contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, &contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, &contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, &contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, &contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, &contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, &contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, &contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, &contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X19, (SIZE_T**)&contextPointers->X19);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X20, (SIZE_T**)&contextPointers->X20);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X21, (SIZE_T**)&contextPointers->X21);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X22, (SIZE_T**)&contextPointers->X22);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X23, (SIZE_T**)&contextPointers->X23);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X24, (SIZE_T**)&contextPointers->X24);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X25, (SIZE_T**)&contextPointers->X25);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X26, (SIZE_T**)&contextPointers->X26);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X27, (SIZE_T**)&contextPointers->X27);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X28, (SIZE_T**)&contextPointers->X28);
GetContextPointer(cursor, unwContext, UNW_AARCH64_X29, (SIZE_T**)&contextPointers->Fp);
#elif defined(TARGET_LOONGARCH64)
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, &contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, &contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, &contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, &contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, &contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, &contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, &contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, &contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, &contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, &contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, &contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, &contextPointers->S8);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R1, (SIZE_T **)&contextPointers->Ra);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R2, (SIZE_T **)&contextPointers->Tp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R22, (SIZE_T **)&contextPointers->Fp);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R23, (SIZE_T **)&contextPointers->S0);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R24, (SIZE_T **)&contextPointers->S1);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R25, (SIZE_T **)&contextPointers->S2);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R26, (SIZE_T **)&contextPointers->S3);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R27, (SIZE_T **)&contextPointers->S4);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R28, (SIZE_T **)&contextPointers->S5);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R29, (SIZE_T **)&contextPointers->S6);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R30, (SIZE_T **)&contextPointers->S7);
GetContextPointer(cursor, unwContext, UNW_LOONGARCH64_R31, (SIZE_T **)&contextPointers->S8);
#elif defined(TARGET_S390X)
GetContextPointer(cursor, unwContext, UNW_S390X_R6, &contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, &contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, &contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, &contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, &contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, &contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, &contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, &contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_S390X_R6, (SIZE_T **)&contextPointers->R6);
GetContextPointer(cursor, unwContext, UNW_S390X_R7, (SIZE_T **)&contextPointers->R7);
GetContextPointer(cursor, unwContext, UNW_S390X_R8, (SIZE_T **)&contextPointers->R8);
GetContextPointer(cursor, unwContext, UNW_S390X_R9, (SIZE_T **)&contextPointers->R9);
GetContextPointer(cursor, unwContext, UNW_S390X_R10, (SIZE_T **)&contextPointers->R10);
GetContextPointer(cursor, unwContext, UNW_S390X_R11, (SIZE_T **)&contextPointers->R11);
GetContextPointer(cursor, unwContext, UNW_S390X_R12, (SIZE_T **)&contextPointers->R12);
GetContextPointer(cursor, unwContext, UNW_S390X_R13, (SIZE_T **)&contextPointers->R13);
GetContextPointer(cursor, unwContext, UNW_S390X_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_S390X_R15, (SIZE_T **)&contextPointers->R15);
#elif defined(TARGET_POWERPC64)
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, &contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, &contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, &contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, &contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, &contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, &contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, &contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, &contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, &contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, &contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, &contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, &contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, &contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, &contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, &contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, &contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, &contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, &contextPointers->R31);
GetContextPointer(cursor, unwContext, UNW_PPC64_R14, (SIZE_T **)&contextPointers->R14);
GetContextPointer(cursor, unwContext, UNW_PPC64_R15, (SIZE_T **)&contextPointers->R15);
GetContextPointer(cursor, unwContext, UNW_PPC64_R16, (SIZE_T **)&contextPointers->R16);
GetContextPointer(cursor, unwContext, UNW_PPC64_R17, (SIZE_T **)&contextPointers->R17);
GetContextPointer(cursor, unwContext, UNW_PPC64_R18, (SIZE_T **)&contextPointers->R18);
GetContextPointer(cursor, unwContext, UNW_PPC64_R19, (SIZE_T **)&contextPointers->R19);
GetContextPointer(cursor, unwContext, UNW_PPC64_R20, (SIZE_T **)&contextPointers->R20);
GetContextPointer(cursor, unwContext, UNW_PPC64_R21, (SIZE_T **)&contextPointers->R21);
GetContextPointer(cursor, unwContext, UNW_PPC64_R22, (SIZE_T **)&contextPointers->R22);
GetContextPointer(cursor, unwContext, UNW_PPC64_R23, (SIZE_T **)&contextPointers->R23);
GetContextPointer(cursor, unwContext, UNW_PPC64_R24, (SIZE_T **)&contextPointers->R24);
GetContextPointer(cursor, unwContext, UNW_PPC64_R25, (SIZE_T **)&contextPointers->R25);
GetContextPointer(cursor, unwContext, UNW_PPC64_R26, (SIZE_T **)&contextPointers->R26);
GetContextPointer(cursor, unwContext, UNW_PPC64_R27, (SIZE_T **)&contextPointers->R27);
GetContextPointer(cursor, unwContext, UNW_PPC64_R28, (SIZE_T **)&contextPointers->R28);
GetContextPointer(cursor, unwContext, UNW_PPC64_R29, (SIZE_T **)&contextPointers->R29);
GetContextPointer(cursor, unwContext, UNW_PPC64_R30, (SIZE_T **)&contextPointers->R30);
GetContextPointer(cursor, unwContext, UNW_PPC64_R31, (SIZE_T **)&contextPointers->R31);
#else
#error unsupported architecture
#endif
Expand Down
Loading