Skip to content

Commit d4d1b57

Browse files
committed
---
yaml --- r: 65866 b: refs/heads/master c: 2ef8774 h: refs/heads/master v: v3
1 parent 6509e63 commit d4d1b57

File tree

149 files changed

+4550
-5302
lines changed

Some content is hidden

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

149 files changed

+4550
-5302
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: 5bff471dde5350437c1bb51178ba6a2a903ec813
2+
refs/heads/master: 2ef8774ac5b56ae264224d46ffa0078f5d39ce6c
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/RELEASES.txt

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,12 @@ Version 0.7 (July 2013)
33

44
* ??? changes, numerous bugfixes
55

6-
* Syntax changes
7-
* `#[deriving(Encodable)]`, `#[deriving(Decodable)]`
8-
96
* Semantic changes
10-
* The `self` parameter no longer implicitly means `&'self self`,
11-
and can be explicitly marked with a lifetime.
12-
* Structs with the `#[packed]` attribute have byte alignment and
13-
no padding between fields.
7+
* The `self` parameter no longer implicitly means `&'self self`, and can be explicitly marked
8+
with a lifetime.
149

1510
* Libraries
16-
17-
**Note: in 0.7 `core` was renamed `std` and `std` to `extra.
18-
These notes use the new crate names.**
19-
20-
* The `core` crate was renamed to `std`.
21-
* The `std` crate was renamed to `extra`.
22-
* `std::mut` removed.
23-
* std: `iterator` module for external iterator objects.
24-
* std: many types implement `Clone` - tuples, @, @mut. TODO
25-
* std: `path` type renamed to `Path`.
26-
* std: Many standalone functions removed in favor of methods in
27-
`vec`, `str`, TODO. In the future methods will also work as functions.
28-
* extra: `FileInput` implements `std::io::Reader`.
29-
* extra: `Complex` number type and `complex` module.
30-
* extra: `Rational` number type and `rational` module.
31-
* extra: `BigInt`, `BigUint` implement numeric and comparison traits.
32-
33-
* Other
34-
* `unused_unsafe` lint mode for detecting unnecessary `unsafe` blocks.
35-
* More and improved library documentation.
36-
* The `rusti` command has been rewritten and a number of bugs addressed.
11+
* New `core::iterator` module for external iterator objects
3712

3813
Version 0.6 (April 2013)
3914
------------------------

trunk/mk/rt.mk

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,6 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
210210
V=$$(VERBOSE)
211211
endif
212212

213-
ifeq ($(OSTYPE_$(1)), linux-androideabi)
214-
$$(JEMALLOC_LIB_$(1)_$(2)):
215-
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
216-
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) --disable-tls \
217-
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
218-
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
219-
CC="$$(CC_$(1))" \
220-
CXX="$$(CXX_$(1))" \
221-
AR="$$(AR_$(1))"
222-
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
223-
else
224213
$$(JEMALLOC_LIB_$(1)_$(2)):
225214
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
226215
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) \
@@ -230,7 +219,6 @@ $$(JEMALLOC_LIB_$(1)_$(2)):
230219
CXX="$$(CXX_$(1))" \
231220
AR="$$(AR_$(1))"
232221
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
233-
endif
234222

235223

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

trunk/src/libextra/arc.rs

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ struct RWARCInner<T> { lock: RWlock, failed: bool, data: T }
281281
#[mutable]
282282
struct RWARC<T> {
283283
x: UnsafeAtomicRcBox<RWARCInner<T>>,
284-
cant_nest: ()
285284
}
286285

287286
/// Create a reader/writer ARC with the supplied data.
@@ -299,15 +298,14 @@ pub fn rw_arc_with_condvars<T:Const + Owned>(
299298
let data =
300299
RWARCInner { lock: rwlock_with_condvars(num_condvars),
301300
failed: false, data: user_data };
302-
RWARC { x: UnsafeAtomicRcBox::new(data), cant_nest: () }
301+
RWARC { x: UnsafeAtomicRcBox::new(data), }
303302
}
304303

305304
impl<T:Const + Owned> RWARC<T> {
306305
/// Duplicate a rwlock-protected ARC, as arc::clone.
307306
pub fn clone(&self) -> RWARC<T> {
308307
RWARC {
309308
x: self.x.clone(),
310-
cant_nest: (),
311309
}
312310
}
313311

@@ -382,12 +380,12 @@ impl<T:Const + Owned> RWARC<T> {
382380
* # Example
383381
*
384382
* ~~~ {.rust}
385-
* do arc.write_downgrade |write_mode| {
386-
* do (&write_mode).write_cond |state, condvar| {
383+
* do arc.write_downgrade |mut write_token| {
384+
* do write_token.write_cond |state, condvar| {
387385
* ... exclusive access with mutable state ...
388386
* }
389-
* let read_mode = arc.downgrade(write_mode);
390-
* do (&read_mode).read |state| {
387+
* let read_token = arc.downgrade(write_token);
388+
* do read_token.read |state| {
391389
* ... shared access with immutable state ...
392390
* }
393391
* }
@@ -815,4 +813,66 @@ mod tests {
815813

816814
wp2.recv(); // complete handshake with writer
817815
}
816+
#[cfg(test)]
817+
fn test_rw_write_cond_downgrade_read_race_helper() {
818+
// Tests that when a downgrader hands off the "reader cloud" lock
819+
// because of a contending reader, a writer can't race to get it
820+
// instead, which would result in readers_and_writers. This tests
821+
// the sync module rather than this one, but it's here because an
822+
// rwarc gives us extra shared state to help check for the race.
823+
// If you want to see this test fail, go to sync.rs and replace the
824+
// line in RWlock::write_cond() that looks like:
825+
// "blk(&Condvar { order: opt_lock, ..*cond })"
826+
// with just "blk(cond)".
827+
let x = ~RWARC(true);
828+
let (wp, wc) = comm::stream();
829+
830+
// writer task
831+
let xw = (*x).clone();
832+
do task::spawn {
833+
do xw.write_cond |state, c| {
834+
wc.send(()); // tell downgrader it's ok to go
835+
c.wait();
836+
// The core of the test is here: the condvar reacquire path
837+
// must involve order_lock, so that it cannot race with a reader
838+
// trying to receive the "reader cloud lock hand-off".
839+
*state = false;
840+
}
841+
}
842+
843+
wp.recv(); // wait for writer to get in
844+
845+
do x.write_downgrade |mut write_mode| {
846+
do write_mode.write_cond |state, c| {
847+
assert!(*state);
848+
// make writer contend in the cond-reacquire path
849+
c.signal();
850+
}
851+
// make a reader task to trigger the "reader cloud lock" handoff
852+
let xr = (*x).clone();
853+
let (rp, rc) = comm::stream();
854+
do task::spawn {
855+
rc.send(());
856+
do xr.read |_state| { }
857+
}
858+
rp.recv(); // wait for reader task to exist
859+
860+
let read_mode = x.downgrade(write_mode);
861+
do read_mode.read |state| {
862+
// if writer mistakenly got in, make sure it mutates state
863+
// before we assert on it
864+
for 5.times { task::yield(); }
865+
// make sure writer didn't get in.
866+
assert!(*state);
867+
}
868+
}
869+
}
870+
#[test]
871+
fn test_rw_write_cond_downgrade_read_race() {
872+
// Ideally the above test case would have yield statements in it that
873+
// helped to expose the race nearly 100% of the time... but adding
874+
// yields in the intuitively-right locations made it even less likely,
875+
// and I wasn't sure why :( . This is a mediocre "next best" option.
876+
for 8.times { test_rw_write_cond_downgrade_read_race_helper() }
877+
}
818878
}

0 commit comments

Comments
 (0)