Skip to content

Commit

Permalink
[release/8.0] Update FixupPrecode and StubPrecode types for ARM (#92075)
Browse files Browse the repository at this point in the history
* Update FixupPrecode and StubPrecode types for ARM

Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>

* Update ThisPtrRetBufPrecode and NDirectImportPrecode types for arm

Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>

* Addressing PR feedback - remove unnecessary #ifdef's

* FIx riscv64 build break due to NDirectImportPrecode::Type conflict with ThisPtrRetBufPrecode::Type

---------

Co-authored-by: Tom McDonald <tommcdon@microsoft.com>
Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
  • Loading branch information
3 people authored Sep 15, 2023
1 parent f6cee7c commit 740081f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/vm/arm/cgencpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ inline BOOL ClrFlushInstructionCache(LPCVOID pCodeAddr, size_t sizeOfCode, bool
// Precode to shuffle this and retbuf for closed delegates over static methods with return buffer
struct ThisPtrRetBufPrecode {

static const int Type = 0x46;
static const int Type = 0x01;

// mov r12, r0
// mov r0, r1
Expand Down
14 changes: 9 additions & 5 deletions src/coreclr/vm/precode.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ EXTERN_C VOID STDCALL PrecodeRemotingThunk();

#elif defined(TARGET_ARM)

#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN
#define OFFSETOF_PRECODE_TYPE 3
#define SIZEOF_PRECODE_BASE CODE_SIZE_ALIGN * 2
#define OFFSETOF_PRECODE_TYPE 7

#elif defined(TARGET_LOONGARCH64)

Expand Down Expand Up @@ -100,7 +100,7 @@ struct StubPrecode
static const int Type = 0x4A;
static const SIZE_T CodeSize = 24;
#elif defined(TARGET_ARM)
static const int Type = 0xCF;
static const int Type = 0xFF;
static const SIZE_T CodeSize = 12;
#elif defined(TARGET_LOONGARCH64)
static const int Type = 0x4;
Expand Down Expand Up @@ -189,7 +189,7 @@ typedef DPTR(StubPrecode) PTR_StubPrecode;
// (This is fake precode. VTable slot does not point to it.)
struct NDirectImportPrecode : StubPrecode
{
static const int Type = 0x01;
static const int Type = 0x05;

void Init(NDirectImportPrecode* pPrecodeRX, MethodDesc* pMD, LoaderAllocator *pLoaderAllocator);

Expand Down Expand Up @@ -237,7 +237,7 @@ struct FixupPrecode
static const SIZE_T CodeSize = 24;
static const int FixupCodeOffset = 8;
#elif defined(TARGET_ARM)
static const int Type = 0xFF;
static const int Type = 0xCF;
static const SIZE_T CodeSize = 12;
static const int FixupCodeOffset = 4 + THUMB_CODE;
#elif defined(TARGET_LOONGARCH64)
Expand Down Expand Up @@ -614,4 +614,8 @@ static_assert_no_msg(FixupPrecode::Type != NDirectImportPrecode::Type);
static_assert_no_msg(FixupPrecode::Type != ThisPtrRetBufPrecode::Type);
static_assert_no_msg(NDirectImportPrecode::Type != ThisPtrRetBufPrecode::Type);

// Verify that the base type for each precode fits into each specific precode type
static_assert_no_msg(sizeof(Precode) <= sizeof(NDirectImportPrecode));
static_assert_no_msg(sizeof(Precode) <= sizeof(FixupPrecode));
static_assert_no_msg(sizeof(Precode) <= sizeof(ThisPtrRetBufPrecode));
#endif // __PRECODE_H__

0 comments on commit 740081f

Please sign in to comment.