std: Flag run_fmt() as #[inline(always)]

This function is a tiny wrapper that LLVM doesn't want to inline, and it ends up
causing more bloat than necessary. The bloat is pretty small, but it's a win of
at least 7k for small executables, and I imagine that the number goes up as
there are more calls to fail!().
This commit is contained in:
Alex Crichton 2014-02-27 21:11:50 -08:00
parent 79e6ab54d1
commit ddc1c21264

View file

@ -149,7 +149,14 @@ macro_rules! fail(
// function to pass to format_args!, *and* we need the
// file and line numbers right here; so an inner bare fn
// is our only choice.
#[inline]
//
// LLVM doesn't tend to inline this, presumably because begin_unwind_fmt
// is #[cold] and #[inline(never)] and because this is flagged as cold
// as returning !. We really do want this to be inlined, however,
// because it's just a tiny wrapper. Small wins (156K to 149K in size)
// were seen when forcing this to be inlined, and that number just goes
// up with the number of calls to fail!()
#[inline(always)]
fn run_fmt(fmt: &::std::fmt::Arguments) -> ! {
::std::rt::begin_unwind_fmt(fmt, file!(), line!())
}