Skip to content

Commit 299b698

Browse files
committed
---
yaml --- r: 31423 b: refs/heads/dist-snap c: 3aee39a h: refs/heads/master i: 31421: 47688c6 31419: 3ac58f2 31415: 49c7add 31407: 23e23f8 31391: 31f1ebf 31359: ba5f828 v: v3
1 parent a488e09 commit 299b698

File tree

7 files changed

+31
-11
lines changed

7 files changed

+31
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 987814f11e4614b8aa712eb19cff78fbbe0d34fa
10+
refs/heads/dist-snap: 3aee39a6ec910bde6ae9a5423b11aaaad4a1b089
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/dvec.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ impl private_methods<A> for dvec<A> {
108108
// almost nothing works without the copy bound due to limitations
109109
// around closures.
110110
impl extensions<A> for dvec<A> {
111+
/// Reserves space for N elements
112+
fn reserve(count: uint) {
113+
vec::reserve(self.data, count)
114+
}
115+
111116
/**
112117
* Swaps out the current vector and hands it off to a user-provided
113118
* function `f`. The function should transform it however is desired

branches/dist-snap/src/libcore/vec.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,20 +509,29 @@ fn push<T>(&v: ~[const T], +initval: T) {
509509
let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
510510
let fill = (**repr).fill;
511511
if (**repr).alloc > fill {
512-
(**repr).fill += sys::size_of::<T>();
513-
let p = ptr::addr_of((**repr).data);
514-
let p = ptr::offset(p, fill) as *mut T;
515-
rusti::move_val_init(*p, initval);
512+
push_fast(v, initval);
516513
}
517514
else {
518515
push_slow(v, initval);
519516
}
520517
}
521518
}
522519

520+
// This doesn't bother to make sure we have space.
521+
#[inline(always)] // really pretty please
522+
unsafe fn push_fast<T>(&v: ~[const T], +initval: T) {
523+
let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
524+
let fill = (**repr).fill;
525+
(**repr).fill += sys::size_of::<T>();
526+
let p = ptr::addr_of((**repr).data);
527+
let p = ptr::offset(p, fill) as *mut T;
528+
rusti::move_val_init(*p, initval);
529+
}
530+
531+
#[inline(never)]
523532
fn push_slow<T>(&v: ~[const T], +initval: T) {
524533
reserve_at_least(v, v.len() + 1u);
525-
push(v, initval);
534+
unsafe { push_fast(v, initval) }
526535
}
527536

528537
// Unchecked vector indexing
@@ -644,7 +653,6 @@ fn grow_fn<T>(&v: ~[const T], n: uint, op: init_op<T>) {
644653
* of the vector, expands the vector by replicating `initval` to fill the
645654
* intervening space.
646655
*/
647-
#[inline(always)]
648656
fn grow_set<T: copy>(&v: ~[mut T], index: uint, initval: T, val: T) {
649657
if index >= len(v) { grow(v, index - len(v) + 1u, initval); }
650658
v[index] = val;

branches/dist-snap/src/libstd/smallintmap.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ enum smallintmap<T:copy> {
1717

1818
/// Create a smallintmap
1919
fn mk<T: copy>() -> smallintmap<T> {
20-
ret smallintmap_(@{v: dvec()});
20+
let v = dvec();
21+
ret smallintmap_(@{v: v});
2122
}
2223

2324
/**
@@ -26,6 +27,7 @@ fn mk<T: copy>() -> smallintmap<T> {
2627
*/
2728
#[inline(always)]
2829
fn insert<T: copy>(self: smallintmap<T>, key: uint, val: T) {
30+
//#error("inserting key %?", key);
2931
self.v.grow_set_elt(key, none, some(val));
3032
}
3133

branches/dist-snap/src/libsyntax/attr.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ fn foreign_abi(attrs: ~[ast::attribute]) -> either<~str, ast::foreign_abi> {
364364
enum inline_attr {
365365
ia_none,
366366
ia_hint,
367-
ia_always
367+
ia_always,
368+
ia_never,
368369
}
369370
370371
/// True if something like #[inline] is found in the list of attrs.
@@ -376,6 +377,9 @@ fn find_inline_attr(attrs: ~[ast::attribute]) -> inline_attr {
376377
ast::meta_list(@~"inline", items) {
377378
if !vec::is_empty(find_meta_items_by_name(items, ~"always")) {
378379
ia_always
380+
} else if !vec::is_empty(
381+
find_meta_items_by_name(items, ~"never")) {
382+
ia_never
379383
} else {
380384
ia_hint
381385
}

branches/dist-snap/src/rustc/metadata/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,8 @@ fn purity_fn_family(p: purity) -> char {
545545

546546
fn should_inline(attrs: ~[attribute]) -> bool {
547547
alt attr::find_inline_attr(attrs) {
548-
attr::ia_none { false }
549-
attr::ia_hint | attr::ia_always { true }
548+
attr::ia_none | attr::ia_never { false }
549+
attr::ia_hint | attr::ia_always { true }
550550
}
551551
}
552552

branches/dist-snap/src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ fn set_inline_hint_if_appr(attrs: ~[ast::attribute],
456456
alt attr::find_inline_attr(attrs) {
457457
attr::ia_hint { set_inline_hint(llfn); }
458458
attr::ia_always { set_always_inline(llfn); }
459+
attr::ia_never { set_no_inline(llfn); }
459460
attr::ia_none { /* fallthrough */ }
460461
}
461462
}

0 commit comments

Comments
 (0)