Skip to content

Commit fb77a2a

Browse files
committed
---
yaml --- r: 100874 b: refs/heads/snap-stage3 c: 0ba6d48 h: refs/heads/master v: v3
1 parent 5ef7a33 commit fb77a2a

File tree

8 files changed

+30
-22
lines changed

8 files changed

+30
-22
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: e3b1f3c443c048913e2d573fcc5a9c2be3484a78
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f450b2b379794ba9f367f9dadbd2d70913da8560
4+
refs/heads/snap-stage3: 0ba6d4885fc71ca7156e1fe689edb939e1d9d418
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ CFG_VERSION_WIN = $(subst -pre,,$(CFG_RELEASE))
4545
# and include all of the .d files in one fell swoop.
4646
ALL_OBJ_FILES :=
4747

48-
ifneq ($(NO_MAKEFILE_DEPS),)
48+
ifneq ($(NO_MKFILE_DEPS),)
4949
MKFILE_DEPS :=
5050
else
5151
MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)

branches/snap-stage3/mk/tests.mk

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,6 @@ endif
174174
check: cleantestlibs cleantmptestlogs tidy all check-stage2
175175
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
176176

177-
check-notidy: cleantestlibs cleantmptestlogs all check-stage2
178-
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
179-
180-
check-full: cleantestlibs cleantmptestlogs tidy \
181-
all check-stage1 check-stage2 check-stage3
182-
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
183-
184-
check-test: cleantestlibs cleantmptestlogs all check-stage2-rfail
185-
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
186-
187177
check-lite: cleantestlibs cleantmptestlogs \
188178
$(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
189179
check-stage2-rpass \

branches/snap-stage3/src/libstd/comm/shared.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
/// module. You'll also note that the implementation of the shared and stream
1919
/// channels are quite similar, and this is no coincidence!
2020
21+
use cmp;
2122
use int;
2223
use iter::Iterator;
2324
use kinds::Send;
@@ -35,6 +36,9 @@ use mpsc = sync::mpsc_queue;
3536

3637
static DISCONNECTED: int = int::MIN;
3738
static FUDGE: int = 1024;
39+
#[cfg(test)]
40+
static MAX_STEALS: int = 5;
41+
#[cfg(not(test))]
3842
static MAX_STEALS: int = 1 << 20;
3943

4044
pub struct Packet<T> {
@@ -307,7 +311,11 @@ impl<T: Send> Packet<T> {
307311
DISCONNECTED => {
308312
self.cnt.store(DISCONNECTED, atomics::SeqCst);
309313
}
310-
n => { self.steals -= n; }
314+
n => {
315+
let m = cmp::min(n, self.steals);
316+
self.steals -= m;
317+
self.cnt.fetch_add(n - m, atomics::SeqCst);
318+
}
311319
}
312320
assert!(self.steals >= 0);
313321
}

branches/snap-stage3/src/libstd/comm/stream.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
/// High level implementation details can be found in the comment of the parent
1818
/// module.
1919
20+
use cmp;
2021
use comm::Port;
2122
use int;
2223
use iter::Iterator;
@@ -32,6 +33,9 @@ use sync::atomics;
3233
use vec::OwnedVector;
3334

3435
static DISCONNECTED: int = int::MIN;
36+
#[cfg(test)]
37+
static MAX_STEALS: int = 5;
38+
#[cfg(not(test))]
3539
static MAX_STEALS: int = 1 << 20;
3640

3741
pub struct Packet<T> {
@@ -198,19 +202,28 @@ impl<T: Send> Packet<T> {
198202
pub fn try_recv(&mut self) -> Result<T, Failure<T>> {
199203
match self.queue.pop() {
200204
// If we stole some data, record to that effect (this will be
201-
// factored into cnt later on). Note that we don't allow steals to
202-
// grow without bound in order to prevent eventual overflow of
203-
// either steals or cnt as an overflow would have catastrophic
204-
// results. Also note that we don't unconditionally set steals to 0
205-
// because it can be true that steals > cnt.
205+
// factored into cnt later on).
206+
//
207+
// Note that we don't allow steals to grow without bound in order to
208+
// prevent eventual overflow of either steals or cnt as an overflow
209+
// would have catastrophic results. Sometimes, steals > cnt, but
210+
// other times cnt > steals, so we don't know the relation between
211+
// steals and cnt. This code path is executed only rarely, so we do
212+
// a pretty slow operation, of swapping 0 into cnt, taking steals
213+
// down as much as possible (without going negative), and then
214+
// adding back in whatever we couldn't factor into steals.
206215
Some(data) => {
207216
self.steals += 1;
208217
if self.steals > MAX_STEALS {
209218
match self.cnt.swap(0, atomics::SeqCst) {
210219
DISCONNECTED => {
211220
self.cnt.store(DISCONNECTED, atomics::SeqCst);
212221
}
213-
n => { self.steals -= n; }
222+
n => {
223+
let m = cmp::min(n, self.steals);
224+
self.steals -= m;
225+
self.cnt.fetch_add(n - m, atomics::SeqCst);
226+
}
214227
}
215228
assert!(self.steals >= 0);
216229
}

branches/snap-stage3/src/libstd/num/f32.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ impl num::FromStrRadix for f32 {
867867
#[cfg(test)]
868868
mod tests {
869869
use f32::*;
870-
use prelude::*;
871870

872871
use num::*;
873872
use num;

branches/snap-stage3/src/libstd/num/f64.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,6 @@ impl num::FromStrRadix for f64 {
869869
#[cfg(test)]
870870
mod tests {
871871
use f64::*;
872-
use prelude::*;
873872

874873
use num::*;
875874
use num;

branches/snap-stage3/src/libstd/task.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ use rt::task::Task;
6565
use str::{Str, SendStr, IntoMaybeOwned};
6666

6767
#[cfg(test)] use any::{AnyOwnExt, AnyRefExt};
68-
#[cfg(test)] use ptr;
6968
#[cfg(test)] use result;
7069

7170
/// Indicates the manner in which a task exited.

0 commit comments

Comments
 (0)