Skip to content

Commit e082967

Browse files
committed
---
yaml --- r: 158507 b: refs/heads/try c: 88d7f0a h: refs/heads/master i: 158505: 56c0661 158503: 4bcfd50 v: v3
1 parent f0635f4 commit e082967

File tree

146 files changed

+1910
-3968
lines changed

Some content is hidden

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

146 files changed

+1910
-3968
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: a0a7ab461283322215f0343cd2b5e66fc19a7bd5
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 1b2ad7831f1745bf4a4709a1fa1772afb47c933c
5-
refs/heads/try: 02c234cc52be6b655822d86f22751d57f1005822
5+
refs/heads/try: 88d7f0a8daf9c147178e4ea2b1815f6a035ccaa2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/mk/main.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ endif
100100
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
101101
CFG_GCCISH_CFLAGS :=
102102
CFG_GCCISH_LINK_FLAGS :=
103-
104-
# Turn off broken quarantine (see jemalloc/jemalloc#161)
105-
CFG_JEMALLOC_FLAGS := --disable-fill
103+
CFG_JEMALLOC_FLAGS :=
106104

107105
ifdef CFG_DISABLE_OPTIMIZE
108106
$(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))

branches/try/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ fn find_rust_src_root(config: &Config) -> Option<Path> {
627627
let path_postfix = Path::new("src/etc/lldb_batchmode.py");
628628

629629
while path.pop() {
630-
if path.join(&path_postfix).is_file() {
630+
if path.join(path_postfix.clone()).is_file() {
631631
return Some(path);
632632
}
633633
}

branches/try/src/doc/guide-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ The benchmarking runner offers two ways to avoid this. Either, the
287287
closure that the `iter` method receives can return an arbitrary value
288288
which forces the optimizer to consider the result used and ensures it
289289
cannot remove the computation entirely. This could be done for the
290-
example above by adjusting the `bh.iter` call to
290+
example above by adjusting the `b.iter` call to
291291

292292
~~~
293293
# struct X; impl X { fn iter<T>(&self, _: || -> T) {} } let b = X;

branches/try/src/doc/intro.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -494,14 +494,14 @@ non-deterministic aspect:
494494
$ cargo run
495495
Compiling hello_world v0.0.1 (file:///Users/you/src/hello_world)
496496
Running `target/hello_world`
497-
numbers[1] is 3
498-
numbers[0] is 2
499-
numbers[2] is 4
497+
numbers[1] is 2
498+
numbers[0] is 1
499+
numbers[2] is 3
500500
$ cargo run
501501
Running `target/hello_world`
502-
numbers[2] is 4
503-
numbers[1] is 3
504-
numbers[0] is 2
502+
numbers[2] is 3
503+
numbers[1] is 2
504+
numbers[0] is 1
505505
```
506506

507507
Each time, we get a slightly different output, because each thread works in a

branches/try/src/doc/rust.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ body {
6262
font-size: 18px;
6363
color: #333;
6464
line-height: 1.428571429;
65-
66-
-webkit-font-feature-settings: "kern", "liga";
67-
-moz-font-feature-settings: "kern", "liga";
68-
font-feature-settings: "kern", "liga";
6965
}
7066
@media (min-width: 768px) {
7167
body {

branches/try/src/liballoc/heap.rs

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use core::ptr::RawPtr;
12-
1311
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1412

15-
/// Return a pointer to `size` bytes of memory aligned to `align`.
16-
///
17-
/// On failure, return a null pointer.
13+
/// Returns a pointer to `size` bytes of memory.
1814
///
1915
/// Behavior is undefined if the requested size is 0 or the alignment is not a
2016
/// power of 2. The alignment must be no larger than the largest supported page
@@ -24,9 +20,8 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
2420
imp::allocate(size, align)
2521
}
2622

27-
/// Resize the allocation referenced by `ptr` to `size` bytes.
28-
///
29-
/// On failure, return a null pointer and leave the original allocation intact.
23+
/// Extends or shrinks the allocation referenced by `ptr` to `size` bytes of
24+
/// memory.
3025
///
3126
/// Behavior is undefined if the requested size is 0 or the alignment is not a
3227
/// power of 2. The alignment must be no larger than the largest supported page
@@ -40,7 +35,8 @@ pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint)
4035
imp::reallocate(ptr, old_size, size, align)
4136
}
4237

43-
/// Resize the allocation referenced by `ptr` to `size` bytes.
38+
/// Extends or shrinks the allocation referenced by `ptr` to `size` bytes of
39+
/// memory in-place.
4440
///
4541
/// If the operation succeeds, it returns `usable_size(size, align)` and if it
4642
/// fails (or is a no-op) it returns `usable_size(old_size, align)`.
@@ -99,9 +95,7 @@ unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 {
9995
if size == 0 {
10096
EMPTY as *mut u8
10197
} else {
102-
let ptr = allocate(size, align);
103-
if ptr.is_null() { ::oom() }
104-
ptr
98+
allocate(size, align)
10599
}
106100
}
107101

@@ -126,7 +120,7 @@ const MIN_ALIGN: uint = 16;
126120
#[cfg(jemalloc)]
127121
mod imp {
128122
use core::option::{None, Option};
129-
use core::ptr::{null_mut, null};
123+
use core::ptr::{RawPtr, null_mut, null};
130124
use core::num::Int;
131125
use libc::{c_char, c_int, c_void, size_t};
132126
use super::MIN_ALIGN;
@@ -137,8 +131,10 @@ mod imp {
137131

138132
extern {
139133
fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void;
140-
fn je_rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
141-
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
134+
fn je_rallocx(ptr: *mut c_void, size: size_t,
135+
flags: c_int) -> *mut c_void;
136+
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t,
137+
flags: c_int) -> size_t;
142138
fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int);
143139
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
144140
fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void,
@@ -164,13 +160,21 @@ mod imp {
164160
#[inline]
165161
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
166162
let flags = align_to_flags(align);
167-
je_mallocx(size as size_t, flags) as *mut u8
163+
let ptr = je_mallocx(size as size_t, flags) as *mut u8;
164+
if ptr.is_null() {
165+
::oom()
166+
}
167+
ptr
168168
}
169169

170170
#[inline]
171171
pub unsafe fn reallocate(ptr: *mut u8, _old_size: uint, size: uint, align: uint) -> *mut u8 {
172172
let flags = align_to_flags(align);
173-
je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8
173+
let ptr = je_rallocx(ptr as *mut c_void, size as size_t, flags) as *mut u8;
174+
if ptr.is_null() {
175+
::oom()
176+
}
177+
ptr
174178
}
175179

176180
#[inline]
@@ -203,6 +207,7 @@ mod imp {
203207
mod imp {
204208
use core::cmp;
205209
use core::ptr;
210+
use core::ptr::RawPtr;
206211
use libc;
207212
use super::MIN_ALIGN;
208213

@@ -215,24 +220,31 @@ mod imp {
215220
#[inline]
216221
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
217222
if align <= MIN_ALIGN {
218-
libc::malloc(size as libc::size_t) as *mut u8
223+
let ptr = libc::malloc(size as libc::size_t);
224+
if ptr.is_null() {
225+
::oom();
226+
}
227+
ptr as *mut u8
219228
} else {
220229
let mut out = 0 as *mut libc::c_void;
221230
let ret = posix_memalign(&mut out,
222231
align as libc::size_t,
223232
size as libc::size_t);
224233
if ret != 0 {
225-
ptr::null_mut()
226-
} else {
227-
out as *mut u8
234+
::oom();
228235
}
236+
out as *mut u8
229237
}
230238
}
231239

232240
#[inline]
233241
pub unsafe fn reallocate(ptr: *mut u8, old_size: uint, size: uint, align: uint) -> *mut u8 {
234242
if align <= MIN_ALIGN {
235-
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
243+
let ptr = libc::realloc(ptr as *mut libc::c_void, size as libc::size_t);
244+
if ptr.is_null() {
245+
::oom();
246+
}
247+
ptr as *mut u8
236248
} else {
237249
let new_ptr = allocate(size, align);
238250
ptr::copy_memory(new_ptr, ptr as *const u8, cmp::min(size, old_size));
@@ -264,6 +276,7 @@ mod imp {
264276
mod imp {
265277
use libc::{c_void, size_t};
266278
use libc;
279+
use core::ptr::RawPtr;
267280
use super::MIN_ALIGN;
268281

269282
extern {
@@ -276,18 +289,35 @@ mod imp {
276289
#[inline]
277290
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
278291
if align <= MIN_ALIGN {
279-
libc::malloc(size as size_t) as *mut u8
292+
let ptr = libc::malloc(size as size_t);
293+
if ptr.is_null() {
294+
::oom();
295+
}
296+
ptr as *mut u8
280297
} else {
281-
_aligned_malloc(size as size_t, align as size_t) as *mut u8
298+
let ptr = _aligned_malloc(size as size_t, align as size_t);
299+
if ptr.is_null() {
300+
::oom();
301+
}
302+
ptr as *mut u8
282303
}
283304
}
284305

285306
#[inline]
286307
pub unsafe fn reallocate(ptr: *mut u8, _old_size: uint, size: uint, align: uint) -> *mut u8 {
287308
if align <= MIN_ALIGN {
288-
libc::realloc(ptr as *mut c_void, size as size_t) as *mut u8
309+
let ptr = libc::realloc(ptr as *mut c_void, size as size_t);
310+
if ptr.is_null() {
311+
::oom();
312+
}
313+
ptr as *mut u8
289314
} else {
290-
_aligned_realloc(ptr as *mut c_void, size as size_t, align as size_t) as *mut u8
315+
let ptr = _aligned_realloc(ptr as *mut c_void, size as size_t,
316+
align as size_t);
317+
if ptr.is_null() {
318+
::oom();
319+
}
320+
ptr as *mut u8
291321
}
292322
}
293323

@@ -318,15 +348,13 @@ mod imp {
318348
mod test {
319349
extern crate test;
320350
use self::test::Bencher;
321-
use core::ptr::RawPtr;
322351
use heap;
323352

324353
#[test]
325354
fn basic_reallocate_inplace_noop() {
326355
unsafe {
327356
let size = 4000;
328357
let ptr = heap::allocate(size, 8);
329-
if ptr.is_null() { ::oom() }
330358
let ret = heap::reallocate_inplace(ptr, size, size, 8);
331359
heap::deallocate(ptr, size, 8);
332360
assert_eq!(ret, heap::usable_size(size, 8));

branches/try/src/liballoc/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
//! # The Rust core allocation library
1212
//!
1313
//! This is the lowest level library through which allocation in Rust can be
14-
//! performed.
14+
//! performed where the allocation is assumed to succeed. This library will
15+
//! abort the process when allocation fails.
1516
//!
1617
//! This library, like libcore, is not intended for general usage, but rather as
1718
//! a building block of other libraries. The types and interfaces in this
@@ -94,10 +95,8 @@ pub mod boxed;
9495
pub mod arc;
9596
pub mod rc;
9697

97-
/// Common out-of-memory routine
98-
#[cold]
99-
#[inline(never)]
100-
pub fn oom() -> ! {
98+
/// Common OOM routine used by liballoc
99+
fn oom() -> ! {
101100
// FIXME(#14674): This really needs to do something other than just abort
102101
// here, but any printing done must be *guaranteed* to not
103102
// allocate.

branches/try/src/libarena/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#![feature(unsafe_destructor)]
3232
#![allow(missing_docs)]
3333

34-
extern crate alloc;
35-
3634
use std::cell::{Cell, RefCell};
3735
use std::cmp;
3836
use std::intrinsics::{TyDesc, get_tydesc};
@@ -388,7 +386,6 @@ impl<T> TypedArenaChunk<T> {
388386
let size = calculate_size::<T>(capacity);
389387
let chunk = allocate(size, mem::min_align_of::<TypedArenaChunk<T>>())
390388
as *mut TypedArenaChunk<T>;
391-
if chunk.is_null() { alloc::oom() }
392389
(*chunk).next = next;
393390
(*chunk).capacity = capacity;
394391
chunk

0 commit comments

Comments
 (0)