Skip to content

Commit dc14c7b

Browse files
committed
---
yaml --- r: 130995 b: refs/heads/try c: c964cb2 h: refs/heads/master i: 130993: 0972402 130991: c4cc36c v: v3
1 parent 206e3f3 commit dc14c7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+7131
-4449
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 9c68679f2ebd5b165694e9346e4ad96a3e32aceb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6faa4f33a42de32579e02a8d030db920d360e2b5
5-
refs/heads/try: 12d66e6ac36dcc17104f91bb14213b8748f2ff4a
5+
refs/heads/try: c964cb229bd342bdeb0b4506c3a6d32b03e575f6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/compiletest/runtest.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,10 +1577,6 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
15771577

15781578
// codegen tests (vs. clang)
15791579

1580-
fn make_o_name(config: &Config, testfile: &Path) -> Path {
1581-
output_base_name(config, testfile).with_extension("o")
1582-
}
1583-
15841580
fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path {
15851581
if suffix.len() == 0 {
15861582
(*p).clone()
@@ -1596,14 +1592,13 @@ fn compile_test_and_save_bitcode(config: &Config, props: &TestProps,
15961592
// FIXME (#9639): This needs to handle non-utf8 paths
15971593
let link_args = vec!("-L".to_string(),
15981594
aux_dir.as_str().unwrap().to_string());
1599-
let llvm_args = vec!("--emit=obj".to_string(),
1600-
"--crate-type=lib".to_string(),
1601-
"-C".to_string(),
1602-
"save-temps".to_string());
1595+
let llvm_args = vec!("--emit=bc,obj".to_string(),
1596+
"--crate-type=lib".to_string());
16031597
let args = make_compile_args(config,
16041598
props,
16051599
link_args.append(llvm_args.as_slice()),
1606-
|a, b| ThisFile(make_o_name(a, b)), testfile);
1600+
|a, b| ThisDirectory(output_base_name(a, b).dir_path()),
1601+
testfile);
16071602
compose_and_run_compiler(config, props, testfile, args, None)
16081603
}
16091604

branches/try/src/doc/rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,8 +2221,8 @@ These types help drive the compiler's analysis
22212221
: This type does not implement "copy", even if eligible
22222222
* `no_send_bound`
22232223
: This type does not implement "send", even if eligible
2224-
* `no_share_bound`
2225-
: This type does not implement "share", even if eligible
2224+
* `no_sync_bound`
2225+
: This type does not implement "sync", even if eligible
22262226
* `eh_personality`
22272227
: ___Needs filling in___
22282228
* `exchange_free`

branches/try/src/liballoc/heap.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
use core::ptr::RawPtr;
1616
#[cfg(not(test))] use core::raw;
17-
#[cfg(not(test))] use util;
17+
#[cfg(stage0, not(test))] use util;
1818

1919
/// Returns a pointer to `size` bytes of memory.
2020
///
@@ -119,7 +119,7 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
119119
}
120120

121121
// FIXME: #7496
122-
#[cfg(not(test))]
122+
#[cfg(stage0, not(test))]
123123
#[lang="closure_exchange_malloc"]
124124
#[inline]
125125
#[allow(deprecated)]
@@ -134,6 +134,21 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
134134
alloc as *mut u8
135135
}
136136

137+
// FIXME: #7496
138+
#[cfg(not(stage0), not(test))]
139+
#[lang="closure_exchange_malloc"]
140+
#[inline]
141+
#[allow(deprecated)]
142+
unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
143+
align: uint) -> *mut u8 {
144+
let p = allocate(size, align);
145+
146+
let alloc = p as *mut raw::Box<()>;
147+
(*alloc).drop_glue = drop_glue;
148+
149+
alloc as *mut u8
150+
}
151+
137152
#[cfg(jemalloc)]
138153
mod imp {
139154
use core::option::{None, Option};

branches/try/src/libarena/lib.rs

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ use std::mem;
3939
use std::num;
4040
use std::ptr;
4141
use std::rc::Rc;
42-
use std::rt::heap::allocate;
42+
use std::rt::heap::{allocate, deallocate};
4343

4444
// The way arena uses arrays is really deeply awful. The arrays are
4545
// allocated, and have capacities reserved, but the fill for the array
4646
// will always stay at 0.
4747
#[deriving(Clone, PartialEq)]
4848
struct Chunk {
49-
data: Rc<RefCell<Vec<u8> >>,
49+
data: Rc<RefCell<Vec<u8>>>,
5050
fill: Cell<uint>,
5151
is_copy: Cell<bool>,
5252
}
53+
5354
impl Chunk {
5455
fn capacity(&self) -> uint {
5556
self.data.borrow().capacity()
@@ -357,38 +358,37 @@ pub struct TypedArena<T> {
357358
end: Cell<*const T>,
358359

359360
/// A pointer to the first arena segment.
360-
first: RefCell<TypedArenaChunkRef<T>>,
361+
first: RefCell<*mut TypedArenaChunk<T>>,
361362
}
362-
type TypedArenaChunkRef<T> = Option<Box<TypedArenaChunk<T>>>;
363363

364364
struct TypedArenaChunk<T> {
365365
/// Pointer to the next arena segment.
366-
next: TypedArenaChunkRef<T>,
366+
next: *mut TypedArenaChunk<T>,
367367

368368
/// The number of elements that this chunk can hold.
369369
capacity: uint,
370370

371371
// Objects follow here, suitably aligned.
372372
}
373373

374+
fn calculate_size<T>(capacity: uint) -> uint {
375+
let mut size = mem::size_of::<TypedArenaChunk<T>>();
376+
size = round_up(size, mem::min_align_of::<T>());
377+
let elem_size = mem::size_of::<T>();
378+
let elems_size = elem_size.checked_mul(&capacity).unwrap();
379+
size = size.checked_add(&elems_size).unwrap();
380+
size
381+
}
382+
374383
impl<T> TypedArenaChunk<T> {
375384
#[inline]
376-
fn new(next: Option<Box<TypedArenaChunk<T>>>, capacity: uint)
377-
-> Box<TypedArenaChunk<T>> {
378-
let mut size = mem::size_of::<TypedArenaChunk<T>>();
379-
size = round_up(size, mem::min_align_of::<T>());
380-
let elem_size = mem::size_of::<T>();
381-
let elems_size = elem_size.checked_mul(&capacity).unwrap();
382-
size = size.checked_add(&elems_size).unwrap();
383-
384-
let mut chunk = unsafe {
385-
let chunk = allocate(size, mem::min_align_of::<TypedArenaChunk<T>>());
386-
let mut chunk: Box<TypedArenaChunk<T>> = mem::transmute(chunk);
387-
ptr::write(&mut chunk.next, next);
388-
chunk
389-
};
390-
391-
chunk.capacity = capacity;
385+
unsafe fn new(next: *mut TypedArenaChunk<T>, capacity: uint)
386+
-> *mut TypedArenaChunk<T> {
387+
let size = calculate_size::<T>(capacity);
388+
let chunk = allocate(size, mem::min_align_of::<TypedArenaChunk<T>>())
389+
as *mut TypedArenaChunk<T>;
390+
(*chunk).next = next;
391+
(*chunk).capacity = capacity;
392392
chunk
393393
}
394394

@@ -406,14 +406,13 @@ impl<T> TypedArenaChunk<T> {
406406
}
407407

408408
// Destroy the next chunk.
409-
let next_opt = mem::replace(&mut self.next, None);
410-
match next_opt {
411-
None => {}
412-
Some(mut next) => {
413-
// We assume that the next chunk is completely filled.
414-
let capacity = next.capacity;
415-
next.destroy(capacity)
416-
}
409+
let next = self.next;
410+
let size = calculate_size::<T>(self.capacity);
411+
deallocate(self as *mut TypedArenaChunk<T> as *mut u8, size,
412+
mem::min_align_of::<TypedArenaChunk<T>>());
413+
if next.is_not_null() {
414+
let capacity = (*next).capacity;
415+
(*next).destroy(capacity);
417416
}
418417
}
419418

@@ -448,11 +447,13 @@ impl<T> TypedArena<T> {
448447
/// objects.
449448
#[inline]
450449
pub fn with_capacity(capacity: uint) -> TypedArena<T> {
451-
let chunk = TypedArenaChunk::<T>::new(None, capacity);
452-
TypedArena {
453-
ptr: Cell::new(chunk.start() as *const T),
454-
end: Cell::new(chunk.end() as *const T),
455-
first: RefCell::new(Some(chunk)),
450+
unsafe {
451+
let chunk = TypedArenaChunk::<T>::new(ptr::mut_null(), capacity);
452+
TypedArena {
453+
ptr: Cell::new((*chunk).start() as *const T),
454+
end: Cell::new((*chunk).end() as *const T),
455+
first: RefCell::new(chunk),
456+
}
456457
}
457458
}
458459

@@ -476,26 +477,28 @@ impl<T> TypedArena<T> {
476477
/// Grows the arena.
477478
#[inline(never)]
478479
fn grow(&self) {
479-
let chunk = self.first.borrow_mut().take().unwrap();
480-
let new_capacity = chunk.capacity.checked_mul(&2).unwrap();
481-
let chunk = TypedArenaChunk::<T>::new(Some(chunk), new_capacity);
482-
self.ptr.set(chunk.start() as *const T);
483-
self.end.set(chunk.end() as *const T);
484-
*self.first.borrow_mut() = Some(chunk)
480+
unsafe {
481+
let chunk = *self.first.borrow_mut();
482+
let new_capacity = (*chunk).capacity.checked_mul(&2).unwrap();
483+
let chunk = TypedArenaChunk::<T>::new(chunk, new_capacity);
484+
self.ptr.set((*chunk).start() as *const T);
485+
self.end.set((*chunk).end() as *const T);
486+
*self.first.borrow_mut() = chunk
487+
}
485488
}
486489
}
487490

488491
#[unsafe_destructor]
489492
impl<T> Drop for TypedArena<T> {
490493
fn drop(&mut self) {
491-
// Determine how much was filled.
492-
let start = self.first.borrow().as_ref().unwrap().start() as uint;
493-
let end = self.ptr.get() as uint;
494-
let diff = (end - start) / mem::size_of::<T>();
495-
496-
// Pass that to the `destroy` method.
497494
unsafe {
498-
self.first.borrow_mut().as_mut().unwrap().destroy(diff)
495+
// Determine how much was filled.
496+
let start = self.first.borrow().as_ref().unwrap().start() as uint;
497+
let end = self.ptr.get() as uint;
498+
let diff = (end - start) / mem::size_of::<T>();
499+
500+
// Pass that to the `destroy` method.
501+
(**self.first.borrow_mut()).destroy(diff)
499502
}
500503
}
501504
}

branches/try/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ use vec::Vec;
9696
pub use core::slice::{Chunks, Slice, ImmutableSlice, ImmutablePartialEqSlice};
9797
pub use core::slice::{ImmutableOrdSlice, MutableSlice, Items, MutItems};
9898
pub use core::slice::{MutSplits, MutChunks, Splits};
99-
pub use core::slice::{bytes, ref_slice, MutableCloneableSlice};
99+
pub use core::slice::{bytes, mut_ref_slice, ref_slice, MutableCloneableSlice};
100100
pub use core::slice::{Found, NotFound};
101101

102102
// Functional utilities

branches/try/src/libcore/kinds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ pub mod marker {
271271
/// A type which is considered "not sync", meaning that
272272
/// its contents are not threadsafe, hence they cannot be
273273
/// shared between tasks.
274-
#[lang="no_share_bound"]
274+
#[lang="no_sync_bound"]
275275
#[deriving(PartialEq,Clone)]
276276
pub struct NoSync;
277277

branches/try/src/libcore/slice.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,12 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
806806
let mut i: uint = 0;
807807
let ln = self.len();
808808
while i < ln / 2 {
809-
self.swap(i, ln - i - 1);
809+
// Unsafe swap to avoid the bounds check in safe swap.
810+
unsafe {
811+
let pa: *mut T = self.unsafe_mut_ref(i);
812+
let pb: *mut T = self.unsafe_mut_ref(ln - i - 1);
813+
ptr::swap(pa, pb);
814+
}
810815
i += 1;
811816
}
812817
}

branches/try/src/libglob/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ mod test {
680680
}
681681

682682
#[test]
683+
#[ignore(cfg(windows))] // FIXME (#9406)
683684
fn test_lots_of_files() {
684685
// this is a good test because it touches lots of differently named files
685686
glob("/*/*/*/*").skip(10000).next();

branches/try/src/libnum/rational.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<T: Clone + Integer + PartialOrd>
154154
Ratio::from_integer(self.numer / self.denom)
155155
}
156156

157-
///Returns the fractional part of a number.
157+
/// Returns the fractional part of a number.
158158
#[inline]
159159
pub fn fract(&self) -> Ratio<T> {
160160
Ratio::new_raw(self.numer % self.denom, self.denom.clone())
@@ -243,7 +243,7 @@ macro_rules! arith_impl {
243243
}
244244
}
245245

246-
// a/b + c/d = (a*d + b*c)/(b*d
246+
// a/b + c/d = (a*d + b*c)/(b*d)
247247
arith_impl!(impl Add, add)
248248

249249
// a/b - c/d = (a*d - b*c)/(b*d)

0 commit comments

Comments
 (0)