Skip to content

Commit 696ce11

Browse files
committed
---
yaml --- r: 100863 b: refs/heads/snap-stage3 c: 836ffb5 h: refs/heads/master i: 100861: 9cd9b44 100859: 043ef01 100855: 7c568d5 100847: 3e6b4cd 100831: 4eef584 100799: 18021f0 100735: 2bd8997 100607: 42991df 100351: bd2855e v: v3
1 parent 210a316 commit 696ce11

File tree

42 files changed

+329
-515
lines changed

Some content is hidden

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

42 files changed

+329
-515
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: 5d4fd50af3c16ffe43c8035b929374e13bb76793
4+
refs/heads/snap-stage3: 836ffb528883225e036e506b3a8f112d81e096ff
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabi := -Wl,--export-dynamic,--dynamic-
350350
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-whole-archive
351351
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabi := -Wl,-no-whole-archive
352352
CFG_DEF_SUFFIX_arm-unknown-linux-gnueabi := .linux.def
353-
CFG_LLC_FLAGS_arm-unknown-linux-gnueabi :=
353+
CFG_LLC_FLAGS_arm-unknown-linux-gnueabi := -arm-enable-ehabi -arm-enable-ehabi-descriptors
354354
CFG_INSTALL_NAME_arm-unknown-linux-gnueabi =
355355
CFG_LIBUV_LINK_FLAGS_arm-unknown-linux-gnueabi =
356356
CFG_EXE_SUFFIX_arm-unknown-linux-gnueabi :=

branches/snap-stage3/src/doc/rustdoc.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,34 @@ rustdoc --test crate.rs
100100

101101
## Defining tests
102102

103-
Rust documentation currently uses the markdown format, and rustdoc treats all
104-
code blocks as testable-by-default. In order to not run a test over a block of
105-
code, the `ignore` string can be added to the three-backtick form of markdown
106-
code block.
103+
Rust documentation currently uses the markdown format, and code blocks can refer
104+
to any piece of code-related documentation, which isn't always rust. Because of
105+
this, only code blocks with the language of "rust" will be considered for
106+
testing.
107107

108108
~~~
109-
```
109+
```rust
110110
// This is a testable code block
111111
```
112112
113-
```ignore
113+
```
114114
// This is not a testable code block
115115
```
116116
117-
// This is a testable code block (4-space indent)
117+
// This is not a testable code block (4-space indent)
118118
~~~
119119

120-
In addition to the `ignore` directive, you can specify that the test's execution
121-
should fail with the `should_fail` directive.
120+
In addition to only testing "rust"-language code blocks, there are additional
121+
specifiers that can be used to dictate how a code block is tested:
122122

123123
~~~
124-
```should_fail
125-
// This code block is expected to generate a failure when run
124+
```rust,ignore
125+
// This code block is ignored by rustdoc, but is passed through to the test
126+
// harness
127+
```
128+
129+
```rust,should_fail
130+
// This code block is expected to generate a failure
126131
```
127132
~~~
128133

@@ -138,7 +143,7 @@ that one can still write things like `#[deriving(Eq)]`).
138143
# the doc-generating tool. In order to display them anyway in this particular
139144
# case, the character following the leading '#' is not a usual space like in
140145
# these first five lines but a non breakable one.
141-
#
146+
#
142147
# // showing 'fib' in this documentation would just be tedious and detracts from
143148
# // what's actualy being documented.
144149
# fn fib(n: int) { n + 2 }
@@ -164,6 +169,9 @@ rustdoc --test lib.rs --test-args 'foo'
164169
165170
// See what's possible when running tests
166171
rustdoc --test lib.rs --test-args '--help'
172+
173+
// Run all ignored tests
174+
rustdoc --test lib.rs --test-args '--ignored'
167175
~~~
168176

169177
When testing a library, code examples will often show how functions are used,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ An object is a series of string keys mapping to values, in `"key": value` format
3030
Arrays are enclosed in square brackets ([ ... ]) and objects in curly brackets ({ ... }).
3131
A simple JSON document encoding a person, his/her age, address and phone numbers could look like:
3232
33-
```ignore
33+
```
3434
{
3535
"FirstName": "John",
3636
"LastName": "Doe",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub fn write_5_number_summary(w: &mut io::Writer,
341341
/// As an example, the summary with 5-number-summary `(min=15, q1=17, med=20, q3=24, max=31)` might
342342
/// display as:
343343
///
344-
/// ~~~~ignore
344+
/// ~~~~
345345
/// 10 | [--****#******----------] | 40
346346
/// ~~~~
347347

branches/snap-stage3/src/libglob/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub struct Paths {
6767
///
6868
/// The above code will print:
6969
///
70-
/// ```ignore
70+
/// ```
7171
/// /media/pictures/kittens.jpg
7272
/// /media/pictures/puppies.jpg
7373
/// ```

branches/snap-stage3/src/libgreen/sched.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::rt::rtio::{RemoteCallback, PausableIdleCallback, Callback, EventLoop};
1515
use std::rt::task::BlockedTask;
1616
use std::rt::task::Task;
1717
use std::sync::deque;
18-
use std::unstable::mutex::NativeMutex;
18+
use std::unstable::mutex::Mutex;
1919
use std::unstable::raw;
2020

2121
use TaskState;
@@ -669,7 +669,8 @@ impl Scheduler {
669669
// is acquired here. This is the resumption points and the "bounce"
670670
// that it is referring to.
671671
unsafe {
672-
let _guard = current_task.nasty_deschedule_lock.lock();
672+
current_task.nasty_deschedule_lock.lock();
673+
current_task.nasty_deschedule_lock.unlock();
673674
}
674675
return current_task;
675676
}
@@ -764,11 +765,10 @@ impl Scheduler {
764765
// to it, but we're guaranteed that the task won't exit until we've
765766
// unlocked the lock so there's no worry of this memory going away.
766767
let cur = self.change_task_context(cur, next, |sched, mut task| {
767-
let lock: *mut NativeMutex = &mut task.nasty_deschedule_lock;
768-
unsafe {
769-
let _guard = (*lock).lock();
770-
f(sched, BlockedTask::block(task.swap()));
771-
}
768+
let lock: *mut Mutex = &mut task.nasty_deschedule_lock;
769+
unsafe { (*lock).lock() }
770+
f(sched, BlockedTask::block(task.swap()));
771+
unsafe { (*lock).unlock() }
772772
});
773773
cur.put();
774774
}
@@ -1453,8 +1453,8 @@ mod test {
14531453

14541454
#[test]
14551455
fn test_spawn_sched_blocking() {
1456-
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
1457-
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
1456+
use std::unstable::mutex::{Mutex, MUTEX_INIT};
1457+
static mut LOCK: Mutex = MUTEX_INIT;
14581458

14591459
// Testing that a task in one scheduler can block in foreign code
14601460
// without affecting other schedulers
@@ -1466,11 +1466,12 @@ mod test {
14661466
let mut handle = pool.spawn_sched();
14671467
handle.send(PinnedTask(pool.task(TaskOpts::new(), proc() {
14681468
unsafe {
1469-
let mut guard = LOCK.lock();
1469+
LOCK.lock();
14701470

14711471
start_ch.send(());
1472-
guard.wait(); // block the scheduler thread
1473-
guard.signal(); // let them know we have the lock
1472+
LOCK.wait(); // block the scheduler thread
1473+
LOCK.signal(); // let them know we have the lock
1474+
LOCK.unlock();
14741475
}
14751476

14761477
fin_ch.send(());
@@ -1502,9 +1503,10 @@ mod test {
15021503
child_ch.send(20);
15031504
pingpong(&parent_po, &child_ch);
15041505
unsafe {
1505-
let mut guard = LOCK.lock();
1506-
guard.signal(); // wakeup waiting scheduler
1507-
guard.wait(); // wait for them to grab the lock
1506+
LOCK.lock();
1507+
LOCK.signal(); // wakeup waiting scheduler
1508+
LOCK.wait(); // wait for them to grab the lock
1509+
LOCK.unlock();
15081510
}
15091511
})));
15101512
drop(handle);

branches/snap-stage3/src/libgreen/simple.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ use std::rt::local::Local;
1717
use std::rt::rtio;
1818
use std::rt::task::{Task, BlockedTask};
1919
use std::task::TaskOpts;
20-
use std::unstable::mutex::NativeMutex;
20+
use std::unstable::sync::LittleLock;
2121

2222
struct SimpleTask {
23-
lock: NativeMutex,
23+
lock: LittleLock,
2424
awoken: bool,
2525
}
2626

@@ -59,9 +59,9 @@ impl Runtime for SimpleTask {
5959
to_wake.put_runtime(self as ~Runtime);
6060
unsafe {
6161
cast::forget(to_wake);
62-
let mut guard = (*me).lock.lock();
62+
let _l = (*me).lock.lock();
6363
(*me).awoken = true;
64-
guard.signal();
64+
(*me).lock.signal();
6565
}
6666
}
6767

@@ -83,7 +83,7 @@ impl Runtime for SimpleTask {
8383
pub fn task() -> ~Task {
8484
let mut task = ~Task::new();
8585
task.put_runtime(~SimpleTask {
86-
lock: unsafe {NativeMutex::new()},
86+
lock: LittleLock::new(),
8787
awoken: false,
8888
} as ~Runtime);
8989
return task;

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::rt::local::Local;
2525
use std::rt::rtio;
2626
use std::rt::task::{Task, BlockedTask, SendMessage};
2727
use std::task::TaskOpts;
28-
use std::unstable::mutex::NativeMutex;
28+
use std::unstable::mutex::Mutex;
2929
use std::unstable::raw;
3030

3131
use context::Context;
@@ -65,7 +65,7 @@ pub struct GreenTask {
6565
pool_id: uint,
6666

6767
// See the comments in the scheduler about why this is necessary
68-
nasty_deschedule_lock: NativeMutex,
68+
nasty_deschedule_lock: Mutex,
6969
}
7070

7171
pub enum TaskType {
@@ -163,7 +163,7 @@ impl GreenTask {
163163
task_type: task_type,
164164
sched: None,
165165
handle: None,
166-
nasty_deschedule_lock: unsafe { NativeMutex::new() },
166+
nasty_deschedule_lock: unsafe { Mutex::new() },
167167
task: Some(~Task::new()),
168168
}
169169
}
@@ -322,10 +322,11 @@ impl GreenTask {
322322
// uncontended except for when the task is rescheduled).
323323
fn reawaken_remotely(mut ~self) {
324324
unsafe {
325-
let mtx = &mut self.nasty_deschedule_lock as *mut NativeMutex;
325+
let mtx = &mut self.nasty_deschedule_lock as *mut Mutex;
326326
let handle = self.handle.get_mut_ref() as *mut SchedHandle;
327-
let _guard = (*mtx).lock();
327+
(*mtx).lock();
328328
(*handle).send(RunOnce(self));
329+
(*mtx).unlock();
329330
}
330331
}
331332
}
@@ -478,6 +479,12 @@ impl Runtime for GreenTask {
478479
fn wrap(~self) -> ~Any { self as ~Any }
479480
}
480481

482+
impl Drop for GreenTask {
483+
fn drop(&mut self) {
484+
unsafe { self.nasty_deschedule_lock.destroy(); }
485+
}
486+
}
487+
481488
#[cfg(test)]
482489
mod tests {
483490
use std::rt::Runtime;

branches/snap-stage3/src/libnative/bookkeeping.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
//! The green counterpart for this is bookkeeping on sched pools.
1818
1919
use std::sync::atomics;
20-
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
20+
use std::unstable::mutex::{Mutex, MUTEX_INIT};
2121

2222
static mut TASK_COUNT: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT;
23-
static mut TASK_LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
23+
static mut TASK_LOCK: Mutex = MUTEX_INIT;
2424

2525
pub fn increment() {
2626
let _ = unsafe { TASK_COUNT.fetch_add(1, atomics::SeqCst) };
@@ -29,8 +29,9 @@ pub fn increment() {
2929
pub fn decrement() {
3030
unsafe {
3131
if TASK_COUNT.fetch_sub(1, atomics::SeqCst) == 1 {
32-
let mut guard = TASK_LOCK.lock();
33-
guard.signal();
32+
TASK_LOCK.lock();
33+
TASK_LOCK.signal();
34+
TASK_LOCK.unlock();
3435
}
3536
}
3637
}
@@ -39,12 +40,11 @@ pub fn decrement() {
3940
/// the entry points of native programs
4041
pub fn wait_for_other_tasks() {
4142
unsafe {
42-
{
43-
let mut guard = TASK_LOCK.lock();
44-
while TASK_COUNT.load(atomics::SeqCst) > 0 {
45-
guard.wait();
46-
}
43+
TASK_LOCK.lock();
44+
while TASK_COUNT.load(atomics::SeqCst) > 0 {
45+
TASK_LOCK.wait();
4746
}
47+
TASK_LOCK.unlock();
4848
TASK_LOCK.destroy();
4949
}
5050
}

branches/snap-stage3/src/libnative/io/net.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,19 @@ pub fn init() {
218218
}
219219

220220
unsafe {
221-
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
221+
use std::unstable::mutex::{Mutex, MUTEX_INIT};
222222
static mut INITIALIZED: bool = false;
223-
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
223+
static mut LOCK: Mutex = MUTEX_INIT;
224224

225-
let _guard = LOCK.lock();
225+
LOCK.lock();
226226
if !INITIALIZED {
227227
let mut data: WSADATA = mem::init();
228228
let ret = WSAStartup(0x202, // version 2.2
229229
&mut data);
230230
assert_eq!(ret, 0);
231231
INITIALIZED = true;
232232
}
233+
LOCK.unlock();
233234
}
234235
}
235236

branches/snap-stage3/src/libnative/io/timer_helper.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
2323
use std::cast;
2424
use std::rt;
25-
use std::unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
25+
use std::unstable::mutex::{Mutex, MUTEX_INIT};
2626

2727
use bookkeeping;
2828
use io::timer::{Req, Shutdown};
@@ -37,11 +37,11 @@ static mut HELPER_CHAN: *mut Chan<Req> = 0 as *mut Chan<Req>;
3737
static mut HELPER_SIGNAL: imp::signal = 0 as imp::signal;
3838

3939
pub fn boot(helper: fn(imp::signal, Port<Req>)) {
40-
static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT;
40+
static mut LOCK: Mutex = MUTEX_INIT;
4141
static mut INITIALIZED: bool = false;
4242

4343
unsafe {
44-
let mut _guard = LOCK.lock();
44+
LOCK.lock();
4545
if !INITIALIZED {
4646
let (msgp, msgc) = Chan::new();
4747
// promote this to a shared channel
@@ -58,6 +58,7 @@ pub fn boot(helper: fn(imp::signal, Port<Req>)) {
5858
rt::at_exit(proc() { shutdown() });
5959
INITIALIZED = true;
6060
}
61+
LOCK.unlock();
6162
}
6263
}
6364

0 commit comments

Comments
 (0)