Skip to content

Commit cb6261a

Browse files
committed
---
yaml --- r: 72700 b: refs/heads/dist-snap c: 2ea52a3 h: refs/heads/master v: v3
1 parent 49f2475 commit cb6261a

File tree

253 files changed

+14728
-5547
lines changed

Some content is hidden

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

253 files changed

+14728
-5547
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: 0e2242f6d62d6d49bf8a2d1860a41273c1fdfa0d
10+
refs/heads/dist-snap: 2ea52a38e59b85b4b6998661b38425ce29839aed
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ endif
110110
ifdef SAVE_TEMPS
111111
CFG_RUSTC_FLAGS += --save-temps
112112
endif
113+
ifdef ASM_COMMENTS
114+
CFG_RUSTC_FLAGS += -z asm-comments
115+
endif
113116
ifdef TIME_PASSES
114117
CFG_RUSTC_FLAGS += -Z time-passes
115118
endif

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 mut self = unsafe { transmute_mut(self) };
45+
let 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 mut self = unsafe { transmute_mut(self) };
57+
let 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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use ptr::mut_null;
1515
use repr::BoxRepr;
1616
use sys::TypeDesc;
1717
use cast::transmute;
18+
#[cfg(notest)] use unstable::lang::clear_task_borrow_list;
1819

1920
#[cfg(notest)] use ptr::to_unsafe_ptr;
2021

@@ -166,7 +167,8 @@ fn debug_mem() -> bool {
166167
#[cfg(notest)]
167168
#[lang="annihilate"]
168169
pub unsafe fn annihilate() {
169-
use unstable::lang::local_free;
170+
use unstable::lang::{local_free};
171+
use unstable::lang;
170172
use io::WriterUtil;
171173
use io;
172174
use libc;
@@ -179,15 +181,21 @@ pub unsafe fn annihilate() {
179181
n_bytes_freed: 0
180182
};
181183

184+
// Quick hack: we need to free this list upon task exit, and this
185+
// is a convenient place to do it.
186+
clear_task_borrow_list();
187+
182188
// Pass 1: Make all boxes immortal.
183189
//
184190
// In this pass, nothing gets freed, so it does not matter whether
185191
// we read the next field before or after the callback.
186192
for each_live_alloc(true) |box, uniq| {
187193
stats.n_total_boxes += 1;
188194
if uniq {
195+
lang::debug_mem("Managed-uniq: ", &*box);
189196
stats.n_unique_boxes += 1;
190197
} else {
198+
lang::debug_mem("Immortalizing: ", &*box);
191199
(*box).header.ref_count = managed::raw::RC_IMMORTAL;
192200
}
193201
}
@@ -199,9 +207,13 @@ pub unsafe fn annihilate() {
199207
// callback, as the original value may have been freed.
200208
for each_live_alloc(false) |box, uniq| {
201209
if !uniq {
210+
lang::debug_mem("Invoking tydesc/glue on: ", &*box);
202211
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
203212
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
213+
lang::debug_mem("Box data: ", &(*box).data);
214+
lang::debug_mem("Type descriptor: ", tydesc);
204215
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
216+
lang::debug_mem("Dropped ", &*box);
205217
}
206218
}
207219

@@ -213,6 +225,7 @@ pub unsafe fn annihilate() {
213225
// not be valid after.
214226
for each_live_alloc(true) |box, uniq| {
215227
if !uniq {
228+
lang::debug_mem("About to free: ", &*box);
216229
stats.n_bytes_freed +=
217230
(*((*box).header.type_desc)).size
218231
+ sys::size_of::<BoxRepr>();

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ totaleq_impl!(uint)
6666

6767
totaleq_impl!(char)
6868

69-
/// Trait for testing approximate equality
70-
pub trait ApproxEq<Eps> {
71-
fn approx_epsilon() -> Eps;
72-
fn approx_eq(&self, other: &Self) -> bool;
73-
fn approx_eq_eps(&self, other: &Self, approx_epsilon: &Eps) -> bool;
74-
}
75-
7669
#[deriving(Clone, Eq)]
7770
pub enum Ordering { Less = -1, Equal = 0, Greater = 1 }
7871

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/flate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ pub mod rustrt {
2828
pub extern {
2929
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
3030
src_buf_len: size_t,
31-
pout_len: *size_t,
31+
pout_len: *mut size_t,
3232
flags: c_int)
3333
-> *c_void;
3434

3535
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
3636
src_buf_len: size_t,
37-
pout_len: *size_t,
37+
pout_len: *mut size_t,
3838
flags: c_int)
3939
-> *c_void;
4040
}
@@ -52,11 +52,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
5252
let res =
5353
rustrt::tdefl_compress_mem_to_heap(b as *c_void,
5454
len as size_t,
55-
&outsz,
55+
&mut outsz,
5656
lz_norm);
5757
assert!(res as int != 0);
5858
let out = vec::raw::from_buf_raw(res as *u8,
59-
outsz as uint);
59+
outsz as uint);
6060
libc::free(res);
6161
out
6262
}
@@ -66,11 +66,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
6666
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
6767
do vec::as_const_buf(bytes) |b, len| {
6868
unsafe {
69-
let outsz : size_t = 0;
69+
let mut outsz : size_t = 0;
7070
let res =
7171
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
7272
len as size_t,
73-
&outsz,
73+
&mut outsz,
7474
0);
7575
assert!(res as int != 0);
7676
let out = vec::raw::from_buf_raw(res as *u8,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use rand;
2525
use uint;
2626
use vec;
2727
use util::unreachable;
28+
use kinds::Copy;
2829

2930
static INITIAL_CAPACITY: uint = 32u; // 2^5
3031

@@ -529,6 +530,18 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
529530
}
530531
}
531532

533+
pub impl<K: Hash + Eq, V: Copy> HashMap<K, V> {
534+
/// Like `find`, but returns a copy of the value.
535+
fn find_copy(&self, k: &K) -> Option<V> {
536+
self.find(k).map_consume(|v| copy *v)
537+
}
538+
539+
/// Like `get`, but returns a copy of the value.
540+
fn get_copy(&self, k: &K) -> V {
541+
copy *self.get(k)
542+
}
543+
}
544+
532545
impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
533546
fn eq(&self, other: &HashMap<K, V>) -> bool {
534547
if self.len() != other.len() { return false; }

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ pub enum WriterType { Screen, File }
10221022
pub trait Writer {
10231023
10241024
/// Write all of the given bytes.
1025-
fn write(&self, v: &const [u8]);
1025+
fn write(&self, v: &[u8]);
10261026
10271027
/// Move the current position within the stream. The second parameter
10281028
/// determines the position that the first parameter is relative to.
@@ -1039,23 +1039,23 @@ pub trait Writer {
10391039
}
10401040
10411041
impl Writer for @Writer {
1042-
fn write(&self, v: &const [u8]) { self.write(v) }
1042+
fn write(&self, v: &[u8]) { self.write(v) }
10431043
fn seek(&self, a: int, b: SeekStyle) { self.seek(a, b) }
10441044
fn tell(&self) -> uint { self.tell() }
10451045
fn flush(&self) -> int { self.flush() }
10461046
fn get_type(&self) -> WriterType { self.get_type() }
10471047
}
10481048
10491049
impl<W:Writer,C> Writer for Wrapper<W, C> {
1050-
fn write(&self, bs: &const [u8]) { self.base.write(bs); }
1050+
fn write(&self, bs: &[u8]) { self.base.write(bs); }
10511051
fn seek(&self, off: int, style: SeekStyle) { self.base.seek(off, style); }
10521052
fn tell(&self) -> uint { self.base.tell() }
10531053
fn flush(&self) -> int { self.base.flush() }
10541054
fn get_type(&self) -> WriterType { File }
10551055
}
10561056
10571057
impl Writer for *libc::FILE {
1058-
fn write(&self, v: &const [u8]) {
1058+
fn write(&self, v: &[u8]) {
10591059
unsafe {
10601060
do vec::as_const_buf(v) |vbuf, len| {
10611061
let nout = libc::fwrite(vbuf as *c_void,
@@ -1105,7 +1105,7 @@ pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer {
11051105
}
11061106

11071107
impl Writer for fd_t {
1108-
fn write(&self, v: &const [u8]) {
1108+
fn write(&self, v: &[u8]) {
11091109
unsafe {
11101110
let mut count = 0u;
11111111
do vec::as_const_buf(v) |vbuf, len| {
@@ -1262,7 +1262,7 @@ pub fn u64_to_be_bytes<T>(n: u64, size: uint,
12621262
}
12631263
}
12641264

1265-
pub fn u64_from_be_bytes(data: &const [u8],
1265+
pub fn u64_from_be_bytes(data: &[u8],
12661266
start: uint,
12671267
size: uint)
12681268
-> u64 {
@@ -1497,7 +1497,7 @@ pub struct BytesWriter {
14971497
}
14981498
14991499
impl Writer for BytesWriter {
1500-
fn write(&self, v: &const [u8]) {
1500+
fn write(&self, v: &[u8]) {
15011501
let v_len = v.len();
15021502
let bytes_len = vec::uniq_len(&const self.bytes);
15031503

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ pub mod types {
268268
pub type ssize_t = i32;
269269
}
270270
pub mod posix01 {
271-
use libc::types::os::arch::c95::{c_int, c_short, c_long,
272-
time_t};
271+
use libc::types::os::arch::c95::{c_short, c_long, time_t};
273272
use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
274273
use libc::types::os::arch::posix88::{mode_t, off_t};
275274
use libc::types::os::arch::posix88::{uid_t};

0 commit comments

Comments
 (0)