Merge remote-tracking branch 'original/incoming' into incoming

Conflicts:
	src/libstd/json.rs
	src/libstd/sort.rs
This commit is contained in:
Simon BD 2012-10-03 21:47:09 -05:00
commit efcd2385ea
378 changed files with 11486 additions and 8500 deletions

View file

@ -154,7 +154,7 @@ fn main(++args: ~[~str]) {
let seed = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
{
let rng = rand::seeded_rng(copy seed);
let rng = rand::seeded_rng(&seed);
let mut results = empty_results();
int_benchmarks::<map::HashMap<uint, uint>>(
map::HashMap, rng, num_keys, &mut results);
@ -164,7 +164,7 @@ fn main(++args: ~[~str]) {
}
{
let rng = rand::seeded_rng(copy seed);
let rng = rand::seeded_rng(&seed);
let mut results = empty_results();
int_benchmarks::<@Mut<LinearMap<uint, uint>>>(
|| @Mut(LinearMap()),

View file

@ -30,7 +30,7 @@ fn maybe_run_test(argv: &[~str], name: ~str, test: fn()) {
if os::getenv(~"RUST_BENCH").is_some() { run_test = true }
else if argv.len() > 0 {
run_test = argv.contains(~"all") || argv.contains(name)
run_test = argv.contains(&~"all") || argv.contains(&name)
}
if !run_test { return }
@ -47,7 +47,7 @@ fn shift_push() {
let mut v2 = ~[];
while v1.len() > 0 {
vec::push(v2, vec::shift(v1));
v2.push(v1.shift());
}
}
@ -56,7 +56,7 @@ fn read_line() {
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
for int::range(0, 3) |_i| {
let reader = result::get(io::file_reader(&path));
let reader = result::get(&io::file_reader(&path));
while !reader.eof() {
reader.read_line();
}
@ -122,11 +122,11 @@ fn vec_push_all() {
for uint::range(0, 1500) |i| {
let mut rv = vec::from_elem(r.gen_uint_range(0, i + 1), i);
if r.gen_bool() {
vec::push_all(v, rv);
v.push_all(rv);
}
else {
v <-> rv;
vec::push_all(v, rv);
v.push_all(rv);
}
}
}

View file

@ -7,7 +7,7 @@ use io::WriterUtil;
fn collect_raw(num: uint) -> ~[uint] {
let mut result = ~[];
for uint::range(0u, num) |i| {
vec::push(result, i);
result.push(i);
}
return result;
}

View file

@ -97,7 +97,7 @@ fn gen_search_keys(graph: graph, n: uint) -> ~[node_id] {
let k = r.gen_uint_range(0u, graph.len());
if graph[k].len() > 0u && vec::any(graph[k], |i| {
i != k as node_id
*i != k as node_id
}) {
map::set_add(keys, k as node_id);
}
@ -160,8 +160,8 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
}
};
fn is_gray(c: color) -> bool {
match c {
fn is_gray(c: &color) -> bool {
match *c {
gray(_) => { true }
_ => { false }
}
@ -183,7 +183,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
let mut color = white;
do neighbors.each() |k| {
if is_gray(colors[*k]) {
if is_gray(&colors[*k]) {
color = gray(*k);
false
}
@ -231,18 +231,18 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
};
#[inline(always)]
fn is_gray(c: color) -> bool {
match c {
fn is_gray(c: &color) -> bool {
match *c {
gray(_) => { true }
_ => { false }
}
}
let mut i = 0u;
let mut i = 0;
while par::any(colors, is_gray) {
// Do the BFS.
log(info, fmt!("PBFS iteration %?", i));
i += 1u;
i += 1;
let old_len = colors.len();
let color = arc::ARC(colors);
@ -251,7 +251,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
colors = do par::mapi_factory(*color_vec) {
let colors = arc::clone(&color);
let graph = arc::clone(&graph);
fn~(i: uint, c: color) -> color {
fn~(+i: uint, +c: color) -> color {
let c : color = c;
let colors = arc::get(&colors);
let graph = arc::get(&graph);
@ -264,7 +264,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
let mut color = white;
do neighbors.each() |k| {
if is_gray(colors[*k]) {
if is_gray(&colors[*k]) {
color = gray(*k);
false
}
@ -282,7 +282,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
// Convert the results.
do par::map(colors) |c| {
match c {
match *c {
white => { -1i64 }
black(parent) => { parent }
_ => { fail ~"Found remaining gray nodes in BFS" }
@ -314,11 +314,11 @@ fn validate(edges: ~[(node_id, node_id)],
}
else {
while parent != root {
if vec::contains(path, parent) {
if vec::contains(path, &parent) {
status = false;
}
vec::push(path, parent);
path.push(parent);
parent = tree[parent];
}
@ -336,8 +336,8 @@ fn validate(edges: ~[(node_id, node_id)],
log(info, ~"Verifying tree edges...");
let status = do tree.alli() |k, parent| {
if parent != root && parent != -1i64 {
level[parent] == level[k] - 1
if *parent != root && *parent != -1i64 {
level[*parent] == level[k] - 1
}
else {
true
@ -352,7 +352,7 @@ fn validate(edges: ~[(node_id, node_id)],
log(info, ~"Verifying graph edges...");
let status = do edges.all() |e| {
let (u, v) = e;
let (u, v) = *e;
abs(level[u] - level[v]) <= 1
};
@ -370,11 +370,11 @@ fn validate(edges: ~[(node_id, node_id)],
let status = do par::alli(tree) |u, v| {
let u = u as node_id;
if v == -1i64 || u == root {
if *v == -1i64 || u == root {
true
}
else {
edges.contains((u, v)) || edges.contains((v, u))
edges.contains(&(u, *v)) || edges.contains(&(*v, u))
}
};

View file

@ -19,7 +19,7 @@ use io::WriterUtil;
use pipes::{Port, Chan, SharedChan};
macro_rules! move_out (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } }
)
enum request {
@ -60,7 +60,7 @@ fn run(args: &[~str]) {
for uint::range(0u, workers) |i| {
let to_child = to_child.clone();
do task::task().future_result(|+r| {
vec::push(worker_results, r);
worker_results.push(r);
}).spawn {
for uint::range(0u, size / workers) |_i| {
//error!("worker %?: sending %? bytes", i, num_bytes);

View file

@ -15,7 +15,7 @@ use io::WriterUtil;
use pipes::{Port, PortSet, Chan};
macro_rules! move_out (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } }
)
enum request {
@ -57,7 +57,7 @@ fn run(args: &[~str]) {
let (to_child, from_parent_) = pipes::stream();
from_parent.add(from_parent_);
do task::task().future_result(|+r| {
vec::push(worker_results, r);
worker_results.push(r);
}).spawn {
for uint::range(0u, size / workers) |_i| {
//error!("worker %?: sending %? bytes", i, num_bytes);

View file

@ -18,7 +18,7 @@ type pipe = arc::MutexARC<~[uint]>;
fn send(p: &pipe, msg: uint) {
do p.access_cond |state, cond| {
vec::push(*state, msg);
state.push(msg);
cond.signal();
}
}
@ -27,7 +27,7 @@ fn recv(p: &pipe) -> uint {
while vec::is_empty(*state) {
cond.wait();
}
vec::pop(*state)
state.pop()
}
}
@ -91,7 +91,7 @@ fn main(++args: ~[~str]) {
option::unwrap(num_chan),
option::unwrap(num_port1))
});
vec::push(futures, new_future);
futures.push(new_future);
num_chan = Some(new_chan);
};

View file

@ -24,7 +24,7 @@ proto! ring (
fn macros() {
#macro[
[#move_out[x],
unsafe { let y <- *ptr::addr_of(x); y }]
unsafe { let y <- *ptr::addr_of(&x); y }]
];
}
@ -88,7 +88,7 @@ fn main(++args: ~[~str]) {
option::unwrap(num_chan),
option::unwrap(num_port1))
};
vec::push(futures, new_future);
futures.push(new_future);
num_chan = Some(new_chan);
};

View file

@ -18,7 +18,7 @@ type pipe = arc::RWARC<~[uint]>;
fn send(p: &pipe, msg: uint) {
do p.write_cond |state, cond| {
vec::push(*state, msg);
state.push(msg);
cond.signal();
}
}
@ -27,7 +27,7 @@ fn recv(p: &pipe) -> uint {
while vec::is_empty(*state) {
cond.wait();
}
vec::pop(*state)
state.pop()
}
}
@ -92,7 +92,7 @@ fn main(++args: ~[~str]) {
option::unwrap(num_chan),
option::unwrap(num_port1))
};
vec::push(futures, new_future);
futures.push(new_future);
num_chan = Some(new_chan);
};

View file

@ -51,7 +51,7 @@ fn main(++args: ~[~str]) {
get_chan_chan.send(Chan(p));
thread_ring(i, msg_per_task, num_chan, p)
};
vec::push(futures, new_future);
futures.push(new_future);
num_chan = get_chan.recv();
};

View file

@ -37,7 +37,7 @@ fn run(args: ~[~str]) {
let mut worker_results = ~[];
for uint::range(0u, workers) |_i| {
do task::task().future_result(|+r| {
vec::push(worker_results, r);
worker_results.push(r);
}).spawn {
for uint::range(0u, size / workers) |_i| {
comm::send(to_child, bytes(100u));

View file

@ -33,7 +33,7 @@ proto! pingpong_unbounded (
// This stuff should go in libcore::pipes
macro_rules! move_it (
{ $x:expr } => { let t <- *ptr::addr_of($x); t }
{ $x:expr } => { let t <- *ptr::addr_of(&($x)); t }
)
macro_rules! follow (

View file

@ -163,7 +163,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
// save each creature's meeting stats
let mut report = ~[];
for vec::each(to_creature) |_to_one| {
vec::push(report, comm::recv(from_creatures_log));
report.push(comm::recv(from_creatures_log));
}
// print each color in the set

View file

@ -81,7 +81,7 @@ fn main(++args: ~[~str]) {
};
let writer = if os::getenv(~"RUST_BENCH").is_some() {
result::get(io::file_writer(&Path("./shootout-fasta.data"),
result::get(&io::file_writer(&Path("./shootout-fasta.data"),
~[io::Truncate, io::Create]))
} else {
io::stdout()

View file

@ -41,7 +41,7 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
// map -> [(k,%)]
mm.each(fn&(key: ~[u8], val: uint) -> bool {
vec::push(pairs, (key, pct(val, total)));
pairs.push((key, pct(val, total)));
return true;
});
@ -134,7 +134,7 @@ fn main(++args: ~[~str]) {
// get to this massive data set, but #include_bin chokes on it (#2598)
let path = Path(env!("CFG_SRC_DIR"))
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
result::get(io::file_reader(&path))
result::get(&io::file_reader(&path))
} else {
io::stdin()
};
@ -152,7 +152,7 @@ fn main(++args: ~[~str]) {
stream <-> streams[ii];
let (to_parent_, from_child_) = option::unwrap(stream);
vec::push(from_child, from_child_);
from_child.push(from_child_);
let (to_child, from_parent) = pipes::stream();

View file

@ -38,7 +38,7 @@ fn sort_and_fmt(mm: HashMap<~[u8], uint>, total: uint) -> ~str {
// map -> [(k,%)]
mm.each(fn&(key: ~[u8], val: uint) -> bool {
vec::push(pairs, (key, pct(val, total)));
pairs.push((key, pct(val, total)));
return true;
});
@ -131,7 +131,7 @@ fn main(++args: ~[~str]) {
// get to this massive data set, but #include_bin chokes on it (#2598)
let path = Path(env!("CFG_SRC_DIR"))
.push_rel(&Path("src/test/bench/shootout-k-nucleotide.data"));
result::get(io::file_reader(&path))
result::get(&io::file_reader(&path))
} else {
io::stdin()
};

View file

@ -85,7 +85,7 @@ fn chanmb(i: uint, size: uint, ch: comm::Chan<line>) -> ()
let xincr = 8f64*incr;
for uint::range(0_u, size/8_u) |j| {
let x = cmplx {re: xincr*(j as f64) - 1.5f64, im: y};
vec::push(crv, fillbyte(x, incr));
crv.push(fillbyte(x, incr));
};
comm::send(ch, {i:i, b:crv});
}
@ -94,7 +94,7 @@ type devnull = {dn: int};
impl devnull: io::Writer {
fn write(_b: &[const u8]) {}
fn seek(_i: int, _s: io::SeekStyle) {}
fn seek(+_i: int, +_s: io::SeekStyle) {}
fn tell() -> uint {0_u}
fn flush() -> int {0}
fn get_type() -> io::WriterType { io::File }
@ -114,7 +114,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
}
_ => {
result::get(
io::file_writer(&Path(path),
&io::file_writer(&Path(path),
~[io::Create, io::Truncate]))
}
};

View file

@ -73,7 +73,7 @@ fn stress(num_tasks: int) {
let mut results = ~[];
for range(0, num_tasks) |i| {
do task::task().future_result(|+r| {
vec::push(results, r);
results.push(r);
}).spawn {
stress_task(i);
}

View file

@ -21,7 +21,7 @@ fn calc(children: uint, parent_ch: comm::Chan<msg>) {
for iter::repeat (children) {
match comm::recv(port) {
ready(child_ch) => {
vec::push(child_chs, child_ch);
child_chs.push(child_ch);
}
_ => fail ~"task-perf-one-million failed (port not ready)"
}

View file

@ -20,7 +20,7 @@ use option::None;
use std::map;
use std::map::HashMap;
use hash::Hash;
use io::WriterUtil;
use io::{ReaderUtil, WriterUtil};
use std::time;
@ -32,7 +32,7 @@ use cmp::Eq;
use to_bytes::IterBytes;
macro_rules! move_out (
{ $x:expr } => { unsafe { let y <- *ptr::addr_of($x); y } }
{ $x:expr } => { unsafe { let y <- *ptr::addr_of(&($x)); y } }
)
trait word_reader {
@ -155,8 +155,8 @@ mod map_reduce {
let (ctrl, ctrl_server) = ctrl_proto::init();
let ctrl = box(ctrl);
let i = copy *i;
vec::push(tasks, spawn_joinable(|move i| map_task(map, ctrl, i)));
vec::push(ctrls, ctrl_server);
tasks.push(spawn_joinable(|move i| map_task(map, ctrl, i)));
ctrls.push(ctrl_server);
}
return tasks;
}
@ -270,8 +270,7 @@ mod map_reduce {
let p = Port();
let ch = Chan(p);
let r = reduce, kk = k;
vec::push(tasks,
spawn_joinable(|| reduce_task(r, kk, ch) ));
tasks.push(spawn_joinable(|| reduce_task(r, kk, ch) ));
c = recv(p);
reducers.insert(k, c);
}