Skip to content

Commit

Permalink
Remove unused methods in cgencpu.h (#87357)
Browse files Browse the repository at this point in the history
- `isJump` and `isBackToBackJump`
  • Loading branch information
clamp03 committed Jun 10, 2023
1 parent b02e844 commit 66def3a
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 96 deletions.
7 changes: 0 additions & 7 deletions src/coreclr/vm/amd64/cgencpu.h
Expand Up @@ -430,13 +430,6 @@ inline void emitBackToBackJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target
emitJump(pBufferRX, pBufferRW, target);
}

inline BOOL isBackToBackJump(PCODE pCode)
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
return isJumpRel32(pCode) || isJumpRel64(pCode);
}

inline PCODE decodeBackToBackJump(PCODE pCode)
{
WRAPPER_NO_CONTRACT;
Expand Down
18 changes: 0 additions & 18 deletions src/coreclr/vm/arm/cgencpu.h
Expand Up @@ -302,24 +302,6 @@ inline PCODE decodeJump(PCODE pCode)
// That is why we have these two wrapper functions that call emitJump and decodeJump
//

//------------------------------------------------------------------------
inline BOOL isJump(PCODE pCode)
{
LIMITED_METHOD_DAC_CONTRACT;

TADDR pInstr = PCODEToPINSTR(pCode);

return *dac_cast<PTR_DWORD>(pInstr) == 0xf000f8df;
}

//------------------------------------------------------------------------
inline BOOL isBackToBackJump(PCODE pBuffer)
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
return isJump(pBuffer);
}

//------------------------------------------------------------------------
inline void emitBackToBackJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target)
{
Expand Down
18 changes: 0 additions & 18 deletions src/coreclr/vm/arm64/cgencpu.h
Expand Up @@ -317,24 +317,6 @@ inline PCODE decodeJump(PCODE pCode)
return *dac_cast<PTR_PCODE>(pInstr + 2*sizeof(DWORD));
}

//------------------------------------------------------------------------
inline BOOL isJump(PCODE pCode)
{
LIMITED_METHOD_DAC_CONTRACT;

TADDR pInstr = PCODEToPINSTR(pCode);

return *dac_cast<PTR_DWORD>(pInstr) == 0x58000050;
}

//------------------------------------------------------------------------
inline BOOL isBackToBackJump(PCODE pBuffer)
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
return isJump(pBuffer);
}

//------------------------------------------------------------------------
inline void emitBackToBackJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target)
{
Expand Down
15 changes: 0 additions & 15 deletions src/coreclr/vm/i386/cgencpu.h
Expand Up @@ -371,13 +371,6 @@ inline void emitJumpInd(LPBYTE pBuffer, LPVOID target)
*((LPVOID*)(2+pBuffer)) = target;
}

//------------------------------------------------------------------------
inline PCODE isJump(PCODE pCode)
{
LIMITED_METHOD_DAC_CONTRACT;
return *PTR_BYTE(pCode) == X86_INSTR_JMP_REL32;
}

//------------------------------------------------------------------------
// Given the same pBuffer that was used by emitJump this method
// decodes the instructions and returns the jump target
Expand All @@ -402,14 +395,6 @@ inline void emitBackToBackJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target
emitJump(pBufferRX, pBufferRW, target);
}

//------------------------------------------------------------------------
inline PCODE isBackToBackJump(PCODE pBuffer)
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
return isJump(pBuffer);
}

//------------------------------------------------------------------------
inline PCODE decodeBackToBackJump(PCODE pBuffer)
{
Expand Down
20 changes: 1 addition & 19 deletions src/coreclr/vm/loongarch64/cgencpu.h
Expand Up @@ -248,7 +248,7 @@ inline void emitJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target)
pCode[0] = 0x18000095; //pcaddi $r21,4
pCode[1] = 0x28c002b5; //ld.d $r21,$r21,0
pCode[2] = 0x4c0002a0; //jirl $r0,$r21,0
pCode[3] = 0x03400000; //padding nop. Also used for isJump.
pCode[3] = 0x03400000; //padding nop.

// Ensure that the updated instructions get updated in the I-Cache
ClrFlushInstructionCache(pBufferRX, 16);
Expand All @@ -269,24 +269,6 @@ inline PCODE decodeJump(PCODE pCode)
return *dac_cast<PTR_PCODE>(pInstr + 16);
}

//------------------------------------------------------------------------
inline BOOL isJump(PCODE pCode)
{
LIMITED_METHOD_DAC_CONTRACT;

TADDR pInstr = PCODEToPINSTR(pCode);

return *dac_cast<PTR_DWORD>(pInstr+12) == 0x03400000; //nop
}

//------------------------------------------------------------------------
inline BOOL isBackToBackJump(PCODE pBuffer)
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
return isJump(pBuffer);
}

//------------------------------------------------------------------------
inline void emitBackToBackJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target)
{
Expand Down
20 changes: 1 addition & 19 deletions src/coreclr/vm/riscv64/cgencpu.h
Expand Up @@ -246,7 +246,7 @@ inline void emitJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target)
pCode[0] = 0x00000097; // auipc ra, 0
pCode[1] = 0x0100b083; // ld ra, 16(ra)
pCode[2] = 0x00008067; // jalr x0, ra, 0
pCode[3] = 0x00000013; // padding nop. Also used for isJump.
pCode[3] = 0x00000013; // padding nop.

// Ensure that the updated instructions get updated in the I-Cache
ClrFlushInstructionCache(pBufferRX, 16);
Expand All @@ -266,24 +266,6 @@ inline PCODE decodeJump(PCODE pCode)
return *dac_cast<PTR_PCODE>(pInstr + 2*sizeof(DWORD));
}

//------------------------------------------------------------------------
inline BOOL isJump(PCODE pCode)
{
LIMITED_METHOD_DAC_CONTRACT;

TADDR pInstr = PCODEToPINSTR(pCode);

return *dac_cast<PTR_DWORD>(pInstr) == 0x58000050;
}

//------------------------------------------------------------------------
inline BOOL isBackToBackJump(PCODE pBuffer)
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
return isJump(pBuffer);
}

//------------------------------------------------------------------------
inline void emitBackToBackJump(LPBYTE pBufferRX, LPBYTE pBufferRW, LPVOID target)
{
Expand Down

0 comments on commit 66def3a

Please sign in to comment.