The Rust Calling Convention We Deserve · mcyoung
BRANK

I will often say that the so-called “C ABI” is a very bad one, and a relatively unimaginative one when it comes to passing complicated types effectively. A lot of people ask me “ok, what would you use instead”, and I just point them to the Go register ABI, but it seems most people have trouble filling in the gaps of what I mean. This article explains what I mean in detail.I have discussed calling conventions in the past, but as a reminder: the calling convention is the part of the ABI that concerns itself with how to pass arguments to and from a function, and how to actually call a function. This includes which registers arguments go in, which registers values are returned out of, what function prologues/epilogues look like, how unwinding works, etc.This particular post is primarily about x86, but I intend to be reasonably generic (so that what I’ve written applies just as well to ARM, RISC-V, etc). I will assume a general familiarity with x86 assembly, LLVM IR, and Rust (but not…

mcyoung.xyz
Related Topics: Rust
1 comments
  • RustのABIの微妙なところを挙げて改善できるんじゃないという記事。ただ記事中でも言及があるように手続間レジスタアロケーションの最適化とかはコンパイル時間的にきついしリンクするときどうするとかあるから難しいね。記事にあるようにPGOとかならワンチャン