Skip to content

Conversation

pmur
Copy link
Contributor

@pmur pmur commented Aug 28, 2025

I propose stabilizing the -Zno-jump-tables option into -Cjump-tables=.

-Zno-jump-tables stabilization report

What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized?

No RFC was created for this option. This was a narrowly scoped option introduced in #105812 to support code generation requirements of the x86-64 linux kernel, and eventually other targets as Rust For Linux grows.

The tracking is #116592.

What behavior are we committing to that has been controversial? Summarize the major arguments pro/con.

The behavior of this flag is well defined, and mimics the existing -fno-jump-tables option currently available with LLVM and GCC.

  • What should the flag name be?
    As introduced, this option was named -Zno-jump-tables. However, other major toolchains allow both positive and negative variants of this option to toggle this feature. Renaming the option to -Cjump-tables=<bool> makes this option consistent, and if for some reason, expandable to other arguments in the future. Notably, many LLVM targets have a configurable and different thresholds for when to lower into a jump table.

Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those.

No. This option is used exclusively to gate a very specific class of optimization.

Summarize the major parts of the implementation and provide links into the code (or to PRs)

Has a call-for-testing period been conducted? If so, what feedback was received?

No. The option has originally created is being used by Rust For Linux to build the x86-64 kernel without issue.

What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking?

There are no outstanding issues.

Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization

What FIXMEs are still in the code for that feature and why is it ok to leave them there?

There are none.

What static checks are done that are needed to prevent undefined behavior?

This option cannot cause undefined behavior. It is a boolean option with well defined behavior in both cases.

In what way does this feature interact with the reference/specification, and are those edits prepared?

This adds a new cli option to rustc. The documentation is updated, and the unstable documentation cleaned up in this PR.

Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries?

No.

What other unstable features may be exposed by this feature?

None.

What is tooling support like for this feature, w.r.t rustdoc, clippy, rust-analzyer, rustfmt, etc.?

No support is required from other rust tooling.

Open Items

  • Are there objections renaming -Zno-jump-tables to -Zjump-tables=<bool>?
  • Is it desirable to keep -Zno-jump-tables for a period of time?

Closes #116592

pmur added 2 commits August 28, 2025 15:59
Both gcc and llvm accept -fjump-tables as well as -fno-jump-tables. For
consistency, allow rustc to accept -Zjump-tables=yes too.
@rustbot
Copy link
Collaborator

rustbot commented Aug 28, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking Issue for no-jump-tables
3 participants