![](https://res.cloudinary.com/techfeed/image//fetch/w_280,h_210,c_fill/https%3A%2F%2Fmcyoung.xyz%2Fog%2Fcalling-convention-04eff0c6b00d89e8041f91f2dd6af487ea2e3cc0.png)
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…
RustのABIの微妙なところを挙げて改善できるんじゃないという記事。ただ記事中でも言及があるように手続間レジスタアロケーションの最適化とかはコンパイル時間的にきついしリンクするときどうするとかあるから難しいね。記事にあるようにPGOとかならワンチャン