Skip to content

Commit 8b912bc

Browse files
committed
register snapshots
1 parent 72fc4a5 commit 8b912bc

File tree

5 files changed

+10
-122
lines changed

5 files changed

+10
-122
lines changed

src/libarena/lib.rs

-22
Original file line numberDiff line numberDiff line change
@@ -341,29 +341,7 @@ struct TypedArenaChunk<T> {
341341
}
342342

343343
impl<T> TypedArenaChunk<T> {
344-
#[cfg(stage0)]
345344
#[inline]
346-
fn new(next: Option<Box<TypedArenaChunk<T>>>, capacity: uint)
347-
-> Box<TypedArenaChunk<T>> {
348-
let mut size = mem::size_of::<TypedArenaChunk<T>>();
349-
size = round_up(size, min_align_of::<T>());
350-
let elem_size = mem::size_of::<T>();
351-
let elems_size = elem_size.checked_mul(&capacity).unwrap();
352-
size = size.checked_add(&elems_size).unwrap();
353-
354-
let mut chunk = unsafe {
355-
let chunk = exchange_malloc(size);
356-
let mut chunk: Box<TypedArenaChunk<T>> = mem::transmute(chunk);
357-
mem::move_val_init(&mut chunk.next, next);
358-
chunk
359-
};
360-
361-
chunk.capacity = capacity;
362-
chunk
363-
}
364-
365-
#[inline]
366-
#[cfg(not(stage0))]
367345
fn new(next: Option<Box<TypedArenaChunk<T>>>, capacity: uint)
368346
-> Box<TypedArenaChunk<T>> {
369347
let mut size = mem::size_of::<TypedArenaChunk<T>>();

src/libcore/should_not_exist.rs

-16
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,10 @@ use str::StrSlice;
2828

2929
#[allow(ctypes)]
3030
extern {
31-
#[cfg(stage0)]
32-
fn rust_malloc(size: uint) -> *u8;
33-
#[cfg(not(stage0))]
3431
fn rust_malloc(size: uint, align: uint) -> *u8;
3532
fn rust_free(ptr: *u8, size: uint, align: uint);
3633
}
3734

38-
#[cfg(stage0)]
39-
unsafe fn alloc(cap: uint) -> *mut Vec<()> {
40-
let cap = cap.checked_add(&mem::size_of::<Vec<()>>()).unwrap();
41-
let ret = rust_malloc(cap) as *mut Vec<()>;
42-
if ret.is_null() {
43-
intrinsics::abort();
44-
}
45-
(*ret).fill = 0;
46-
(*ret).alloc = cap;
47-
ret
48-
}
49-
50-
#[cfg(not(stage0))]
5135
unsafe fn alloc(cap: uint) -> *mut Vec<()> {
5236
let cap = cap.checked_add(&mem::size_of::<Vec<()>>()).unwrap();
5337
// this should use the real alignment, but the new representation will take care of that

src/libstd/rt/heap.rs

+2-36
Original file line numberDiff line numberDiff line change
@@ -114,39 +114,14 @@ pub fn stats_print() {
114114
}
115115

116116
/// The allocator for unique pointers.
117-
#[cfg(stage0)]
118-
#[lang="exchange_malloc"]
119-
#[inline(always)]
120-
pub unsafe fn exchange_malloc_(size: uint) -> *mut u8 {
121-
exchange_malloc(size)
122-
}
123-
124-
/// The allocator for unique pointers.
125-
#[cfg(not(test), not(stage0))]
117+
#[cfg(not(test))]
126118
#[lang="exchange_malloc"]
127119
#[inline(always)]
128120
pub unsafe fn exchange_malloc_(size: uint, align: uint) -> *mut u8 {
129121
exchange_malloc(size, align)
130122
}
131123

132124
/// The allocator for unique pointers.
133-
#[cfg(stage0)]
134-
#[inline]
135-
pub unsafe fn exchange_malloc(size: uint) -> *mut u8 {
136-
// The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size
137-
// allocations can point to this `static`. It would be incorrect to use a null
138-
// pointer, due to enums assuming types like unique pointers are never null.
139-
static EMPTY: () = ();
140-
141-
if size == 0 {
142-
&EMPTY as *() as *mut u8
143-
} else {
144-
allocate(size, 8)
145-
}
146-
}
147-
148-
/// The allocator for unique pointers.
149-
#[cfg(not(stage0))]
150125
#[inline]
151126
pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
152127
// The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size
@@ -187,16 +162,7 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uin
187162
#[no_mangle]
188163
#[doc(hidden)]
189164
#[deprecated]
190-
#[cfg(stage0, not(test))]
191-
pub unsafe extern "C" fn rust_malloc(size: uint) -> *mut u8 {
192-
exchange_malloc(size)
193-
}
194-
195-
// hack for libcore
196-
#[no_mangle]
197-
#[doc(hidden)]
198-
#[deprecated]
199-
#[cfg(not(stage0), not(test))]
165+
#[cfg(not(test))]
200166
pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 {
201167
exchange_malloc(size, align)
202168
}

src/libstd/slice.rs

-48
Original file line numberDiff line numberDiff line change
@@ -291,54 +291,6 @@ pub trait CloneableVector<T> {
291291
impl<'a, T: Clone> CloneableVector<T> for &'a [T] {
292292
/// Returns a copy of `v`.
293293
#[inline]
294-
#[cfg(stage0)]
295-
fn to_owned(&self) -> ~[T] {
296-
use RawVec = core::raw::Vec;
297-
use num::{CheckedAdd, CheckedMul};
298-
use option::Expect;
299-
300-
let len = self.len();
301-
let data_size = len.checked_mul(&mem::size_of::<T>());
302-
let data_size = data_size.expect("overflow in to_owned()");
303-
let size = mem::size_of::<RawVec<()>>().checked_add(&data_size);
304-
let size = size.expect("overflow in to_owned()");
305-
306-
unsafe {
307-
// this should pass the real required alignment
308-
let ret = exchange_malloc(size) as *mut RawVec<()>;
309-
310-
(*ret).fill = len * mem::nonzero_size_of::<T>();
311-
(*ret).alloc = len * mem::nonzero_size_of::<T>();
312-
313-
// Be careful with the following loop. We want it to be optimized
314-
// to a memcpy (or something similarly fast) when T is Copy. LLVM
315-
// is easily confused, so any extra operations during the loop can
316-
// prevent this optimization.
317-
let mut i = 0;
318-
let p = &mut (*ret).data as *mut _ as *mut T;
319-
try_finally(
320-
&mut i, (),
321-
|i, ()| while *i < len {
322-
mem::move_val_init(
323-
&mut(*p.offset(*i as int)),
324-
self.unsafe_ref(*i).clone());
325-
*i += 1;
326-
},
327-
|i| if *i < len {
328-
// we must be failing, clean up after ourselves
329-
for j in range(0, *i as int) {
330-
ptr::read(&*p.offset(j));
331-
}
332-
// FIXME: #13994 (should pass align and size here)
333-
deallocate(ret as *mut u8, 0, 8);
334-
});
335-
mem::transmute(ret)
336-
}
337-
}
338-
339-
/// Returns a copy of `v`.
340-
#[inline]
341-
#[cfg(not(stage0))]
342294
fn to_owned(&self) -> ~[T] {
343295
use RawVec = core::raw::Vec;
344296
use num::{CheckedAdd, CheckedMul};

src/snapshots.txt

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
S 2014-05-11 72fc4a5
2+
freebsd-x86_64 82db6355b0b7c8023c8845a74e2f224da2831b50
3+
linux-i386 91901299d5f86f5b67377d940073908a1f0e4e82
4+
linux-x86_64 2a80e40bb8d832dba307ad6a43bb63081627c22c
5+
macos-i386 3d7ce9b9201f07cecddae6f1b8025e9c28b10bbf
6+
macos-x86_64 4cfe69a0499d486a7bfdb9cd05c52845ad607dcb
7+
winnt-i386 328d13aeb6c573125c57d7103a12bebd34fadd1f
8+
19
S 2014-05-09 47ecc2e
210
freebsd-x86_64 5c085972690e1f9412c3c0c7ec64f6b148fe04fd
311
linux-i386 690d2e310c025f10c54b1f2b9f32c65ea34575ed

0 commit comments

Comments
 (0)