Skip to content

Display the IL 'tail.' prefix in C# output - #3818

Merged
siegfriedpammer merged 1 commit into
masterfrom
worktree-tail-call-display
Jun 24, 2026
Merged

Display the IL 'tail.' prefix in C# output#3818
siegfriedpammer merged 1 commit into
masterfrom
worktree-tail-call-display

Conversation

@siegfriedpammer

@siegfriedpammer siegfriedpammer commented Jun 24, 2026

Copy link
Copy Markdown
Member

Fixes #3817.

F# emits tail calls pervasively, but the IL tail. prefix was dropped entirely at the C# output stage, so the information never reached the decompiled text. This surfaces it as an inline /*tail.*/ marker before the call:

public static int Caller(int x)
{
    return /*tail.*/Callee(x);
}

The flag (CallInstruction.IsTail) was already tracked end-to-end through the IL pipeline; it was simply discarded when the call became a C# invocation. The implementation mirrors the existing constrained.-prefix comment already emitted in CallBuilder.

Notes

  • Always on, no setting/toggle.
  • No existing fixtures contain a real tail. opcode (the "tail" hits in the F# fixtures are get_TailOrNull() substrings), so the change has zero churn on the rest of the suite.
  • calli (CallIndirect) does not model IsTail, so tail-prefixed indirect calls are not marked (rare; out of scope).

Test

New ILPretty fixture TailCall.il/TailCall.cs exercising a tail. call followed by ret.


🤖 This PR was prepared by Claude Code (claude-opus-4-8) on behalf of @siegfriedpammer.

F# emits tail calls pervasively, but the 'tail.' prefix was dropped
entirely at the C# output stage, so the information never reached the
decompiled text. Render it inline as '/*tail.*/' before the call,
mirroring the existing 'constrained.' prefix comment in CallBuilder.

Fix #3817

Assisted-by: Claude:claude-opus-4-8:Claude Code
@siegfriedpammer
siegfriedpammer merged commit 99888eb into master Jun 24, 2026
13 checks passed
@siegfriedpammer
siegfriedpammer deleted the worktree-tail-call-display branch June 27, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display tail call option

1 participant