Remove JIT_FLAG_PROF_REJIT_NOPS (#46560)
authorEgor Chesakov <Egor.Chesakov@microsoft.com>
Wed, 6 Jan 2021 01:16:15 +0000 (17:16 -0800)
committerGitHub <noreply@github.com>
Wed, 6 Jan 2021 01:16:15 +0000 (17:16 -0800)
* 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

src/coreclr/inc/corjitflags.h
src/coreclr/inc/jiteeversionguid.h
src/coreclr/jit/codegen.h
src/coreclr/jit/codegenarm64.cpp
src/coreclr/jit/codegencommon.cpp
src/coreclr/jit/codegenxarch.cpp
src/coreclr/jit/instr.cpp
src/coreclr/jit/jitee.h
src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs

index 76f8816..83cbc20 100644 (file)
@@ -68,7 +68,7 @@ public:
         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.
@@ -81,43 +81,43 @@ public:
         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()
index 26cb25e..7658232 100644 (file)
 //
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-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}
 };
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
index 6c24428..9deffd0 100644 (file)
@@ -449,8 +449,6 @@ protected:
     void genProfilingLeaveCallback(unsigned helper);
 #endif // PROFILING_SUPPORTED
 
-    void genPrologPadForReJit();
-
     // clang-format off
     void genEmitCall(int                   callType,
                      CORINFO_METHOD_HANDLE methHnd,
@@ -1369,9 +1367,6 @@ public:
     void instInit();
 
     void instGen(instruction ins);
-#ifdef TARGET_XARCH
-    void instNop(unsigned size);
-#endif
 
     void inst_JMP(emitJumpKind jmp, BasicBlock* tgtBlock);
 
index 951fbbc..dcd3e08 100644 (file)
@@ -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.
 
index 6dce5cf..d6eebc9 100644 (file)
@@ -6954,41 +6954,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.
  */
 
@@ -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();
     }
 
@@ -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))
index b3cc225..79b1384 100644 (file)
@@ -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)
@@ -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)
@@ -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"
@@ -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"
@@ -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
index 9445f01..b78adf8 100644 (file)
@@ -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.
index c11c202..2985361 100644 (file)
@@ -52,7 +52,7 @@ public:
         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.
@@ -65,43 +65,43 @@ public:
         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
@@ -191,7 +191,6 @@ public:
         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);
index 66b04f6..07d29f4 100644 (file)
@@ -1296,7 +1296,7 @@ namespace Internal.JitInterface
         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.