Skip to content

Commit a831e7f

Browse files
committed
---
yaml --- r: 62830 b: refs/heads/snap-stage3 c: aeda178 h: refs/heads/master v: v3
1 parent 1e3cec7 commit a831e7f

36 files changed

+810
-1449
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f4ed554ddbd2dacfaa5dcc1dda99a3121f8cf2a4
4+
refs/heads/snap-stage3: aeda178011775f4a8e16446341fe4774e02d8f5f
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/arc.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,15 @@ pub impl<T:Owned> MutexARC<T> {
198198
*/
199199
#[inline(always)]
200200
unsafe fn access<U>(&self, blk: &fn(x: &mut T) -> U) -> U {
201-
let state = self.x.get();
202-
// Borrowck would complain about this if the function were
203-
// not already unsafe. See borrow_rwlock, far below.
204-
do (&(*state).lock).lock {
205-
check_poison(true, (*state).failed);
206-
let _z = PoisonOnFail(&mut (*state).failed);
207-
blk(&mut (*state).data)
201+
unsafe {
202+
let state = self.x.get();
203+
// Borrowck would complain about this if the function were
204+
// not already unsafe. See borrow_rwlock, far below.
205+
do (&(*state).lock).lock {
206+
check_poison(true, (*state).failed);
207+
let _z = PoisonOnFail(&mut (*state).failed);
208+
blk(&mut (*state).data)
209+
}
208210
}
209211
}
210212

@@ -356,8 +358,8 @@ pub impl<T:Const + Owned> RWARC<T> {
356358
* access modes, this will not poison the ARC.
357359
*/
358360
fn read<U>(&self, blk: &fn(x: &T) -> U) -> U {
359-
let state = self.x.get();
360361
unsafe {
362+
let state = self.x.get();
361363
do (*state).lock.read {
362364
check_poison(false, (*state).failed);
363365
blk(&(*state).data)

branches/snap-stage3/src/libextra/sync.rs

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -100,30 +100,34 @@ fn new_sem_and_signal(count: int, num_condvars: uint)
100100
#[doc(hidden)]
101101
pub impl<Q:Owned> Sem<Q> {
102102
fn acquire(&self) {
103-
let mut waiter_nobe = None;
104-
do (**self).with |state| {
105-
state.count -= 1;
106-
if state.count < 0 {
107-
// Create waiter nobe.
108-
let (WaitEnd, SignalEnd) = comm::oneshot();
109-
// Tell outer scope we need to block.
110-
waiter_nobe = Some(WaitEnd);
111-
// Enqueue ourself.
112-
state.waiters.tail.send(SignalEnd);
103+
unsafe {
104+
let mut waiter_nobe = None;
105+
do (**self).with |state| {
106+
state.count -= 1;
107+
if state.count < 0 {
108+
// Create waiter nobe.
109+
let (WaitEnd, SignalEnd) = comm::oneshot();
110+
// Tell outer scope we need to block.
111+
waiter_nobe = Some(WaitEnd);
112+
// Enqueue ourself.
113+
state.waiters.tail.send(SignalEnd);
114+
}
115+
}
116+
// Uncomment if you wish to test for sem races. Not valgrind-friendly.
117+
/* for 1000.times { task::yield(); } */
118+
// Need to wait outside the exclusive.
119+
if waiter_nobe.is_some() {
120+
let _ = comm::recv_one(waiter_nobe.unwrap());
113121
}
114-
}
115-
// Uncomment if you wish to test for sem races. Not valgrind-friendly.
116-
/* for 1000.times { task::yield(); } */
117-
// Need to wait outside the exclusive.
118-
if waiter_nobe.is_some() {
119-
let _ = comm::recv_one(waiter_nobe.unwrap());
120122
}
121123
}
122124
fn release(&self) {
123-
do (**self).with |state| {
124-
state.count += 1;
125-
if state.count <= 0 {
126-
signal_waitqueue(&state.waiters);
125+
unsafe {
126+
do (**self).with |state| {
127+
state.count += 1;
128+
if state.count <= 0 {
129+
signal_waitqueue(&state.waiters);
130+
}
127131
}
128132
}
129133
}
@@ -283,17 +287,19 @@ pub impl<'self> Condvar<'self> {
283287

284288
/// As signal, but with a specified condvar_id. See wait_on.
285289
fn signal_on(&self, condvar_id: uint) -> bool {
286-
let mut out_of_bounds = None;
287-
let mut result = false;
288-
do (**self.sem).with |state| {
289-
if condvar_id < state.blocked.len() {
290-
result = signal_waitqueue(&state.blocked[condvar_id]);
291-
} else {
292-
out_of_bounds = Some(state.blocked.len());
290+
unsafe {
291+
let mut out_of_bounds = None;
292+
let mut result = false;
293+
do (**self.sem).with |state| {
294+
if condvar_id < state.blocked.len() {
295+
result = signal_waitqueue(&state.blocked[condvar_id]);
296+
} else {
297+
out_of_bounds = Some(state.blocked.len());
298+
}
299+
}
300+
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
301+
result
293302
}
294-
}
295-
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
296-
result
297303
}
298304
}
299305

@@ -304,20 +310,22 @@ pub impl<'self> Condvar<'self> {
304310
fn broadcast_on(&self, condvar_id: uint) -> uint {
305311
let mut out_of_bounds = None;
306312
let mut queue = None;
307-
do (**self.sem).with |state| {
308-
if condvar_id < state.blocked.len() {
309-
// To avoid :broadcast_heavy, we make a new waitqueue,
310-
// swap it out with the old one, and broadcast on the
311-
// old one outside of the little-lock.
312-
queue = Some(util::replace(&mut state.blocked[condvar_id],
313-
new_waitqueue()));
314-
} else {
315-
out_of_bounds = Some(state.blocked.len());
313+
unsafe {
314+
do (**self.sem).with |state| {
315+
if condvar_id < state.blocked.len() {
316+
// To avoid :broadcast_heavy, we make a new waitqueue,
317+
// swap it out with the old one, and broadcast on the
318+
// old one outside of the little-lock.
319+
queue = Some(util::replace(&mut state.blocked[condvar_id],
320+
new_waitqueue()));
321+
} else {
322+
out_of_bounds = Some(state.blocked.len());
323+
}
324+
}
325+
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
326+
let queue = queue.swap_unwrap();
327+
broadcast_waitqueue(&queue)
316328
}
317-
}
318-
do check_cvar_bounds(out_of_bounds, condvar_id, "cond.signal_on()") {
319-
let queue = queue.swap_unwrap();
320-
broadcast_waitqueue(&queue)
321329
}
322330
}
323331
}

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ pub mod write {
202202
output_type: output_type,
203203
output: &Path) {
204204
unsafe {
205+
llvm::LLVMInitializePasses();
206+
205207
let opts = sess.opts;
206208
if sess.time_llvm_passes() { llvm::LLVMRustEnableTimePasses(); }
207209
let td = mk_target_data(sess.targ_cfg.target_strs.data_layout);
@@ -232,14 +234,21 @@ pub mod write {
232234
let mut mpm = passes::PassManager::new(td.lltd);
233235

234236
if !sess.no_verify() {
235-
mpm.addPass(llvm::LLVMCreateVerifierPass());
237+
mpm.add_pass_from_name("verify");
236238
}
237239

238-
if sess.lint_llvm() {
239-
mpm.addPass(llvm::LLVMCreateLintPass());
240-
}
240+
let passes = if sess.opts.custom_passes.len() > 0 {
241+
copy sess.opts.custom_passes
242+
} else {
243+
if sess.lint_llvm() {
244+
mpm.add_pass_from_name("lint");
245+
}
246+
passes::create_standard_passes(opts.optimize)
247+
};
248+
241249

242-
passes::populatePassManager(&mut mpm, opts.optimize);
250+
debug!("Passes: %?", passes);
251+
passes::populate_pass_manager(sess, &mut mpm, passes);
243252

244253
debug!("Running Module Optimization Pass");
245254
mpm.run(llmod);

0 commit comments

Comments
 (0)