Skip to content

Commit

Permalink
Remove JIT_FLAG_PROF_REJIT_NOPS (#46560)
Browse files Browse the repository at this point in the history
* Remove padding for ReJit in CodeGen::genAllocLclFrame in src/coreclr/jit/codegenxarch.cpp

* Remove JIT_FLAG_PROF_REJIT_NOPS in src/coreclr/jit/jitee.h

* Remove CORJIT_FLAG_PROF_REJIT_NOPS in src/coreclr/inc/corjitflags.h

* Remove CORJIT_FLAG_PROF_REJIT_NOPS in src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs

* Remove genPrologPadForReJit() in src/coreclr/jit

* Remove dead code in src/coreclr/jit

* Update JIT/EE interface GUID in src/coreclr/inc/jiteeversionguid.h
  • Loading branch information
echesakov authored Jan 6, 2021
1 parent 81d58ab commit 73bce55
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 143 deletions.
50 changes: 25 additions & 25 deletions src/coreclr/inc/corjitflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CORJIT_FLAGS
CORJIT_FLAG_MAKEFINALCODE = 18, // Use the final code generator, i.e., not the interpreter.
CORJIT_FLAG_READYTORUN = 19, // Use version-resilient code generation
CORJIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues
CORJIT_FLAG_PROF_REJIT_NOPS = 21, // Insert NOPs to ensure code is re-jitable
CORJIT_FLAG_UNUSED11 = 21,
CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining
CORJIT_FLAG_SKIP_VERIFICATION = 23, // (lazy) skip verification - determined without doing a full resolve. See comment below
CORJIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine.
Expand All @@ -81,43 +81,43 @@ class CORJIT_FLAGS
CORJIT_FLAG_FRAMED = 31, // All methods have an EBP frame
CORJIT_FLAG_ALIGN_LOOPS = 32, // add NOPs before loops to align them at 16 byte boundaries
CORJIT_FLAG_PUBLISH_SECRET_PARAM = 33, // JIT must place stub secret param into local 0. (used by IL stubs)
CORJIT_FLAG_UNUSED11 = 34,
CORJIT_FLAG_UNUSED12 = 34,
CORJIT_FLAG_SAMPLING_JIT_BACKGROUND = 35, // JIT is being invoked as a result of stack sampling for hot methods in the background
CORJIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
CORJIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
CORJIT_FLAG_UNUSED12 = 38,
CORJIT_FLAG_UNUSED13 = 38,
CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code

#if defined(TARGET_ARM)
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records
#else // !defined(TARGET_ARM)
CORJIT_FLAG_UNUSED13 = 41,
CORJIT_FLAG_UNUSED14 = 41,
#endif // !defined(TARGET_ARM)

CORJIT_FLAG_NO_INLINING = 42, // JIT should not inline any called method into this method

CORJIT_FLAG_UNUSED14 = 43,
CORJIT_FLAG_UNUSED15 = 44,
CORJIT_FLAG_UNUSED16 = 45,
CORJIT_FLAG_UNUSED17 = 46,
CORJIT_FLAG_UNUSED18 = 47,
CORJIT_FLAG_UNUSED19 = 48,
CORJIT_FLAG_UNUSED20 = 49,
CORJIT_FLAG_UNUSED21 = 50,
CORJIT_FLAG_UNUSED22 = 51,
CORJIT_FLAG_UNUSED23 = 52,
CORJIT_FLAG_UNUSED24 = 53,
CORJIT_FLAG_UNUSED25 = 54,
CORJIT_FLAG_UNUSED26 = 55,
CORJIT_FLAG_UNUSED27 = 56,
CORJIT_FLAG_UNUSED28 = 57,
CORJIT_FLAG_UNUSED29 = 58,
CORJIT_FLAG_UNUSED30 = 59,
CORJIT_FLAG_UNUSED31 = 60,
CORJIT_FLAG_UNUSED32 = 61,
CORJIT_FLAG_UNUSED33 = 62,
CORJIT_FLAG_UNUSED34 = 63
CORJIT_FLAG_UNUSED15 = 43,
CORJIT_FLAG_UNUSED16 = 44,
CORJIT_FLAG_UNUSED17 = 45,
CORJIT_FLAG_UNUSED18 = 46,
CORJIT_FLAG_UNUSED19 = 47,
CORJIT_FLAG_UNUSED20 = 48,
CORJIT_FLAG_UNUSED21 = 49,
CORJIT_FLAG_UNUSED22 = 50,
CORJIT_FLAG_UNUSED23 = 51,
CORJIT_FLAG_UNUSED24 = 52,
CORJIT_FLAG_UNUSED25 = 53,
CORJIT_FLAG_UNUSED26 = 54,
CORJIT_FLAG_UNUSED27 = 55,
CORJIT_FLAG_UNUSED28 = 56,
CORJIT_FLAG_UNUSED29 = 57,
CORJIT_FLAG_UNUSED30 = 58,
CORJIT_FLAG_UNUSED31 = 59,
CORJIT_FLAG_UNUSED32 = 60,
CORJIT_FLAG_UNUSED33 = 61,
CORJIT_FLAG_UNUSED34 = 62,
CORJIT_FLAG_UNUSED35 = 63
};

CORJIT_FLAGS()
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/jiteeversionguid.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////

constexpr GUID JITEEVersionIdentifier = { /* a7bb194e-4e7c-4850-af12-ea9f30ea5a13 */
0xa7bb194e,
0x4e7c,
0x4850,
{0xaf, 0x12, 0xea, 0x9f, 0x30, 0xea, 0x5a, 0x13}
constexpr GUID JITEEVersionIdentifier = { /* 89b87d02-e032-4f00-b5cf-dfdee25bbae2 */
0x89b87d02,
0xe032,
0x4f00,
{0xb5, 0xcf, 0xdf, 0xde, 0xe2, 0x5b, 0xba, 0xe2}
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,6 @@ class CodeGen final : public CodeGenInterface
void genProfilingLeaveCallback(unsigned helper);
#endif // PROFILING_SUPPORTED

void genPrologPadForReJit();

// clang-format off
void genEmitCall(int callType,
CORINFO_METHOD_HANDLE methHnd,
Expand Down Expand Up @@ -1369,9 +1367,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
void instInit();

void instGen(instruction ins);
#ifdef TARGET_XARCH
void instNop(unsigned size);
#endif

void inst_JMP(emitJumpKind jmp, BasicBlock* tgtBlock);

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9695,11 +9695,6 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
instGen_Set_Reg_To_Imm(EA_PTRSIZE, rOffset, -(ssize_t)pageSize);
instGen_Set_Reg_To_Imm(EA_PTRSIZE, rLimit, -(ssize_t)frameSize);

//
// Can't have a label inside the ReJIT padding area
//
genPrologPadForReJit();

// There's a "virtual" label here. But we can't create a label in the prolog, so we use the magic
// `emitIns_J` with a negative `instrCount` to branch back a specific number of instructions.

Expand Down
52 changes: 4 additions & 48 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6952,41 +6952,6 @@ ret

*****************************************************************************/

/*****************************************************************************
*
* Generates appropriate NOP padding for a function prolog to support ReJIT.
*/

void CodeGen::genPrologPadForReJit()
{
assert(compiler->compGeneratingProlog);

#ifdef TARGET_XARCH
if (!compiler->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PROF_REJIT_NOPS))
{
return;
}

#if defined(FEATURE_EH_FUNCLETS)

// No need to generate pad (nops) for funclets.
// When compiling the main function (and not a funclet)
// the value of funCurrentFunc->funKind is equal to FUNC_ROOT.
if (compiler->funCurrentFunc()->funKind != FUNC_ROOT)
{
return;
}

#endif // FEATURE_EH_FUNCLETS

unsigned size = GetEmitter()->emitGetPrologOffsetEstimate();
if (size < 5)
{
instNop(5 - size);
}
#endif
}

/*****************************************************************************
*
* Reserve space for a function prolog.
Expand Down Expand Up @@ -7987,17 +7952,10 @@ void CodeGen::genFnProlog()

if (!GetInterruptible())
{
/*-------------------------------------------------------------------------
*
* The 'real' prolog ends here for non-interruptible methods.
* For fully-interruptible methods, we extend the prolog so that
* we do not need to track GC inforation while shuffling the
* arguments.
*
* Make sure there's enough padding for ReJIT.
*
*/
genPrologPadForReJit();
// The 'real' prolog ends here for non-interruptible methods.
// For fully-interruptible methods, we extend the prolog so that
// we do not need to track GC inforation while shuffling the
// arguments.
GetEmitter()->emitMarkPrologEnd();
}

Expand Down Expand Up @@ -8112,12 +8070,10 @@ void CodeGen::genFnProlog()

//
// Increase the prolog size here only if fully interruptible.
// And again make sure it's big enough for ReJIT
//

if (GetInterruptible())
{
genPrologPadForReJit();
GetEmitter()->emitMarkPrologEnd();
}
if (compiler->opts.compScopeInfo && (compiler->info.compVarScopesCount > 0))
Expand Down
15 changes: 0 additions & 15 deletions src/coreclr/jit/codegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,8 +2009,6 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
GetEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_STACK_PROBE_HELPER_ARG, REG_SPBASE, spOffset);
regSet.verifyRegUsed(REG_STACK_PROBE_HELPER_ARG);

// Can't have a call until we have enough padding for ReJit.
genPrologPadForReJit();
genEmitHelperCall(CORINFO_HELP_STACK_PROBE, 0, EA_UNKNOWN);

if (compiler->info.compPublishStubParam)
Expand All @@ -2029,8 +2027,6 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni
GetEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_STACK_PROBE_HELPER_ARG, REG_SPBASE, -(int)frameSize);
regSet.verifyRegUsed(REG_STACK_PROBE_HELPER_ARG);

// Can't have a call until we have enough padding for ReJit.
genPrologPadForReJit();
genEmitHelperCall(CORINFO_HELP_STACK_PROBE, 0, EA_UNKNOWN);

if (initReg == REG_DEFAULT_HELPER_CALL_TARGET)
Expand Down Expand Up @@ -8492,11 +8488,6 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed)
inst_IV(INS_push, (size_t)compiler->compProfilerMethHnd);
}

//
// Can't have a call until we have enough padding for rejit
//
genPrologPadForReJit();

// This will emit either
// "call ip-relative 32-bit offset" or
// "mov rax, helper addr; call rax"
Expand Down Expand Up @@ -8698,9 +8689,6 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed)
int callerSPOffset = compiler->lvaToCallerSPRelativeOffset(0, isFramePointerUsed());
GetEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_ARG_1, genFramePointerReg(), -callerSPOffset);

// Can't have a call until we have enough padding for rejit
genPrologPadForReJit();

// This will emit either
// "call ip-relative 32-bit offset" or
// "mov rax, helper addr; call rax"
Expand Down Expand Up @@ -8788,9 +8776,6 @@ void CodeGen::genProfilingEnterCallback(regNumber initReg, bool* pInitRegZeroed)
int callerSPOffset = compiler->lvaToCallerSPRelativeOffset(0, isFramePointerUsed());
GetEmitter()->emitIns_R_AR(INS_lea, EA_PTRSIZE, REG_PROFILER_ENTER_ARG_1, genFramePointerReg(), -callerSPOffset);

// Can't have a call until we have enough padding for rejit
genPrologPadForReJit();

// We can use any callee trash register (other than RAX, RDI, RSI) for call target.
// We use R11 here. This will emit either
// "call ip-relative 32-bit offset" or
Expand Down
13 changes: 0 additions & 13 deletions src/coreclr/jit/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,19 +221,6 @@ bool CodeGenInterface::instIsFP(instruction ins)
#endif
}

#ifdef TARGET_XARCH
/*****************************************************************************
*
* Generate a multi-byte NOP instruction.
*/

void CodeGen::instNop(unsigned size)
{
assert(size <= 15);
GetEmitter()->emitIns_Nop(size);
}
#endif

/*****************************************************************************
*
* Generate a jump instruction.
Expand Down
51 changes: 25 additions & 26 deletions src/coreclr/jit/jitee.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class JitFlags
JIT_FLAG_MAKEFINALCODE = 18, // Use the final code generator, i.e., not the interpreter.
JIT_FLAG_READYTORUN = 19, // Use version-resilient code generation
JIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues
JIT_FLAG_PROF_REJIT_NOPS = 21, // Insert NOPs to ensure code is re-jitable
JIT_FLAG_UNUSED11 = 21,
JIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining
JIT_FLAG_SKIP_VERIFICATION = 23, // (lazy) skip verification - determined without doing a full resolve. See comment below
JIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine.
Expand All @@ -65,43 +65,43 @@ class JitFlags
JIT_FLAG_FRAMED = 31, // All methods have an EBP frame
JIT_FLAG_ALIGN_LOOPS = 32, // add NOPs before loops to align them at 16 byte boundaries
JIT_FLAG_PUBLISH_SECRET_PARAM = 33, // JIT must place stub secret param into local 0. (used by IL stubs)
JIT_FLAG_UNUSED11 = 34,
JIT_FLAG_UNUSED12 = 34,
JIT_FLAG_SAMPLING_JIT_BACKGROUND = 35, // JIT is being invoked as a result of stack sampling for hot methods in the background
JIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
JIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
JIT_FLAG_UNUSED12 = 38,
JIT_FLAG_UNUSED13 = 38,
JIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
JIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code

#if defined(TARGET_ARM)
JIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records
#else // !defined(TARGET_ARM)
JIT_FLAG_UNUSED13 = 41,
JIT_FLAG_UNUSED14 = 41,
#endif // !defined(TARGET_ARM)

JIT_FLAG_NO_INLINING = 42, // JIT should not inline any called method into this method

JIT_FLAG_UNUSED14 = 43,
JIT_FLAG_UNUSED15 = 44,
JIT_FLAG_UNUSED16 = 45,
JIT_FLAG_UNUSED17 = 46,
JIT_FLAG_UNUSED18 = 47,
JIT_FLAG_UNUSED19 = 48,
JIT_FLAG_UNUSED20 = 49,
JIT_FLAG_UNUSED21 = 50,
JIT_FLAG_UNUSED22 = 51,
JIT_FLAG_UNUSED23 = 52,
JIT_FLAG_UNUSED24 = 53,
JIT_FLAG_UNUSED25 = 54,
JIT_FLAG_UNUSED26 = 55,
JIT_FLAG_UNUSED27 = 56,
JIT_FLAG_UNUSED28 = 57,
JIT_FLAG_UNUSED29 = 58,
JIT_FLAG_UNUSED30 = 59,
JIT_FLAG_UNUSED31 = 60,
JIT_FLAG_UNUSED32 = 61,
JIT_FLAG_UNUSED33 = 62,
JIT_FLAG_UNUSED34 = 63
JIT_FLAG_UNUSED15 = 43,
JIT_FLAG_UNUSED16 = 44,
JIT_FLAG_UNUSED17 = 45,
JIT_FLAG_UNUSED18 = 46,
JIT_FLAG_UNUSED19 = 47,
JIT_FLAG_UNUSED20 = 48,
JIT_FLAG_UNUSED21 = 49,
JIT_FLAG_UNUSED22 = 50,
JIT_FLAG_UNUSED23 = 51,
JIT_FLAG_UNUSED24 = 52,
JIT_FLAG_UNUSED25 = 53,
JIT_FLAG_UNUSED26 = 54,
JIT_FLAG_UNUSED27 = 55,
JIT_FLAG_UNUSED28 = 56,
JIT_FLAG_UNUSED29 = 57,
JIT_FLAG_UNUSED30 = 58,
JIT_FLAG_UNUSED31 = 59,
JIT_FLAG_UNUSED32 = 60,
JIT_FLAG_UNUSED33 = 61,
JIT_FLAG_UNUSED34 = 62,
JIT_FLAG_UNUSED35 = 63

};
// clang-format on
Expand Down Expand Up @@ -191,7 +191,6 @@ class JitFlags
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_MAKEFINALCODE, JIT_FLAG_MAKEFINALCODE);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_READYTORUN, JIT_FLAG_READYTORUN);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PROF_ENTERLEAVE, JIT_FLAG_PROF_ENTERLEAVE);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PROF_REJIT_NOPS, JIT_FLAG_PROF_REJIT_NOPS);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PROF_NO_PINVOKE_INLINE, JIT_FLAG_PROF_NO_PINVOKE_INLINE);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_SKIP_VERIFICATION, JIT_FLAG_SKIP_VERIFICATION);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_PREJIT, JIT_FLAG_PREJIT);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ public enum CorJitFlag : uint
CORJIT_FLAG_MAKEFINALCODE = 18, // Use the final code generator, i.e., not the interpreter.
CORJIT_FLAG_READYTORUN = 19, // Use version-resilient code generation
CORJIT_FLAG_PROF_ENTERLEAVE = 20, // Instrument prologues/epilogues
CORJIT_FLAG_PROF_REJIT_NOPS = 21, // Insert NOPs to ensure code is re-jitable
CORJIT_FLAG_UNUSED7 = 21,
CORJIT_FLAG_PROF_NO_PINVOKE_INLINE = 22, // Disables PInvoke inlining
CORJIT_FLAG_SKIP_VERIFICATION = 23, // (lazy) skip verification - determined without doing a full resolve. See comment below
CORJIT_FLAG_PREJIT = 24, // jit or prejit is the execution engine.
Expand Down

0 comments on commit 73bce55

Please sign in to comment.