Skip to content

Commit 943308e

Browse files
committed
process EGPRs in VM only if APX is supported. Also, add AMD64VolatileContextPointers for windows
1 parent 7f9f4c3 commit 943308e

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

src/coreclr/System.Private.CoreLib/src/System/Runtime/ExceptionServices/AsmOffsets.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AsmOffsets
2020
public const int OFFSETOF__REGDISPLAY__SP = 0x1b78;
2121
public const int OFFSETOF__REGDISPLAY__ControlPC = 0x1b80;
2222
#else // TARGET_UNIX
23-
public const int SIZEOF__REGDISPLAY = 0xbf0;
23+
public const int SIZEOF__REGDISPLAY = 0xc70;
2424
public const int OFFSETOF__REGDISPLAY__SP = 0xbd8;
2525
public const int OFFSETOF__REGDISPLAY__ControlPC = 0xbe0;
2626
#endif // TARGET_UNIX

src/coreclr/inc/regdisp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ typedef struct _Arm64VolatileContextPointer
197197
} Arm64VolatileContextPointer;
198198
#endif //TARGET_ARM64
199199

200-
#if defined(TARGET_AMD64) && defined(TARGET_UNIX)
200+
#if defined(TARGET_AMD64)
201201
typedef struct _Amd64VolatileContextPointer
202202
{
203203
union {
@@ -222,7 +222,7 @@ typedef struct _Amd64VolatileContextPointer
222222
PDWORD64 R[16];
223223
};
224224
} Amd64VolatileContextPointer;
225-
#endif //TARGET_AMD64 && TARGET_UNIX
225+
#endif //TARGET_AMD64
226226

227227
#if defined(TARGET_LOONGARCH64)
228228
typedef struct _LoongArch64VolatileContextPointer
@@ -280,7 +280,7 @@ struct REGDISPLAY : public REGDISPLAY_BASE {
280280
LoongArch64VolatileContextPointer volatileCurrContextPointers;
281281
#endif
282282

283-
#if defined(TARGET_AMD64) && defined(TARGET_UNIX)
283+
#if defined(TARGET_AMD64)
284284
Amd64VolatileContextPointer volatileCurrContextPointers;
285285
#endif
286286

src/coreclr/vm/codeman.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Module Name:
7070
#ifdef TARGET_X86
7171
#include "gc_unwind_x86.h"
7272
#endif
73+
#ifdef TARGET_AMD64
74+
#include <minipal/cpufeatures.h>
75+
#endif
7376

7477
class MethodDesc;
7578
class ICorJitCompiler;
@@ -2198,6 +2201,13 @@ class EEJitManager final : public EECodeGenManager
21982201
return m_CPUCompileFlags;
21992202
}
22002203

2204+
#if defined(TARGET_AMD64)
2205+
inline bool IsAPXSupported()
2206+
{
2207+
return m_CPUCompileFlags.IsSet(InstructionSet_APX);
2208+
}
2209+
#endif // TARGET_AMD64
2210+
22012211
private :
22022212
Crst m_JitLoadLock;
22032213

src/coreclr/vm/gcinfodecoder.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,13 +1502,11 @@ template <typename GcInfoEncoding> OBJECTREF* TGcInfoDecoder<GcInfoEncoding>::Ge
15021502
// The fields of KNONVOLATILE_CONTEXT_POINTERS are in the same order as
15031503
// the processor encoding numbers.
15041504
ULONGLONG **ppRax = &pRD->pCurrentContextPointers->Rax;
1505-
#if defined(TARGET_UNIX)
1506-
if(regNum >= 16)
1505+
if(ExecutionManager::GetEEJitManager()->IsAPXSupported() && regNum >= 16)
15071506
{
15081507
ppRax = &pRD->volatileCurrContextPointers.R16;
15091508
return (OBJECTREF*)*(ppRax + regNum - 16);
15101509
}
1511-
#endif // TARGET_UNIX
15121510
#endif // FEATURE_NATIVEAOT
15131511

15141512
return (OBJECTREF*)*(ppRax + regNum);
@@ -1529,13 +1527,11 @@ template <typename GcInfoEncoding> OBJECTREF* TGcInfoDecoder<GcInfoEncoding>::Ge
15291527

15301528
// The fields of CONTEXT are in the same order as
15311529
// the processor encoding numbers.
1532-
#if defined(TARGET_UNIX)
1533-
if (regNum >= 16)
1530+
if (ExecutionManager::GetEEJitManager()->IsAPXSupported() && regNum >= 16)
15341531
{
15351532
ULONGLONG *pRax = &pRD->pCurrentContext->R16;
15361533
return (OBJECTREF*)(pRax + regNum - 16);
15371534
}
1538-
#endif // TARGET_UNIX
15391535
ULONGLONG *pRax = &pRD->pCurrentContext->Rax;
15401536

15411537
return (OBJECTREF*)(pRax + regNum);

0 commit comments

Comments
 (0)