Skip to content

Commit 6a5a3c6

Browse files
committed
---
yaml --- r: 118575 b: refs/heads/try c: 7613c9d h: refs/heads/master i: 118573: 63fdbb3 118571: 02c2ab0 118567: 3097e2a 118559: 64f3426 v: v3
1 parent 2119d62 commit 6a5a3c6

File tree

4 files changed

+48
-64
lines changed

4 files changed

+48
-64
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: b1646cbfd908dc948b251e362669af421100647a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5-
refs/heads/try: cc30abbcad282634fb99089eb9297e7cc4f26729
5+
refs/heads/try: 7613c9dd59aa771bf02a00c77af0ba4266392373
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/etc/licenseck.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"libsync/spsc_queue.rs", # BSD
4343
"libsync/mpmc_bounded_queue.rs", # BSD
4444
"libsync/mpsc_intrusive.rs", # BSD
45-
"test/bench/shootout-binarytrees.rs", # BSD
4645
"test/bench/shootout-fannkuch-redux.rs", # BSD
4746
"test/bench/shootout-meteor.rs", # BSD
4847
"test/bench/shootout-pidigits.rs", # BSD

branches/try/src/liballoc/heap.rs

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
// except according to those terms.
1010

1111
// FIXME: #13994: port to the sized deallocation API when available
12-
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` and `nonnull`
12+
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
13+
// and `nonnull`
1314

1415
use core::intrinsics::{abort, cttz32};
1516
use core::option::{None, Option};
@@ -23,7 +24,8 @@ use libc::{c_char, c_int, c_void, size_t};
2324
extern {
2425
fn je_mallocx(size: size_t, flags: c_int) -> *mut c_void;
2526
fn je_rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> *mut c_void;
26-
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t;
27+
fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t,
28+
flags: c_int) -> size_t;
2729
fn je_dallocx(ptr: *mut c_void, flags: c_int);
2830
fn je_nallocx(size: size_t, flags: c_int) -> size_t;
2931
fn je_malloc_stats_print(write_cb: Option<extern "C" fn(cbopaque: *mut c_void, *c_char)>,
@@ -42,8 +44,9 @@ fn mallocx_align(a: uint) -> c_int { unsafe { cttz32(a as u32) as c_int } }
4244

4345
/// Return a pointer to `size` bytes of memory.
4446
///
45-
/// Behavior is undefined if the requested size is 0 or the alignment is not a power of 2. The
46-
/// alignment must be no larger than the largest supported page size on the platform.
47+
/// Behavior is undefined if the requested size is 0 or the alignment is not a
48+
/// power of 2. The alignment must be no larger than the largest supported page
49+
/// size on the platform.
4750
#[inline]
4851
pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
4952
let ptr = je_mallocx(size as size_t, mallocx_align(align)) as *mut u8;
@@ -53,62 +56,73 @@ pub unsafe fn allocate(size: uint, align: uint) -> *mut u8 {
5356
ptr
5457
}
5558

56-
/// Extend or shrink the allocation referenced by `ptr` to `size` bytes of memory.
59+
/// Extend or shrink the allocation referenced by `ptr` to `size` bytes of
60+
/// memory.
5761
///
58-
/// Behavior is undefined if the requested size is 0 or the alignment is not a power of 2. The
59-
/// alignment must be no larger than the largest supported page size on the platform.
62+
/// Behavior is undefined if the requested size is 0 or the alignment is not a
63+
/// power of 2. The alignment must be no larger than the largest supported page
64+
/// size on the platform.
6065
///
61-
/// The `old_size` and `align` parameters are the parameters that were used to create the
62-
/// allocation referenced by `ptr`. The `old_size` parameter may also be the value returned by
63-
/// `usable_size` for the requested size.
66+
/// The `old_size` and `align` parameters are the parameters that were used to
67+
/// create the allocation referenced by `ptr`. The `old_size` parameter may also
68+
/// be the value returned by `usable_size` for the requested size.
6469
#[inline]
6570
#[allow(unused_variable)] // for the parameter names in the documentation
66-
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint, old_size: uint) -> *mut u8 {
67-
let ptr = je_rallocx(ptr as *mut c_void, size as size_t, mallocx_align(align)) as *mut u8;
71+
pub unsafe fn reallocate(ptr: *mut u8, size: uint, align: uint,
72+
old_size: uint) -> *mut u8 {
73+
let ptr = je_rallocx(ptr as *mut c_void, size as size_t,
74+
mallocx_align(align)) as *mut u8;
6875
if ptr.is_null() {
6976
abort()
7077
}
7178
ptr
7279
}
7380

74-
/// Extend or shrink the allocation referenced by `ptr` to `size` bytes of memory in-place.
81+
/// Extend or shrink the allocation referenced by `ptr` to `size` bytes of
82+
/// memory in-place.
7583
///
76-
/// Return true if successful, otherwise false if the allocation was not altered.
84+
/// Return true if successful, otherwise false if the allocation was not
85+
/// altered.
7786
///
78-
/// Behavior is undefined if the requested size is 0 or the alignment is not a power of 2. The
79-
/// alignment must be no larger than the largest supported page size on the platform.
87+
/// Behavior is undefined if the requested size is 0 or the alignment is not a
88+
/// power of 2. The alignment must be no larger than the largest supported page
89+
/// size on the platform.
8090
///
8191
/// The `old_size` and `align` parameters are the parameters that were used to
8292
/// create the allocation referenced by `ptr`. The `old_size` parameter may be
8393
/// any value in range_inclusive(requested_size, usable_size).
8494
#[inline]
8595
#[allow(unused_variable)] // for the parameter names in the documentation
86-
pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint, old_size: uint) -> bool {
87-
je_xallocx(ptr as *mut c_void, size as size_t, 0, mallocx_align(align)) == size as size_t
96+
pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
97+
old_size: uint) -> bool {
98+
je_xallocx(ptr as *mut c_void, size as size_t, 0,
99+
mallocx_align(align)) == size as size_t
88100
}
89101

90102
/// Deallocate the memory referenced by `ptr`.
91103
///
92104
/// The `ptr` parameter must not be null.
93105
///
94-
/// The `size` and `align` parameters are the parameters that were used to create the
95-
/// allocation referenced by `ptr`. The `size` parameter may also be the value returned by
96-
/// `usable_size` for the requested size.
106+
/// The `size` and `align` parameters are the parameters that were used to
107+
/// create the allocation referenced by `ptr`. The `size` parameter may also be
108+
/// the value returned by `usable_size` for the requested size.
97109
#[inline]
98110
#[allow(unused_variable)] // for the parameter names in the documentation
99111
pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
100112
je_dallocx(ptr as *mut c_void, mallocx_align(align))
101113
}
102114

103-
/// Return the usable size of an allocation created with the specified the `size` and `align`.
115+
/// Return the usable size of an allocation created with the specified the
116+
/// `size` and `align`.
104117
#[inline]
105118
pub fn usable_size(size: uint, align: uint) -> uint {
106119
unsafe { je_nallocx(size as size_t, mallocx_align(align)) as uint }
107120
}
108121

109122
/// Print implementation-defined allocator statistics.
110123
///
111-
/// These statistics may be inconsistent if other threads use the allocator during the call.
124+
/// These statistics may be inconsistent if other threads use the allocator
125+
/// during the call.
112126
#[unstable]
113127
pub fn stats_print() {
114128
unsafe {
@@ -145,7 +159,8 @@ unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) {
145159
#[lang="closure_exchange_malloc"]
146160
#[inline]
147161
#[allow(deprecated)]
148-
unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *mut u8 {
162+
unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint,
163+
align: uint) -> *mut u8 {
149164
let total_size = util::get_box_size(size, align);
150165
let p = allocate(total_size, 8);
151166

branches/try/src/test/bench/shootout-binarytrees.rs

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,12 @@
1-
// The Computer Language Benchmarks Game
2-
// http://benchmarksgame.alioth.debian.org/
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
34
//
4-
// contributed by the Rust Project Developers
5-
6-
// Copyright (c) 2012-2014 The Rust Project Developers
7-
//
8-
// All rights reserved.
9-
//
10-
// Redistribution and use in source and binary forms, with or without
11-
// modification, are permitted provided that the following conditions
12-
// are met:
13-
//
14-
// - Redistributions of source code must retain the above copyright
15-
// notice, this list of conditions and the following disclaimer.
16-
//
17-
// - Redistributions in binary form must reproduce the above copyright
18-
// notice, this list of conditions and the following disclaimer in
19-
// the documentation and/or other materials provided with the
20-
// distribution.
21-
//
22-
// - Neither the name of "The Computer Language Benchmarks Game" nor
23-
// the name of "The Computer Language Shootout Benchmarks" nor the
24-
// names of its contributors may be used to endorse or promote
25-
// products derived from this software without specific prior
26-
// written permission.
27-
//
28-
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29-
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30-
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31-
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32-
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33-
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34-
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35-
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36-
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37-
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38-
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39-
// OF THE POSSIBILITY OF SUCH DAMAGE.
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
4010

4111
extern crate arena;
4212

0 commit comments

Comments
 (0)