Don't add nop padding for rejitting a funclet prolog.
authorLubomir Litchev <lubol@microsoft.com>
Fri, 1 Apr 2016 06:15:21 +0000 (23:15 -0700)
committerLubomir Litchev <lubol@microsoft.com>
Fri, 1 Apr 2016 19:21:48 +0000 (12:21 -0700)
This is along standing issue in RyuJit. When ngenning the crossgen tool
passes CORJIT_FLG_PROF_REJIT_NOPS flag. The padding for rejitting should
be added only for the main function and not the funclets when compiling a
method. Trying to generate a rejit padding for a funclet in debug and
checked build results in a failing assertion.

Fixes issue 3601.

src/jit/codegencommon.cpp

index 2349994..d4eefac 100644 (file)
@@ -7619,7 +7619,22 @@ void CodeGen::genPrologPadForReJit()
 
 #ifdef _TARGET_XARCH_
     if (!(compiler->opts.eeFlags & CORJIT_FLG_PROF_REJIT_NOPS))
+    {
         return;
+    }
+
+#if 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)
     {