JIT: don't stress-tailcall named intrinsics (#122479)#128336
Open
AndyAyersMS wants to merge 1 commit into
Open
JIT: don't stress-tailcall named intrinsics (#122479)#128336AndyAyersMS wants to merge 1 commit into
AndyAyersMS wants to merge 1 commit into
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates CoreCLR JIT tailcall-stress handling to avoid treating intrinsic calls as explicit tailcalls, and removes the corresponding temporary runtime workaround.
Changes:
- JIT importer: gate tailcall-stress “explicit tailcall” promotion on
CORINFO_FLG_INTRINSIC. - System.Private.CoreLib: remove the temporary
[MethodImpl(NoInlining | NoOptimization)]workaround onThread.ClearWaitSleepJoinState().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/jit/importer.cpp | Skips stress tailcall promotion for intrinsic callees to avoid later-phase inconsistencies/asserts. |
| src/coreclr/System.Private.CoreLib/src/System/Threading/Thread.CoreCLR.cs | Removes prior workaround attributes/comment from ClearWaitSleepJoinState. |
Under STRESS_TAILCALL the importer marks call+ret patterns with PREFIX_TAILCALL_EXPLICIT (and may later add PREFIX_TAILCALL_IMPLICIT) before it knows whether the callee is a named intrinsic. For intrinsics that are imported as non-CALL IR (e.g. GC.KeepAlive -> GT_KEEPALIVE), this leaves a BBJ_RETURN block whose last statement is neither a GT_RETURN nor a GT_CALL, which trips an assert in fgInsertStmtNearEnd when `Insert GC Polls` later runs on methods that contain [SuppressGCTransition] calls (e.g. Thread.ClearWaitSleepJoinState). Fix by treating intrinsic callees as having failed stress-mode validation: set passedStressModeValidation = false so neither the explicit nor the subsequent implicit tailcall promotion is applied to them. Removes the temporary workaround in Thread.CoreCLR.cs added by dotnet#122652, and adds a small JitBlue regression test that exercises the Thread.Sleep -> Thread.ClearWaitSleepJoinState path so the jitstress legs will catch any future regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fcd8716 to
429afcc
Compare
Member
Author
|
Fixes #122479 |
This was referenced May 19, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Under STRESS_TAILCALL the importer marks call+ret patterns with PREFIX_TAILCALL_EXPLICIT before it knows whether the callee is a named intrinsic. For intrinsics that are imported as non-CALL IR (e.g. GC.KeepAlive -> GT_KEEPALIVE), this leaves a BBJ_RETURN block whose last statement is neither a GT_RETURN nor a GT_CALL, which trips an assert in fgInsertStmtNearEnd when
Insert GC Pollslater runs on methods that contain [SuppressGCTransition] calls (e.g. Thread.ClearWaitSleepJoinState).Fix by skipping stress-tailcall promotion when the callee has CORINFO_FLG_INTRINSIC set.
Removes the temporary workaround in Thread.CoreCLR.cs added by #122652.
Fixes #122479