mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 11:33:04 +00:00
auto merge of #11550 : alexcrichton/rust/noinline, r=thestinger
The failure functions are generic, meaning they're candidates for getting inlined across crates. This has been happening, leading to monstrosities like that found in #11549. I have verified that the codegen is *much* better now that we're not inlining the failure path (the slow path).
This commit is contained in:
commit
149fc76698
@ -364,6 +364,7 @@ pub mod eabi {
|
|||||||
/// This is the entry point of unwinding for things like lang items and such.
|
/// This is the entry point of unwinding for things like lang items and such.
|
||||||
/// The arguments are normally generated by the compiler, and need to
|
/// The arguments are normally generated by the compiler, and need to
|
||||||
/// have static lifetimes.
|
/// have static lifetimes.
|
||||||
|
#[inline(never)] #[cold] // this is the slow path, please never inline this
|
||||||
pub fn begin_unwind_raw(msg: *c_char, file: *c_char, line: size_t) -> ! {
|
pub fn begin_unwind_raw(msg: *c_char, file: *c_char, line: size_t) -> ! {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn static_char_ptr(p: *c_char) -> &'static str {
|
fn static_char_ptr(p: *c_char) -> &'static str {
|
||||||
@ -381,6 +382,7 @@ pub fn begin_unwind_raw(msg: *c_char, file: *c_char, line: size_t) -> ! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// This is the entry point of unwinding for fail!() and assert!().
|
/// This is the entry point of unwinding for fail!() and assert!().
|
||||||
|
#[inline(never)] #[cold] // this is the slow path, please never inline this
|
||||||
pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> ! {
|
pub fn begin_unwind<M: Any + Send>(msg: M, file: &'static str, line: uint) -> ! {
|
||||||
// Note that this should be the only allocation performed in this block.
|
// Note that this should be the only allocation performed in this block.
|
||||||
// Currently this means that fail!() on OOM will invoke this code path,
|
// Currently this means that fail!() on OOM will invoke this code path,
|
||||||
|
Loading…
Reference in New Issue
Block a user