Skip to content

Commit cefee92

Browse files
committed
---
yaml --- r: 44703 b: refs/heads/master c: c4ef822 h: refs/heads/master i: 44701: ef28c4b 44699: 7c06166 44695: a1c6851 44687: d315980 44671: dddeda5 v: v3
1 parent c5fb83f commit cefee92

File tree

233 files changed

+2227
-2298
lines changed

Some content is hidden

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

233 files changed

+2227
-2298
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: a712d828f93ca08c072808d57fb110b1f9d0ca72
2+
refs/heads/master: c4ef822dc7e4fcd05f9e4663e6f5c2196129d605
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/doc/tutorial-tasks.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ concurrently:
157157

158158
~~~~
159159
use task::spawn;
160-
use comm::{stream, Port, Chan};
160+
use pipes::{stream, Port, Chan};
161161
162162
let (port, chan): (Port<int>, Chan<int>) = stream();
163163
@@ -178,7 +178,7 @@ stream for sending and receiving integers (the left-hand side of the `let`,
178178
a tuple into its component parts).
179179

180180
~~~~
181-
# use comm::{stream, Chan, Port};
181+
# use pipes::{stream, Chan, Port};
182182
let (port, chan): (Port<int>, Chan<int>) = stream();
183183
~~~~
184184

@@ -189,7 +189,7 @@ spawns the child task.
189189
~~~~
190190
# use task::{spawn};
191191
# use task::spawn;
192-
# use comm::{stream, Port, Chan};
192+
# use pipes::{stream, Port, Chan};
193193
# fn some_expensive_computation() -> int { 42 }
194194
# let (port, chan) = stream();
195195
do spawn || {
@@ -209,7 +209,7 @@ computation, then waits for the child's result to arrive on the
209209
port:
210210

211211
~~~~
212-
# use comm::{stream, Port, Chan};
212+
# use pipes::{stream, Port, Chan};
213213
# fn some_other_expensive_computation() {}
214214
# let (port, chan) = stream::<int>();
215215
# chan.send(0);
@@ -225,7 +225,7 @@ following program is ill-typed:
225225

226226
~~~ {.xfail-test}
227227
# use task::{spawn};
228-
# use comm::{stream, Port, Chan};
228+
# use pipes::{stream, Port, Chan};
229229
# fn some_expensive_computation() -> int { 42 }
230230
let (port, chan) = stream();
231231
@@ -245,7 +245,7 @@ Instead we can use a `SharedChan`, a type that allows a single
245245

246246
~~~
247247
# use task::spawn;
248-
use comm::{stream, SharedChan};
248+
use pipes::{stream, SharedChan};
249249
250250
let (port, chan) = stream();
251251
let chan = SharedChan(chan);
@@ -278,7 +278,7 @@ might look like the example below.
278278

279279
~~~
280280
# use task::spawn;
281-
# use comm::{stream, Port, Chan};
281+
# use pipes::{stream, Port, Chan};
282282
283283
// Create a vector of ports, one for each child task
284284
let ports = do vec::from_fn(3) |init_val| {
@@ -393,7 +393,7 @@ internally, with additional logic to wait for the child task to finish
393393
before returning. Hence:
394394

395395
~~~
396-
# use comm::{stream, Chan, Port};
396+
# use pipes::{stream, Chan, Port};
397397
# use task::{spawn, try};
398398
# fn sleep_forever() { loop { task::yield() } }
399399
# do task::try {
@@ -468,7 +468,7 @@ Here is the function that implements the child task:
468468

469469
~~~~
470470
# use std::comm::DuplexStream;
471-
# use comm::{Port, Chan};
471+
# use pipes::{Port, Chan};
472472
fn stringifier(channel: &DuplexStream<~str, uint>) {
473473
let mut value: uint;
474474
loop {
@@ -491,7 +491,7 @@ Here is the code for the parent task:
491491

492492
~~~~
493493
# use std::comm::DuplexStream;
494-
# use comm::{Port, Chan};
494+
# use pipes::{Port, Chan};
495495
# use task::spawn;
496496
# fn stringifier(channel: &DuplexStream<~str, uint>) {
497497
# let mut value: uint;

trunk/src/compiletest/procsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn run(lib_path: ~str,
7676

7777

7878
writeclose(pipe_in.out, input);
79-
let p = comm::PortSet();
79+
let p = pipes::PortSet();
8080
let ch = p.chan();
8181
do task::spawn_sched(task::SingleThreaded) || {
8282
let errput = readclose(pipe_err.in);

trunk/src/etc/x86.supp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,6 @@
415415
...
416416
}
417417

418-
{
419-
enum-instruction-scheduling-8
420-
Memcheck:Cond
421-
fun:*should_set_output_format_to_markdown_if_requested*
422-
...
423-
}
424-
425418
{
426419
llvm-user-new-leak
427420
Memcheck:Leak

trunk/src/libcore/cleanup.rs

Lines changed: 24 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -111,102 +111,45 @@ struct Task {
111111
* This runs at task death to free all boxes.
112112
*/
113113

114-
struct AnnihilateStats {
115-
n_total_boxes: uint,
116-
n_unique_boxes: uint,
117-
n_bytes_freed: uint
118-
}
119-
120-
unsafe fn each_live_alloc(f: fn(box: *mut BoxRepr, uniq: bool) -> bool) {
121-
use managed;
122-
123-
let task: *Task = transmute(rustrt::rust_get_task());
124-
let box = (*task).boxed_region.live_allocs;
125-
let mut box: *mut BoxRepr = transmute(copy box);
126-
while box != mut_null() {
127-
let next = transmute(copy (*box).header.next);
128-
let uniq =
129-
(*box).header.ref_count == managed::raw::RC_MANAGED_UNIQUE;
130-
131-
if ! f(box, uniq) {
132-
break
133-
}
134-
135-
box = next
136-
}
137-
}
138-
139-
#[cfg(unix)]
140-
fn debug_mem() -> bool {
141-
use os;
142-
use libc;
143-
do os::as_c_charp("RUST_DEBUG_MEM") |p| {
144-
unsafe { libc::getenv(p) != null() }
145-
}
146-
}
147-
148-
#[cfg(windows)]
149-
fn debug_mem() -> bool {
150-
false
151-
}
152-
153114
/// Destroys all managed memory (i.e. @ boxes) held by the current task.
154115
#[cfg(notest)]
155116
#[lang="annihilate"]
156117
pub unsafe fn annihilate() {
157118
use rt::rt_free;
158119
use io::WriterUtil;
159-
use io;
160-
use libc;
161-
use sys;
162-
use managed;
163120

164-
let mut stats = AnnihilateStats {
165-
n_total_boxes: 0,
166-
n_unique_boxes: 0,
167-
n_bytes_freed: 0
168-
};
121+
let task: *Task = transmute(rustrt::rust_get_task());
169122

170123
// Pass 1: Make all boxes immortal.
171-
for each_live_alloc |box, uniq| {
172-
stats.n_total_boxes += 1;
173-
if uniq {
174-
stats.n_unique_boxes += 1;
175-
} else {
176-
(*box).header.ref_count = managed::raw::RC_IMMORTAL;
177-
}
124+
let box = (*task).boxed_region.live_allocs;
125+
let mut box: *mut BoxRepr = transmute(copy box);
126+
while box != mut_null() {
127+
debug!("making box immortal: %x", box as uint);
128+
(*box).header.ref_count = 0x77777777;
129+
box = transmute(copy (*box).header.next);
178130
}
179131

180132
// Pass 2: Drop all boxes.
181-
for each_live_alloc |box, uniq| {
182-
if !uniq {
183-
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
184-
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
185-
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
186-
}
187-
}
133+
let box = (*task).boxed_region.live_allocs;
134+
let mut box: *mut BoxRepr = transmute(copy box);
135+
while box != mut_null() {
136+
debug!("calling drop glue for box: %x", box as uint);
137+
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
138+
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
139+
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
188140

189-
// Pass 3: Free all boxes.
190-
for each_live_alloc |box, uniq| {
191-
if !uniq {
192-
stats.n_bytes_freed +=
193-
(*((*box).header.type_desc)).size
194-
+ sys::size_of::<BoxRepr>();
195-
rt_free(transmute(box));
196-
}
141+
box = transmute(copy (*box).header.next);
197142
}
198143

199-
if debug_mem() {
200-
// We do logging here w/o allocation.
201-
let dbg = libc::STDERR_FILENO as io::fd_t;
202-
dbg.write_str("annihilator stats:");
203-
dbg.write_str("\n total_boxes: ");
204-
dbg.write_uint(stats.n_total_boxes);
205-
dbg.write_str("\n unique_boxes: ");
206-
dbg.write_uint(stats.n_unique_boxes);
207-
dbg.write_str("\n bytes_freed: ");
208-
dbg.write_uint(stats.n_bytes_freed);
209-
dbg.write_str("\n");
144+
// Pass 3: Free all boxes.
145+
loop {
146+
let box = (*task).boxed_region.live_allocs;
147+
if box == null() { break; }
148+
let mut box: *mut BoxRepr = transmute(copy box);
149+
assert (*box).header.prev == null();
150+
151+
debug!("freeing box: %x", box as uint);
152+
rt_free(transmute(box));
210153
}
211154
}
212155

0 commit comments

Comments
 (0)