summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-02-27 21:11:50 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-02-28 12:24:50 -0800
commitddc1c21264898f6a5d12cf03bba30f1f08b73665 (patch)
tree822315122c85b273e7deb426d6f08206edf3430f /src/libstd
parent79e6ab54d13b8a5b8c17093186c39e493784bdc6 (diff)
downloadrust-ddc1c21264898f6a5d12cf03bba30f1f08b73665.tar.gz
rust-ddc1c21264898f6a5d12cf03bba30f1f08b73665.zip
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!().
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/macros.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 490f2c9b198..a2e80a180ea 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -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!())
         }