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.
Commit migrated from https://github.com/dotnet/coreclr/commit/
40409548f182d26c75a0b850484c660ab5987281
#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)
{