The Rust calling convention we deserve (2024)
mcyoung.xyz
mcyoung.xyz
Whether the array is passed in registers or pointers can be chosen by the compiler based on factors like profile guided optimization. That the ABI isn't stable doesn't matter because the linker handles it for the programmer.
This is all publicly documented in the llvm docs too so you can write your own loader.
I personally think this was one of the most important changes Rust made; without it, Rust would have been interesting but would not have been able to compete directly with C and C++ for systems programming.
Would we have gotten to "optional"? Maybe! But it's hard to predict the counterfactual, especially when substantial success usually has components of both design and luck/right-place-right-time. Rust hit a sweet spot, and it's not clear how a different history of Rust would have turned out.
the lack of a runtime means it can go a lot of places Go cannot, e.g. other languages can use rust's build artifacts easily and safely with roughly as much performance as is possible. Go is a dead end in that sense.
Thanks for articulating what I’ve failed to do for a decade.
I've yet to read an article criticizing the so-called C ABI that doesn't end up effectively changing the problem statement (in this case, into something utterly incomparable), as opposed to providing a better solution to the same problem. Changing the problem statement is often how you arrive at better solutions overall, but don't try to sell it as something it isn't, insinuating that the pre-existing solution is stupid.
> for functions where it's deemed too costly to inline, but which aren't externally visible
in LTO mode, gcc doesI know that LLVM completely dominates compilation time, but maybe the improvements from this could make the other bits (i.e. compiling rustc with callconv=fast) fast enough to make up the difference?
The Rust calling convention we deserve - https://news.ycombinator.com/item?id=40081314 - April 2024 (137 comments)