Skip to content

Commit 3d644a6

Browse files
committed
---
yaml --- r: 65515 b: refs/heads/master c: 2d63517 h: refs/heads/master i: 65513: f543716 65511: 34b31b0 v: v3
1 parent 9ee58cf commit 3d644a6

File tree

287 files changed

+47226
-2921
lines changed

Some content is hidden

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

287 files changed

+47226
-2921
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 64759c9f25993d255c7ced4edecdd14a75e149b0
2+
refs/heads/master: 2d635179f0bd1493f55768c0c56ebaea5f63e2b1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
src/rt/msvc/* -whitespace
88
src/rt/vg/* -whitespace
99
src/rt/linenoise/* -whitespace
10+
src/rt/jemalloc/**/* -whitespace

trunk/configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ do
683683
for i in \
684684
isaac linenoise sync test \
685685
arch/i386 arch/x86_64 arch/arm arch/mips \
686-
libuv libuv/src/ares libuv/src/eio libuv/src/ev
686+
libuv libuv/src/ares libuv/src/eio libuv/src/ev \
687+
jemalloc
687688
do
688689
make_dir rt/$t/stage$s/$i
689690
done

trunk/mk/rt.mk

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,23 @@ RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \
9797
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
9898
LIBUV_OSTYPE_$(1)_$(2) := win
9999
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
100+
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/jemalloc.lib
100101
else ifeq ($(OSTYPE_$(1)), apple-darwin)
101102
LIBUV_OSTYPE_$(1)_$(2) := mac
102103
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
104+
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
103105
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
104106
LIBUV_OSTYPE_$(1)_$(2) := unix/freebsd
105107
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
108+
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
106109
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
107110
LIBUV_OSTYPE_$(1)_$(2) := unix/android
108111
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
112+
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
109113
else
110114
LIBUV_OSTYPE_$(1)_$(2) := unix/linux
111115
LIBUV_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/libuv/libuv.a
116+
JEMALLOC_LIB_$(1)_$(2) := rt/$(1)/stage$(2)/jemalloc/lib/libjemalloc_pic.a
112117
endif
113118

114119
RUNTIME_DEF_$(1)_$(2) := rt/rustrt$(CFG_DEF_SUFFIX_$(1))
@@ -124,8 +129,6 @@ ALL_OBJ_FILES += $$(RUNTIME_OBJS_$(1)_$(2))
124129
MORESTACK_OBJ_$(1)_$(2) := rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/morestack.o
125130
ALL_OBJ_FILES += $$(MORESTACK_OBJS_$(1)_$(2))
126131

127-
RUNTIME_LIBS_$(1)_$(2) := $$(LIBUV_LIB_$(1)_$(2))
128-
129132
rt/$(1)/stage$(2)/%.o: rt/%.cpp $$(MKFILE_DEPS)
130133
@$$(call E, compile: $$@)
131134
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@, $$(RUNTIME_INCS_$(1)_$(2)) \
@@ -146,11 +149,10 @@ rt/$(1)/stage$(2)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1)_$(2))
146149
$$(Q)$(AR_$(1)) rcs $$@ $$<
147150

148151
rt/$(1)/stage$(2)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)_$(2)) $$(MKFILE_DEPS) \
149-
$$(RUNTIME_DEF_$(1)_$(2)) \
150-
$$(RUNTIME_LIBS_$(1)_$(2))
152+
$$(RUNTIME_DEF_$(1)_$(2)) $$(LIBUV_LIB_$(1)_$(2)) $$(JEMALLOC_LIB_$(1)_$(2))
151153
@$$(call E, link: $$@)
152154
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)_$(2)) \
153-
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(RUNTIME_LIBS_$(1)_$(2)) \
155+
$$(JEMALLOC_LIB_$(1)_$(2)) $$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(LIBUV_LIB_$(1)_$(2)) \
154156
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)_$(2)),$$(CFG_RUNTIME_$(1)))
155157

156158
# FIXME: For some reason libuv's makefiles can't figure out the
@@ -199,6 +201,9 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
199201
V=$$(VERBOSE)
200202
endif
201203

204+
$$(JEMALLOC_LIB_$(1)_$(2)):
205+
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure --disable-experimental
206+
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
202207

203208
# These could go in rt.mk or rustllvm.mk, they're needed for both.
204209

trunk/src/compiletest/procsrv.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use core::os;
1717
use core::run;
1818
use core::str;
1919
use core::task;
20+
use core::vec;
2021

2122
#[cfg(target_os = "win32")]
2223
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
@@ -28,7 +29,7 @@ fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
2829
let aux_path = prog.slice(0u, prog.len() - 4u).to_owned() + ".libaux";
2930

3031
env = do vec::map(env) |pair| {
31-
let (k,v) = *pair;
32+
let (k,v) = copy *pair;
3233
if k == ~"PATH" { (~"PATH", v + ";" + lib_path + ";" + aux_path) }
3334
else { (k,v) }
3435
};

trunk/src/libextra/arc.rs

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ pub struct Condvar<'self> {
5656
cond: &'self sync::Condvar<'self>
5757
}
5858

59-
impl<'self> Condvar<'self> {
59+
pub impl<'self> Condvar<'self> {
6060
/// Atomically exit the associated ARC and block until a signal is sent.
6161
#[inline(always)]
62-
pub fn wait(&self) { self.wait_on(0) }
62+
fn wait(&self) { self.wait_on(0) }
6363

6464
/**
6565
* Atomically exit the associated ARC and block on a specified condvar
@@ -68,7 +68,7 @@ impl<'self> Condvar<'self> {
6868
* wait() is equivalent to wait_on(0).
6969
*/
7070
#[inline(always)]
71-
pub fn wait_on(&self, condvar_id: uint) {
71+
fn wait_on(&self, condvar_id: uint) {
7272
assert!(!*self.failed);
7373
self.cond.wait_on(condvar_id);
7474
// This is why we need to wrap sync::condvar.
@@ -77,28 +77,28 @@ impl<'self> Condvar<'self> {
7777

7878
/// Wake up a blocked task. Returns false if there was no blocked task.
7979
#[inline(always)]
80-
pub fn signal(&self) -> bool { self.signal_on(0) }
80+
fn signal(&self) -> bool { self.signal_on(0) }
8181

8282
/**
8383
* Wake up a blocked task on a specified condvar (as
8484
* sync::cond.signal_on). Returns false if there was no blocked task.
8585
*/
8686
#[inline(always)]
87-
pub fn signal_on(&self, condvar_id: uint) -> bool {
87+
fn signal_on(&self, condvar_id: uint) -> bool {
8888
assert!(!*self.failed);
8989
self.cond.signal_on(condvar_id)
9090
}
9191

9292
/// Wake up all blocked tasks. Returns the number of tasks woken.
9393
#[inline(always)]
94-
pub fn broadcast(&self) -> uint { self.broadcast_on(0) }
94+
fn broadcast(&self) -> uint { self.broadcast_on(0) }
9595

9696
/**
9797
* Wake up all blocked tasks on a specified condvar (as
9898
* sync::cond.broadcast_on). Returns Returns the number of tasks woken.
9999
*/
100100
#[inline(always)]
101-
pub fn broadcast_on(&self, condvar_id: uint) -> uint {
101+
fn broadcast_on(&self, condvar_id: uint) -> uint {
102102
assert!(!*self.failed);
103103
self.cond.broadcast_on(condvar_id)
104104
}
@@ -120,8 +120,8 @@ pub fn ARC<T:Const + Owned>(data: T) -> ARC<T> {
120120
* Access the underlying data in an atomically reference counted
121121
* wrapper.
122122
*/
123-
impl<T:Const+Owned> ARC<T> {
124-
pub fn get<'a>(&'a self) -> &'a T {
123+
pub impl<T:Const+Owned> ARC<T> {
124+
fn get<'a>(&'a self) -> &'a T {
125125
unsafe { &*self.x.get_immut() }
126126
}
127127
}
@@ -173,7 +173,7 @@ impl<T:Owned> Clone for MutexARC<T> {
173173
}
174174
}
175175

176-
impl<T:Owned> MutexARC<T> {
176+
pub impl<T:Owned> MutexARC<T> {
177177

178178
/**
179179
* Access the underlying mutable data with mutual exclusion from other
@@ -199,7 +199,7 @@ impl<T:Owned> MutexARC<T> {
199199
* blocked on the mutex) will also fail immediately.
200200
*/
201201
#[inline(always)]
202-
pub unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
202+
unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
203203
unsafe {
204204
let state = self.x.get();
205205
// Borrowck would complain about this if the function were
@@ -214,10 +214,10 @@ impl<T:Owned> MutexARC<T> {
214214

215215
/// As access(), but with a condvar, as sync::mutex.lock_cond().
216216
#[inline(always)]
217-
pub unsafe fn access_cond<'x, 'c, U>(&self,
218-
blk: &fn(x: &'x mut T,
219-
c: &'c Condvar) -> U)
220-
-> U {
217+
unsafe fn access_cond<'x, 'c, U>(
218+
&self,
219+
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U) -> U
220+
{
221221
let state = self.x.get();
222222
do (&(*state).lock).lock_cond |cond| {
223223
check_poison(true, (*state).failed);
@@ -302,18 +302,16 @@ pub fn rw_arc_with_condvars<T:Const + Owned>(
302302
RWARC { x: UnsafeAtomicRcBox::new(data), cant_nest: () }
303303
}
304304

305-
impl<T:Const + Owned> RWARC<T> {
305+
pub impl<T:Const + Owned> RWARC<T> {
306306
/// Duplicate a rwlock-protected ARC, as arc::clone.
307-
pub fn clone(&self) -> RWARC<T> {
308-
RWARC {
309-
x: self.x.clone(),
310-
cant_nest: (),
311-
}
307+
fn clone(&self) -> RWARC<T> {
308+
RWARC { x: self.x.clone(),
309+
cant_nest: () }
312310
}
313311

314312
}
315313

316-
impl<T:Const + Owned> RWARC<T> {
314+
pub impl<T:Const + Owned> RWARC<T> {
317315
/**
318316
* Access the underlying data mutably. Locks the rwlock in write mode;
319317
* other readers and writers will block.
@@ -325,7 +323,7 @@ impl<T:Const + Owned> RWARC<T> {
325323
* poison the ARC, so subsequent readers and writers will both also fail.
326324
*/
327325
#[inline(always)]
328-
pub fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
326+
fn write<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
329327
unsafe {
330328
let state = self.x.get();
331329
do (*borrow_rwlock(state)).write {
@@ -335,12 +333,11 @@ impl<T:Const + Owned> RWARC<T> {
335333
}
336334
}
337335
}
338-
339336
/// As write(), but with a condvar, as sync::rwlock.write_cond().
340337
#[inline(always)]
341-
pub fn write_cond<'x, 'c, U>(&self,
342-
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
343-
-> U {
338+
fn write_cond<'x, 'c, U>(&self,
339+
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
340+
-> U {
344341
unsafe {
345342
let state = self.x.get();
346343
do (*borrow_rwlock(state)).write_cond |cond| {
@@ -353,7 +350,6 @@ impl<T:Const + Owned> RWARC<T> {
353350
}
354351
}
355352
}
356-
357353
/**
358354
* Access the underlying data immutably. May run concurrently with other
359355
* reading tasks.
@@ -363,7 +359,7 @@ impl<T:Const + Owned> RWARC<T> {
363359
* Failing will unlock the ARC while unwinding. However, unlike all other
364360
* access modes, this will not poison the ARC.
365361
*/
366-
pub fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
362+
fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
367363
unsafe {
368364
let state = self.x.get();
369365
do (*state).lock.read {
@@ -393,7 +389,7 @@ impl<T:Const + Owned> RWARC<T> {
393389
* }
394390
* ~~~
395391
*/
396-
pub fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
392+
fn write_downgrade<U>(&self, blk: &fn(v: RWWriteMode<T>) -> U) -> U {
397393
unsafe {
398394
let state = self.x.get();
399395
do (*borrow_rwlock(state)).write_downgrade |write_mode| {
@@ -408,8 +404,7 @@ impl<T:Const + Owned> RWARC<T> {
408404
}
409405

410406
/// To be called inside of the write_downgrade block.
411-
pub fn downgrade<'a>(&self, token: RWWriteMode<'a, T>)
412-
-> RWReadMode<'a, T> {
407+
fn downgrade<'a>(&self, token: RWWriteMode<'a, T>) -> RWReadMode<'a, T> {
413408
unsafe {
414409
// The rwlock should assert that the token belongs to us for us.
415410
let state = self.x.get();
@@ -456,9 +451,9 @@ pub struct RWReadMode<'self, T> {
456451
token: sync::RWlockReadMode<'self>,
457452
}
458453

459-
impl<'self, T:Const + Owned> RWWriteMode<'self, T> {
454+
pub impl<'self, T:Const + Owned> RWWriteMode<'self, T> {
460455
/// Access the pre-downgrade RWARC in write mode.
461-
pub fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U {
456+
fn write<U>(&mut self, blk: &fn(x: &mut T) -> U) -> U {
462457
match *self {
463458
RWWriteMode {
464459
data: &ref mut data,
@@ -471,11 +466,10 @@ impl<'self, T:Const + Owned> RWWriteMode<'self, T> {
471466
}
472467
}
473468
}
474-
475469
/// Access the pre-downgrade RWARC in write mode with a condvar.
476-
pub fn write_cond<'x, 'c, U>(&mut self,
477-
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
478-
-> U {
470+
fn write_cond<'x, 'c, U>(&mut self,
471+
blk: &fn(x: &'x mut T, c: &'c Condvar) -> U)
472+
-> U {
479473
match *self {
480474
RWWriteMode {
481475
data: &ref mut data,
@@ -497,9 +491,9 @@ impl<'self, T:Const + Owned> RWWriteMode<'self, T> {
497491
}
498492
}
499493

500-
impl<'self, T:Const + Owned> RWReadMode<'self, T> {
494+
pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
501495
/// Access the post-downgrade rwlock in read mode.
502-
pub fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
496+
fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
503497
match *self {
504498
RWReadMode {
505499
data: data,

trunk/src/libextra/arena.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
166166
(transmute(p & !1), p & 1 == 1)
167167
}
168168

169-
impl Arena {
169+
pub impl Arena {
170170
// Functions for the POD part of the arena
171-
fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
171+
priv fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
172172
// Allocate a new chunk.
173173
let chunk_size = at_vec::capacity(self.pod_head.data);
174174
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
@@ -180,7 +180,7 @@ impl Arena {
180180
}
181181

182182
#[inline(always)]
183-
fn alloc_pod_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
183+
priv fn alloc_pod_inner(&mut self, n_bytes: uint, align: uint) -> *u8 {
184184
unsafe {
185185
// XXX: Borrow check
186186
let head = transmute_mut_region(&mut self.pod_head);
@@ -200,7 +200,7 @@ impl Arena {
200200
}
201201

202202
#[inline(always)]
203-
fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
203+
priv fn alloc_pod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
204204
unsafe {
205205
let tydesc = sys::get_type_desc::<T>();
206206
let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align);
@@ -211,8 +211,8 @@ impl Arena {
211211
}
212212

213213
// Functions for the non-POD part of the arena
214-
fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
215-
-> (*u8, *u8) {
214+
priv fn alloc_nonpod_grow(&mut self, n_bytes: uint, align: uint)
215+
-> (*u8, *u8) {
216216
// Allocate a new chunk.
217217
let chunk_size = at_vec::capacity(self.head.data);
218218
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
@@ -224,8 +224,8 @@ impl Arena {
224224
}
225225

226226
#[inline(always)]
227-
fn alloc_nonpod_inner(&mut self, n_bytes: uint, align: uint)
228-
-> (*u8, *u8) {
227+
priv fn alloc_nonpod_inner(&mut self, n_bytes: uint, align: uint)
228+
-> (*u8, *u8) {
229229
unsafe {
230230
let head = transmute_mut_region(&mut self.head);
231231

@@ -247,7 +247,7 @@ impl Arena {
247247
}
248248

249249
#[inline(always)]
250-
fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
250+
priv fn alloc_nonpod<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
251251
unsafe {
252252
let tydesc = sys::get_type_desc::<T>();
253253
let (ty_ptr, ptr) =
@@ -269,7 +269,7 @@ impl Arena {
269269

270270
// The external interface
271271
#[inline(always)]
272-
pub fn alloc<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
272+
fn alloc<'a, T>(&'a mut self, op: &fn() -> T) -> &'a T {
273273
unsafe {
274274
// XXX: Borrow check
275275
let this = transmute_mut_region(self);

0 commit comments

Comments
 (0)