Skip to content

Commit

Permalink
vec: rm inline(never) hack
Browse files Browse the repository at this point in the history
just avoid giving an inline hint in the first place
  • Loading branch information
thestinger committed Jul 11, 2013
1 parent fd5f8d9 commit 00da76d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/libstd/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,6 @@ impl<T> OwnedVector<T> for ~[T] {
*
* * n - The number of elements to reserve space for
*/
#[inline]
#[cfg(stage0)]
fn reserve(&mut self, n: uint) {
// Only make the (slow) call into the runtime if we have to
Expand Down Expand Up @@ -1170,7 +1169,6 @@ impl<T> OwnedVector<T> for ~[T] {
*
* * n - The number of elements to reserve space for
*/
#[inline]
#[cfg(not(stage0))]
fn reserve(&mut self, n: uint) {
// Only make the (slow) call into the runtime if we have to
Expand Down Expand Up @@ -1228,21 +1226,12 @@ impl<T> OwnedVector<T> for ~[T] {
let repr: **raw::VecRepr = transmute(&mut *self);
let fill = (**repr).unboxed.fill;
if (**repr).unboxed.alloc <= fill {
// need more space
reserve_no_inline(self);
let new_len = self.len() + 1;
self.reserve_at_least(new_len);
}

self.push_fast(t);
}

// this peculiar function is because reserve_at_least is very
// large (because of reserve), and will be inlined, which
// makes push too large.
#[inline(never)]
fn reserve_no_inline<T>(v: &mut ~[T]) {
let new_len = v.len() + 1;
v.reserve_at_least(new_len);
}
}

// This doesn't bother to make sure we have space.
Expand Down

0 comments on commit 00da76d

Please sign in to comment.