Skip to content

Commit 78f037f

Browse files
committed
---
yaml --- r: 138459 b: refs/heads/try2 c: 9dae4cf h: refs/heads/master i: 138457: 8abab51 138455: ed35ab9 v: v3
1 parent 2df6d4c commit 78f037f

File tree

163 files changed

+1758
-2066
lines changed

Some content is hidden

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

163 files changed

+1758
-2066
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c316189d155e233ea04241116b11956626c8e7a3
8+
refs/heads/try2: 9dae4cf1f0f2fd82ee653d89abc46d349b6e6caa
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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;

branches/try2/src/compiletest/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub enum mode {
2121
mode_debug_info,
2222
}
2323

24-
pub struct config {
24+
pub type config = {
2525
// The library paths required for running the compiler
2626
compile_lib_path: ~str,
2727

@@ -68,4 +68,4 @@ pub struct config {
6868
// Explain what's going on
6969
verbose: bool
7070

71-
}
71+
};

branches/try2/src/compiletest/compiletest.rc

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#[crate_type = "bin"];
1212

1313
#[no_core];
14+
#[legacy_records];
1415

1516
#[allow(vecs_implicitly_copyable)];
1617
#[allow(non_camel_case_types)];
@@ -76,28 +77,26 @@ pub fn parse_config(args: ~[~str]) -> config {
7677
Path(getopts::opt_str(m, nm))
7778
}
7879

79-
config {
80-
compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
81-
run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
82-
rustc_path: opt_path(matches, ~"rustc-path"),
83-
src_base: opt_path(matches, ~"src-base"),
84-
build_base: opt_path(matches, ~"build-base"),
85-
aux_base: opt_path(matches, ~"aux-base"),
86-
stage_id: getopts::opt_str(matches, ~"stage-id"),
87-
mode: str_mode(getopts::opt_str(matches, ~"mode")),
88-
run_ignored: getopts::opt_present(matches, ~"ignored"),
89-
filter:
80+
return {compile_lib_path: getopts::opt_str(matches, ~"compile-lib-path"),
81+
run_lib_path: getopts::opt_str(matches, ~"run-lib-path"),
82+
rustc_path: opt_path(matches, ~"rustc-path"),
83+
src_base: opt_path(matches, ~"src-base"),
84+
build_base: opt_path(matches, ~"build-base"),
85+
aux_base: opt_path(matches, ~"aux-base"),
86+
stage_id: getopts::opt_str(matches, ~"stage-id"),
87+
mode: str_mode(getopts::opt_str(matches, ~"mode")),
88+
run_ignored: getopts::opt_present(matches, ~"ignored"),
89+
filter:
9090
if vec::len(matches.free) > 0u {
9191
option::Some(matches.free[0])
9292
} else { option::None },
93-
logfile: option::map(&getopts::opt_maybe_str(matches,
93+
logfile: option::map(&getopts::opt_maybe_str(matches,
9494
~"logfile"),
95-
|s| Path(*s)),
96-
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
97-
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
98-
jit: getopts::opt_present(matches, ~"jit"),
99-
verbose: getopts::opt_present(matches, ~"verbose")
100-
}
95+
|s| Path(*s)),
96+
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
97+
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
98+
jit: getopts::opt_present(matches, ~"jit"),
99+
verbose: getopts::opt_present(matches, ~"verbose")};
101100
}
102101

103102
pub fn log_config(config: config) {

branches/try2/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);

branches/try2/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)