Open scottmcm opened 2 years ago
I'm very excited about this, thank you for your work on this!
Couple comments:
foo
in this example, it seems to be trying to return the result in rax
and rdx
, but then it calls pop rdx
which clobbers the return value.coldcc
is suitable for "never runs" things like panics. For "runs rarely (amortized)" things, LLVM's preserve_mostcc
seems like it is often a better fit. (A primary difference is that coldcc
saves all XMM registers, whereas preserve_mostcc
does not.) It has the added advantage of being exposed to C++ in Clang, and seems to be used in some popular codebases (V8, Folly), so it might be better exercised/tested than the coldcc
convention. Would it be possible to have a "rust-cool" variant too, which uses preserve_mostcc
?
This is a tracking issue for the experimental
extern "rust-cold"
ABI. The feature gate for the issue is#![feature(rust_cold_cc)]
.This allows emitting functions with
coldcc
in LLVM andCallConv::Cold
in cranelift. These are more aggressive than the stable#[cold]
, as they can use a different calling convention (and thus have incompatiblefn
s), not just affect branch weights -- for example, they might require more/slower code in the callee in exchange for smaller call sites.About tracking issues
Tracking issues are used to record the overall progress of implementation. They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
Unresolved Questions
coldcc
,preservemost_cc
, or something else in LLVM?clang::preserve_most
but nothing named "cold", FWIW: https://clang.llvm.org/docs/AttributeReference.html#calling-conventionsImplementation history
coldcc
https://github.com/rust-lang/rust/pull/115260extern "C"
improper ctypes lint, since this is a Rust ABI