rust-lang / rust-lang/rust

Tracking issue for refactoring the way we represent function call ABIs

Open
#119,183 28 comments 3 reactions 1 assignee View on GitHub

@workingjubilee is already working on this.

Since Oct 17, 2024.

A-ABI C-cleanup C-tracking-issue T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

View all comments

This is the issue tracking implementation of https://github.com/rust-lang/compiler-team/issues/672. Note that we do not have a final design yet; the best way to represent call ABI, and to disentangle it from the "storage kind" of a type (which is what the Abi type currently largely represents) is yet to be determined.

Note that for the purposes of this, by "call ABI" I mean "the target-independent information that is necessary and sufficient to compute how arguments and returns values are passed between caller and callee". The perfect end state (that we may or may not ever reach) for this would be to say that two types are ABI compatible if and only if the computed call ABI information for them is the same -- that would be very nice for the spec and for MiniRust, anyway.

I do not mean "the target-specific information saying which arguments are passed in which register / on the stack, which are copied and which are passed indirectly". This already exists to some extend as a concept in rustc, called PassMode. It may need some reforming, but that would be a separate discussion.

  • The core need is that a Rust type must have its ABI computed in a manner that is not reimplemented for every target and every codegen backend. e.g. the traversal over types should skip repr(transparent) in essentially every case. Then every target architecture must be ported to it:
    • aarch64
    • arm
    • csky
    • loongarch
    • loongarch64
    • mips
    • mips64
    • powerpc
    • powerpc64
    • riscv32
    • riscv64
    • sparc
    • sparc64
    • x86
    • x86_64
  • layout.abi is not about actual ABI, but only about IR codegen: handling the types as SSA values versus handling them as memory locations.

See in particular this comment.

Implementation history

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.