Skip to content

Commit f527a5c

Browse files
committed
---
yaml --- r: 92910 b: refs/heads/auto c: 3abc633 h: refs/heads/master v: v3
1 parent 6422faa commit f527a5c

29 files changed

+141
-658
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: e34b1eaccec107a76513d227fe4d6f15a6281d29
16+
refs/heads/auto: 3abc63365895aff78815ea7b57374486f91daebd
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/RELEASES.txt

Lines changed: 3 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,10 @@
1-
Version 0.9 (January 2014)
1+
Version 0.9 (XXX 2013)
22
--------------------------
33

4-
* ~1600 changes, numerous bugfixes
5-
6-
* Language
7-
* The `float` type has been removed. Use `f32` or `f64` instead.
8-
* A new facility for enabling experimental features (feature gating) has
9-
been added, using the crate-level `#[feature(foo)]` attribute.
10-
* Managed boxes (@) are now behind a feature gate
11-
(`#[feature(managed_boxes)]`) in preperation for future removal. Use the
12-
standard library's `Gc` or `Rc` types instead.
13-
* `@mut` has been removed. Use `std::cell::{Cell, RefCell}` instead.
14-
* Jumping back to the top of a loop is now done with `continue` instead of
15-
`loop`.
16-
* Strings can no longer be mutated through index assignment.
17-
* Raw strings can be created via the basic `r"foo"` syntax or with matched
18-
hash delimiters, as in `r###"foo"###`.
19-
* `~fn` is now written `proc (args) -> retval { ... }` and may only be
20-
called once.
21-
* The `&fn` type is now written `|args| -> ret` to match the literal form.
22-
* `@fn`s have been removed.
23-
* `do` only works with procs in order to make it obvious what the cost
24-
of `do` is.
25-
* The `#[link(...)]` attribute has been replaced with
26-
`#[crate_id = "name#vers"]`.
27-
* Empty `impl`s must be terminated with empty braces and may not be
28-
terminated with a semicolon.
29-
* Keywords are no longer allowed as lifetime names; the `self` lifetime
30-
no longer has any special meaning.
31-
* The old `fmt!` string formatting macro has been removed.
32-
* `printf!` and `printfln!` (old-style formatting) removed in favor of
33-
`print!` and `println!`.
34-
* `mut` works in patterns now, as in `let (mut x, y) = (1, 2);`.
35-
* New reserved keywords: `alignof`, `offsetof`, `sizeof`.
36-
* Macros can have attributes.
37-
* Macros can expand to items with attributes.
38-
* Macros can expand to multiple items.
39-
* The `asm!` macro is feature-gated (`#[feature(asm)]`).
40-
* Comments may be nested.
41-
* Values automatically coerce to trait objects they implement, without
42-
an explicit `as`.
43-
* Enum discriminants are no longer an entire word but as small as needed to
44-
contain all the variants. The `repr` attribute can be used to override
45-
the discriminant size, as in `#[repr(int)]` for integer-sized, and
46-
`#[repr(C)]` to match C enums.
47-
* Non-string literals are not allowed in attributes (they never worked).
48-
* The FFI now supports variadic functions.
49-
* Octal numeric literals, as in `0o7777`.
50-
* The `concat!` syntax extension performs compile-time string concatenation.
51-
* The `#[fixed_stack_segment]` and `#[rust_stack]` attributes have been
52-
removed as Rust no longer uses segmented stacks.
53-
* Non-ascii identifiers are feature-gated (`#[feature(non_ascii_idents)]`).
54-
* Ignoring all fields of an enum variant or tuple-struct is done with `..`,
55-
not `*`; ignoring remaining fields of a struct is also done with `..`,
56-
not `_`; ignoring a slice of a vector is done with `..`, not `.._`.
57-
* `rustc` supports the "win64" calling convention via `extern "win64"`.
58-
* `rustc` supports the "system" calling convention, which defaults to the
59-
preferred convention for the target platform, "stdcall" on 32-bit Windows,
60-
"C" elsewhere.
61-
* The `type_overflow` lint (default: warn) checks literals for overflow.
62-
* The `unsafe_block` lint (default: allow) checks for usage of `unsafe`.
63-
* The `attribute_usage` lint (default: warn) warns about unknown
64-
attributes.
65-
* The `unknown_features` lint (default: warn) warns about unknown
66-
feature gates.
67-
* The `dead_code` lint (default: warn) checks for dead code.
68-
* Rust libraries can be linked statically to one another
69-
* `#[link_args]` is behind the `link_args` feature gate.
70-
* Native libraries are now linked with `#[link(name = "foo")]`
71-
* Native libraries can be statically linked to a rust crate
72-
(`#[link(name = "foo", kind = "static")]`).
73-
* Native OS X frameworks are now officially supported
74-
(`#[link(name = "foo", kind = "framework")]`).
75-
* The `#[thread_local]` attribute creates thread-local (not task-local)
76-
variables. Currently behind the `thread_local` feature gate.
77-
* The `return` keyword may be used in closures.
78-
* Types that can be copied via a memcpy implement the `Pod` kind.
79-
80-
* Libraries
81-
* std: The `option` and `result` API's have been overhauled to make them
82-
simpler, more consistent, and more composable.
83-
* std: The entire `std::io` module has been replaced with one that is
84-
more comprehensive and that properly interfaces with the underlying
85-
scheduler. File, TCP, UDP, Unix sockets, pipes, and timers are all
86-
implemented.
87-
* std: `io::util` contains a number of useful implementations of
88-
`Reader` and `Writer`, including `NullReader`, `NullWriter`,
89-
`ZeroReader`, `TeeReader`.
90-
* std: The reference counted pointer type `extra::rc` moved into std.
91-
* std: The `Gc` type in the `gc` module will replace `@` (it is currently
92-
just a wrapper around it).
93-
* std: `fmt::Default` can be implemented for any type to provide default
94-
formatting to the `format!` macro, as in `format!("{}", myfoo)`.
95-
* std: The `rand` API continues to be tweaked.
96-
* std: Functions dealing with type size and alignment have moved from the
97-
`sys` module to the `mem` module.
98-
* std: The `path` module was written and API changed.
99-
* std: `str::from_utf8` has been changed to cast instead of allocate.
100-
* std: `starts_with` and `ends_with` methods added to vectors via the
101-
`ImmutableEqVector` trait, which is in the prelude.
102-
* std: Vectors can be indexed with the `get_opt` method, which returns `None`
103-
if the index is out of bounds.
104-
* std: Task failure no longer propagates between tasks, as the model was
105-
complex, expensive, and incompatible with thread-based tasks.
106-
* std: The `Any` type can be used for dynamic typing.
107-
* std: `~Any` can be passed to the `fail!` macro and retrieved via
108-
`task::try`.
109-
* std: Methods that produce iterators generally do not have an `_iter`
110-
suffix now.
111-
* std: `cell::Cell` and `cell::RefCell` can be used to introduce mutability
112-
roots (mutable fields, etc.). Use instead of e.g. `@mut`.
113-
* std: `util::ignore` renamed to `prelude::drop`.
114-
* std: Slices have `sort` and `sort_by` methods via the `MutableVector`
115-
trait.
116-
* std: `vec::raw` has seen a lot of cleanup and API changes.
117-
* std: The standard library no longer includes any C++ code, and very
118-
minimal C, eliminating the dependency on libstdc++.
119-
* std: Runtime scheduling and I/O functionality has been factored out into
120-
extensible interfaces and is now implemented by two different crates:
121-
libnative, for native threading and I/O; and libgreen, for green threading
122-
and I/O. This paves the way for using the standard library in more limited
123-
embeded environments.
124-
* std: The `comm` module has been rewritten to be much faster, have a
125-
simpler, more consistent API, and to work for both native and green
126-
threading.
127-
* std: All libuv dependencies have been moved into the rustuv crate.
128-
* native: New implementations of runtime scheduling on top of OS threads.
129-
* native: New native implementations of TCP, UDP, file I/O, process spawning,
130-
and other I/O.
131-
* green: The green thread scheduler and message passing types are almost
132-
entirely lock-free.
133-
* extra: The `flatpipes` module had bitrotted and was removed.
134-
* extra: All crypto functions have been removed and Rust now has a policy of
135-
not reimplementing crypto in the standard library. In the future crypto
136-
will be provided by external crates with bindings to established libraries.
137-
* extra: `c_vec` has been modernized.
138-
* extra: The `sort` module has been removed. Use the `sort` method on
139-
mutable slices.
4+
* ~XXX changes, numerous bugfixes
1405

1416
* Tooling
142-
* The `rust` and `rusti` commands have been removed, due to lack of
143-
maintenance.
144-
* `rustdoc` was completely rewritten.
145-
* `rustdoc` can test code examples in documentation.
146-
* `rustpkg` can test packages with the argument, 'test'.
147-
* `rustpkg` supports arbitrary dependencies, including C libraries.
148-
* `rustc`'s support for generating debug info is improved again.
149-
* `rustc` has better error reporting for unbalanced delimiters.
150-
* `rustc`'s JIT support was removed due to bitrot.
151-
* Executables and static libraries can be built with LTO (-Z lto)
152-
* `rustc` adds a `--dep-info` flag for communicating dependencies to
153-
build tools.
7+
* The `rust` and `rusti` commands have been removed, due to lack of maintenance.
1548

1559
Version 0.8 (September 2013)
15610
--------------------------

branches/auto/doc/rust.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,6 +3806,25 @@ As a convenience, the logging spec can also be set to a special pseudo-crate,
38063806
`::help`. In this case, when the application starts, the runtime will
38073807
simply output a list of loaded modules containing log expressions, then exit.
38083808

3809+
The Rust runtime itself generates logging information. The runtime's logs are
3810+
generated for a number of artificial modules in the `::rt` pseudo-crate,
3811+
and can be enabled just like the logs for any standard module. The full list
3812+
of runtime logging modules follows.
3813+
3814+
* `::rt::mem` Memory management
3815+
* `::rt::comm` Messaging and task communication
3816+
* `::rt::task` Task management
3817+
* `::rt::dom` Task scheduling
3818+
* `::rt::trace` Unused
3819+
* `::rt::cache` Type descriptor cache
3820+
* `::rt::upcall` Compiler-generated runtime calls
3821+
* `::rt::timer` The scheduler timer
3822+
* `::rt::gc` Garbage collection
3823+
* `::rt::stdlib` Functions used directly by the standard library
3824+
* `::rt::kern` The runtime kernel
3825+
* `::rt::backtrace` Log a backtrace on task failure
3826+
* `::rt::callback` Unused
3827+
38093828
#### Logging Expressions
38103829

38113830
Rust provides several macros to log information. Here's a simple Rust program

branches/auto/src/libgreen/lib.rs

Lines changed: 15 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,18 @@
2525
// NB this does *not* include globs, please keep it that way.
2626
#[feature(macro_rules)];
2727

28-
// Allow check-stage0-green for now
29-
#[cfg(test, stage0)] extern mod green;
30-
3128
use std::os;
3229
use std::rt::crate_map;
30+
use std::rt::local::Local;
3331
use std::rt::rtio;
32+
use std::rt::task::Task;
3433
use std::rt::thread::Thread;
3534
use std::rt;
3635
use std::sync::atomics::{SeqCst, AtomicUint, INIT_ATOMIC_UINT};
3736
use std::sync::deque;
3837
use std::task::TaskOpts;
3938
use std::util;
4039
use std::vec;
41-
use std::sync::arc::UnsafeArc;
4240

4341
use sched::{Shutdown, Scheduler, SchedHandle, TaskFromFriend, NewNeighbor};
4442
use sleeper_list::SleeperList;
@@ -120,6 +118,14 @@ pub fn run(main: proc()) -> int {
120118
os::set_exit_status(rt::DEFAULT_ERROR_CODE);
121119
}
122120

121+
// Once the main task has exited and we've set our exit code, wait for all
122+
// spawned sub-tasks to finish running. This is done to allow all schedulers
123+
// to remain active while there are still tasks possibly running.
124+
unsafe {
125+
let mut task = Local::borrow(None::<Task>);
126+
task.get().wait_for_other_tasks();
127+
}
128+
123129
// Now that we're sure all tasks are dead, shut down the pool of schedulers,
124130
// waiting for them all to return.
125131
pool.shutdown();
@@ -158,17 +164,6 @@ pub struct SchedPool {
158164
priv deque_pool: deque::BufferPool<~task::GreenTask>,
159165
priv sleepers: SleeperList,
160166
priv factory: fn() -> ~rtio::EventLoop,
161-
priv task_state: TaskState,
162-
priv tasks_done: Port<()>,
163-
}
164-
165-
/// This is an internal state shared among a pool of schedulers. This is used to
166-
/// keep track of how many tasks are currently running in the pool and then
167-
/// sending on a channel once the entire pool has been drained of all tasks.
168-
#[deriving(Clone)]
169-
struct TaskState {
170-
cnt: UnsafeArc<AtomicUint>,
171-
done: SharedChan<()>,
172167
}
173168

174169
impl SchedPool {
@@ -187,7 +182,6 @@ impl SchedPool {
187182
assert!(nscheds > 0);
188183

189184
// The pool of schedulers that will be returned from this function
190-
let (p, state) = TaskState::new();
191185
let mut pool = SchedPool {
192186
threads: ~[],
193187
handles: ~[],
@@ -198,8 +192,6 @@ impl SchedPool {
198192
deque_pool: deque::BufferPool::new(),
199193
next_friend: 0,
200194
factory: factory,
201-
task_state: state,
202-
tasks_done: p,
203195
};
204196

205197
// Create a work queue for each scheduler, ntimes. Create an extra
@@ -218,30 +210,21 @@ impl SchedPool {
218210
(pool.factory)(),
219211
worker,
220212
pool.stealers.clone(),
221-
pool.sleepers.clone(),
222-
pool.task_state.clone());
213+
pool.sleepers.clone());
223214
pool.handles.push(sched.make_handle());
224215
let sched = sched;
225-
pool.threads.push(do Thread::start { sched.bootstrap(); });
216+
pool.threads.push(do Thread::start {
217+
sched.bootstrap();
218+
});
226219
}
227220

228221
return pool;
229222
}
230223

231-
/// Creates a new task configured to run inside of this pool of schedulers.
232-
/// This is useful to create a task which can then be sent to a specific
233-
/// scheduler created by `spawn_sched` (and possibly pin it to that
234-
/// scheduler).
235224
pub fn task(&mut self, opts: TaskOpts, f: proc()) -> ~GreenTask {
236225
GreenTask::configure(&mut self.stack_pool, opts, f)
237226
}
238227

239-
/// Spawns a new task into this pool of schedulers, using the specified
240-
/// options to configure the new task which is spawned.
241-
///
242-
/// New tasks are spawned in a round-robin fashion to the schedulers in this
243-
/// pool, but tasks can certainly migrate among schedulers once they're in
244-
/// the pool.
245228
pub fn spawn(&mut self, opts: TaskOpts, f: proc()) {
246229
let task = self.task(opts, f);
247230

@@ -279,8 +262,7 @@ impl SchedPool {
279262
(self.factory)(),
280263
worker,
281264
self.stealers.clone(),
282-
self.sleepers.clone(),
283-
self.task_state.clone());
265+
self.sleepers.clone());
284266
let ret = sched.make_handle();
285267
self.handles.push(sched.make_handle());
286268
let sched = sched;
@@ -289,28 +271,9 @@ impl SchedPool {
289271
return ret;
290272
}
291273

292-
/// Consumes the pool of schedulers, waiting for all tasks to exit and all
293-
/// schedulers to shut down.
294-
///
295-
/// This function is required to be called in order to drop a pool of
296-
/// schedulers, it is considered an error to drop a pool without calling
297-
/// this method.
298-
///
299-
/// This only waits for all tasks in *this pool* of schedulers to exit, any
300-
/// native tasks or extern pools will not be waited on
301274
pub fn shutdown(mut self) {
302275
self.stealers = ~[];
303276

304-
// Wait for everyone to exit. We may have reached a 0-task count
305-
// multiple times in the past, meaning there could be several buffered
306-
// messages on the `tasks_done` port. We're guaranteed that after *some*
307-
// message the current task count will be 0, so we just receive in a
308-
// loop until everything is totally dead.
309-
while self.task_state.active() {
310-
self.tasks_done.recv();
311-
}
312-
313-
// Now that everyone's gone, tell everything to shut down.
314277
for mut handle in util::replace(&mut self.handles, ~[]).move_iter() {
315278
handle.send(Shutdown);
316279
}
@@ -320,31 +283,6 @@ impl SchedPool {
320283
}
321284
}
322285

323-
impl TaskState {
324-
fn new() -> (Port<()>, TaskState) {
325-
let (p, c) = SharedChan::new();
326-
(p, TaskState {
327-
cnt: UnsafeArc::new(AtomicUint::new(0)),
328-
done: c,
329-
})
330-
}
331-
332-
fn increment(&mut self) {
333-
unsafe { (*self.cnt.get()).fetch_add(1, SeqCst); }
334-
}
335-
336-
fn active(&self) -> bool {
337-
unsafe { (*self.cnt.get()).load(SeqCst) != 0 }
338-
}
339-
340-
fn decrement(&mut self) {
341-
let prev = unsafe { (*self.cnt.get()).fetch_sub(1, SeqCst) };
342-
if prev == 1 {
343-
self.done.send(());
344-
}
345-
}
346-
}
347-
348286
impl Drop for SchedPool {
349287
fn drop(&mut self) {
350288
if self.threads.len() > 0 {

0 commit comments

Comments
 (0)