Skip to content

Commit ddd018d

Browse files
committed
---
yaml --- r: 72601 b: refs/heads/dist-snap c: cce97ab h: refs/heads/master i: 72599: 1059199 v: v3
1 parent 1351b64 commit ddd018d

File tree

243 files changed

+6238
-8428
lines changed

Some content is hidden

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

243 files changed

+6238
-8428
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 88ec89d3fe42029dd6005822191dc97de07d930c
10+
refs/heads/dist-snap: cce97ab8cb225c9ae5b9e8dca4f96bd750eebdb7
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/compiletest/header.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ pub fn load_props(testfile: &Path) -> TestProps {
8282
}
8383

8484
pub fn is_test_ignored(config: config, testfile: &Path) -> bool {
85+
let mut found = false;
8586
for iter_header(testfile) |ln| {
8687
if parse_name_directive(ln, ~"xfail-test") { return true; }
8788
if parse_name_directive(ln, xfail_target()) { return true; }
8889
if config.mode == common::mode_pretty &&
8990
parse_name_directive(ln, ~"xfail-pretty") { return true; }
9091
};
91-
return false;
92+
return found;
9293

9394
fn xfail_target() -> ~str {
9495
~"xfail-" + str::from_slice(os::SYSNAME)

branches/dist-snap/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn run_rpass_test(config: config, props: TestProps, testfile: &Path) {
106106
fatal_ProcRes(~"test run failed!", ProcRes);
107107
}
108108
} else {
109-
let ProcRes = jit_test(config, props, testfile);
109+
let mut ProcRes = jit_test(config, props, testfile);
110110
111111
if ProcRes.status != 0 { fatal_ProcRes(~"jit failed!", ProcRes); }
112112
}

branches/dist-snap/src/libcore/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn empty_cell<T>() -> Cell<T> {
4242
pub impl<T> Cell<T> {
4343
/// Yields the value, failing if the cell is empty.
4444
fn take(&self) -> T {
45-
let self = unsafe { transmute_mut(self) };
45+
let mut self = unsafe { transmute_mut(self) };
4646
if self.is_empty() {
4747
fail!(~"attempt to take an empty cell");
4848
}
@@ -54,7 +54,7 @@ pub impl<T> Cell<T> {
5454
5555
/// Returns the value, failing if the cell is full.
5656
fn put_back(&self, value: T) {
57-
let self = unsafe { transmute_mut(self) };
57+
let mut self = unsafe { transmute_mut(self) };
5858
if !self.is_empty() {
5959
fail!(~"attempt to put a value back into a full cell");
6060
}

branches/dist-snap/src/libcore/cleanup.rs

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,22 @@ struct AnnihilateStats {
126126
n_bytes_freed: uint
127127
}
128128

129-
unsafe fn each_live_alloc(read_next_before: bool,
130-
f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
131-
//! Walks the internal list of allocations
132-
129+
unsafe fn each_live_alloc(f: &fn(box: *mut BoxRepr, uniq: bool) -> bool) {
133130
use managed;
134131

135132
let task: *Task = transmute(rustrt::rust_get_task());
136133
let box = (*task).boxed_region.live_allocs;
137134
let mut box: *mut BoxRepr = transmute(copy box);
138135
while box != mut_null() {
139-
let next_before = transmute(copy (*box).header.next);
136+
let next = transmute(copy (*box).header.next);
140137
let uniq =
141138
(*box).header.ref_count == managed::raw::RC_MANAGED_UNIQUE;
142139

143140
if ! f(box, uniq) {
144141
break
145142
}
146143

147-
if read_next_before {
148-
box = next_before;
149-
} else {
150-
box = transmute(copy (*box).header.next);
151-
}
144+
box = next
152145
}
153146
}
154147

@@ -166,7 +159,7 @@ fn debug_mem() -> bool {
166159
#[cfg(notest)]
167160
#[lang="annihilate"]
168161
pub unsafe fn annihilate() {
169-
use unstable::lang::{local_free, debug_ptr};
162+
use unstable::lang::local_free;
170163
use io::WriterUtil;
171164
use io;
172165
use libc;
@@ -180,46 +173,27 @@ pub unsafe fn annihilate() {
180173
};
181174

182175
// Pass 1: Make all boxes immortal.
183-
//
184-
// In this pass, nothing gets freed, so it does not matter whether
185-
// we read the next field before or after the callback.
186-
for each_live_alloc(true) |box, uniq| {
176+
for each_live_alloc |box, uniq| {
187177
stats.n_total_boxes += 1;
188178
if uniq {
189-
debug_ptr("Managed-uniq: ", &*box);
190179
stats.n_unique_boxes += 1;
191180
} else {
192-
debug_ptr("Immortalizing: ", &*box);
193181
(*box).header.ref_count = managed::raw::RC_IMMORTAL;
194182
}
195183
}
196184

197185
// Pass 2: Drop all boxes.
198-
//
199-
// In this pass, unique-managed boxes may get freed, but not
200-
// managed boxes, so we must read the `next` field *after* the
201-
// callback, as the original value may have been freed.
202-
for each_live_alloc(false) |box, uniq| {
186+
for each_live_alloc |box, uniq| {
203187
if !uniq {
204-
debug_ptr("Invoking tydesc/glue on: ", &*box);
205188
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
206189
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
207-
debug_ptr("Box data: ", &(*box).data);
208-
debug_ptr("Type descriptor: ", tydesc);
209190
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
210-
debug_ptr("Dropped ", &*box);
211191
}
212192
}
213193

214194
// Pass 3: Free all boxes.
215-
//
216-
// In this pass, managed boxes may get freed (but not
217-
// unique-managed boxes, though I think that none of those are
218-
// left), so we must read the `next` field before, since it will
219-
// not be valid after.
220-
for each_live_alloc(true) |box, uniq| {
195+
for each_live_alloc |box, uniq| {
221196
if !uniq {
222-
debug_ptr("About to free: ", &*box);
223197
stats.n_bytes_freed +=
224198
(*((*box).header.type_desc)).size
225199
+ sys::size_of::<BoxRepr>();

branches/dist-snap/src/libcore/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ impl<T: Owned> Selectable for Port<T> {
205205
fn header(&self) -> *PacketHeader {
206206
unsafe {
207207
match self.endp {
208-
Some(ref endp) => endp.header(),
209-
None => fail!(~"peeking empty stream")
208+
Some(ref endp) => endp.header(),
209+
None => fail!(~"peeking empty stream")
210210
}
211211
}
212212
}

branches/dist-snap/src/libcore/container.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,42 @@ pub trait Mutable: Container {
2525
fn clear(&mut self);
2626
}
2727

28+
#[cfg(stage0)]
29+
pub trait Map<K, V>: Mutable {
30+
/// Return true if the map contains a value for the specified key
31+
fn contains_key(&self, key: &K) -> bool;
32+
33+
// Visits all keys and values
34+
fn each(&self, f: &fn(&K, &V) -> bool);
35+
36+
/// Visit all keys
37+
fn each_key(&self, f: &fn(&K) -> bool);
38+
39+
/// Visit all values
40+
fn each_value(&self, f: &fn(&V) -> bool);
41+
42+
/// Iterate over the map and mutate the contained values
43+
fn mutate_values(&mut self, f: &fn(&K, &mut V) -> bool);
44+
45+
/// Return a reference to the value corresponding to the key
46+
fn find(&self, key: &K) -> Option<&'self V>;
47+
48+
/// Return a mutable reference to the value corresponding to the key
49+
fn find_mut(&mut self, key: &K) -> Option<&'self mut V>;
50+
51+
/// Insert a key-value pair into the map. An existing value for a
52+
/// key is replaced by the new value. Return true if the key did
53+
/// not already exist in the map.
54+
fn insert(&mut self, key: K, value: V) -> bool;
55+
56+
/// Remove a key-value pair from the map. Return true if the key
57+
/// was present in the map, otherwise false.
58+
fn remove(&mut self, key: &K) -> bool;
59+
}
60+
61+
#[cfg(stage1)]
62+
#[cfg(stage2)]
63+
#[cfg(stage3)]
2864
pub trait Map<K, V>: Mutable {
2965
/// Return true if the map contains a value for the specified key
3066
fn contains_key(&self, key: &K) -> bool;

branches/dist-snap/src/libcore/core.rc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ they contained the following prologue:
7575

7676
pub use kinds::{Const, Copy, Owned, Durable};
7777
pub use ops::{Drop};
78+
#[cfg(stage0)]
79+
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
80+
#[cfg(not(stage0))]
7881
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
7982
pub use ops::{BitAnd, BitOr, BitXor};
8083
pub use ops::{Shl, Shr, Index};

branches/dist-snap/src/libcore/flate.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Simple compression
1616

1717
use libc;
1818
use libc::{c_void, size_t, c_int};
19+
use ptr;
1920
use vec;
2021

2122
#[cfg(test)] use rand;
@@ -28,13 +29,13 @@ pub mod rustrt {
2829
pub extern {
2930
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
3031
src_buf_len: size_t,
31-
pout_len: *mut size_t,
32+
pout_len: *size_t,
3233
flags: c_int)
3334
-> *c_void;
3435

3536
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
3637
src_buf_len: size_t,
37-
pout_len: *mut size_t,
38+
pout_len: *size_t,
3839
flags: c_int)
3940
-> *c_void;
4041
}
@@ -52,11 +53,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
5253
let res =
5354
rustrt::tdefl_compress_mem_to_heap(b as *c_void,
5455
len as size_t,
55-
&mut outsz,
56+
&outsz,
5657
lz_norm);
5758
assert!(res as int != 0);
5859
let out = vec::raw::from_buf_raw(res as *u8,
59-
outsz as uint);
60+
outsz as uint);
6061
libc::free(res);
6162
out
6263
}
@@ -66,11 +67,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
6667
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
6768
do vec::as_const_buf(bytes) |b, len| {
6869
unsafe {
69-
let mut outsz : size_t = 0;
70+
let outsz : size_t = 0;
7071
let res =
7172
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
7273
len as size_t,
73-
&mut outsz,
74+
&outsz,
7475
0);
7576
assert!(res as int != 0);
7677
let out = vec::raw::from_buf_raw(res as *u8,

0 commit comments

Comments
 (0)