diff --git a/src/coreclr/jit/fgbasic.cpp b/src/coreclr/jit/fgbasic.cpp index 57001a3a5fb471..950663dda4f993 100644 --- a/src/coreclr/jit/fgbasic.cpp +++ b/src/coreclr/jit/fgbasic.cpp @@ -2220,6 +2220,7 @@ void Compiler::fgAdjustForAddressExposedOrWrittenThis() // Optionally enable adjustment during stress. if (compStressCompile(STRESS_GENERIC_VARN, 15)) { + JITDUMP("JitStress: creating modifiable `this`\n"); thisVarDsc->lvHasILStoreOp = true; } diff --git a/src/coreclr/jit/importer.cpp b/src/coreclr/jit/importer.cpp index dff1e50a2f4231..21ca59fea1161f 100644 --- a/src/coreclr/jit/importer.cpp +++ b/src/coreclr/jit/importer.cpp @@ -15665,7 +15665,13 @@ void Compiler::impImportBlockCode(BasicBlock* block) constraintCall ? &constrainedResolvedToken : nullptr, returnFalseIfInvalid); - if (passedConstraintCheck) + // Avoid setting compHasBackwardsJump = true via tail call stress if the method cannot have + // patchpoints. + // + const bool mayHavePatchpoints = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && + (JitConfig.TC_OnStackReplacement() > 0) && + compCanHavePatchpoints(); + if (passedConstraintCheck && (mayHavePatchpoints || compHasBackwardJump)) { // Now check with the runtime CORINFO_METHOD_HANDLE declaredCalleeHnd = callInfo.hMethod;