Skip to content

Commit c6bf9a6

Browse files
committed
---
yaml --- r: 32609 b: refs/heads/dist-snap c: aa2ab26 h: refs/heads/master i: 32607: 8baf1a1 v: v3
1 parent a1a05c4 commit c6bf9a6

File tree

10 files changed

+926
-49
lines changed

10 files changed

+926
-49
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 1c5db46f8e44441ba1aa11f0f607b7c015fd1fa5
10+
refs/heads/dist-snap: aa2ab2659f6c7aca79ddaaac5370da8aea6a18d6
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pure fn capacity<T>(&&v: @[const T]) -> uint {
3030
unsafe {
3131
let repr: **unsafe::VecRepr =
3232
::unsafe::reinterpret_cast(&addr_of(v));
33-
(**repr).alloc / sys::size_of::<T>()
33+
(**repr).unboxed.alloc / sys::size_of::<T>()
3434
}
3535
}
3636

@@ -155,14 +155,14 @@ mod unsafe {
155155
#[inline(always)]
156156
unsafe fn set_len<T>(&&v: @[const T], new_len: uint) {
157157
let repr: **VecRepr = ::unsafe::reinterpret_cast(&addr_of(v));
158-
(**repr).fill = new_len * sys::size_of::<T>();
158+
(**repr).unboxed.fill = new_len * sys::size_of::<T>();
159159
}
160160

161161
#[inline(always)]
162162
unsafe fn push<T>(&v: @[const T], +initval: T) {
163163
let repr: **VecRepr = ::unsafe::reinterpret_cast(&addr_of(v));
164-
let fill = (**repr).fill;
165-
if (**repr).alloc > fill {
164+
let fill = (**repr).unboxed.fill;
165+
if (**repr).unboxed.alloc > fill {
166166
push_fast(v, move initval);
167167
}
168168
else {
@@ -173,9 +173,9 @@ mod unsafe {
173173
#[inline(always)] // really pretty please
174174
unsafe fn push_fast<T>(&v: @[const T], +initval: T) {
175175
let repr: **VecRepr = ::unsafe::reinterpret_cast(&addr_of(v));
176-
let fill = (**repr).fill;
177-
(**repr).fill += sys::size_of::<T>();
178-
let p = ptr::addr_of((**repr).data);
176+
let fill = (**repr).unboxed.fill;
177+
(**repr).unboxed.fill += sys::size_of::<T>();
178+
let p = ptr::addr_of((**repr).unboxed.data);
179179
let p = ptr::offset(p, fill) as *mut T;
180180
rusti::move_val_init(*p, move initval);
181181
}

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,25 @@
55
#[forbid(deprecated_pattern)];
66

77
use cmp::{Eq, Ord};
8+
use intrinsic::TyDesc;
89

9-
export ptr_eq;
10+
export ptr_eq, raw;
11+
12+
mod raw {
13+
14+
struct BoxHeaderRepr {
15+
ref_count: uint,
16+
type_desc: *TyDesc,
17+
prev: *BoxRepr,
18+
next: *BoxRepr,
19+
}
20+
21+
struct BoxRepr {
22+
header: BoxHeaderRepr,
23+
data: u8
24+
}
25+
26+
}
1027

1128
pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
1229
//! Determine if two shared boxes point to the same object

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,28 +80,28 @@ pub unsafe fn annihilate() {
8080
let mut box: *mut BoxRepr = transmute(copy box);
8181
while box != mut_null() {
8282
debug!("making box immortal: %x", box as uint);
83-
(*box).ref_count = 0x77777777;
84-
box = transmute(copy (*box).next);
83+
(*box).header.ref_count = 0x77777777;
84+
box = transmute(copy (*box).header.next);
8585
}
8686

8787
// Pass 2: Drop all boxes.
8888
let box = (*task).boxed_region.live_allocs;
8989
let mut box: *mut BoxRepr = transmute(copy box);
9090
while box != mut_null() {
9191
debug!("calling drop glue for box: %x", box as uint);
92-
let tydesc: *TypeDesc = transmute(copy (*box).type_desc);
92+
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
9393
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
9494
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
9595

96-
box = transmute(copy (*box).next);
96+
box = transmute(copy (*box).header.next);
9797
}
9898

9999
// Pass 3: Free all boxes.
100100
loop {
101101
let box = (*task).boxed_region.live_allocs;
102102
if box == null() { break; }
103103
let mut box: *mut BoxRepr = transmute(copy box);
104-
assert (*box).prev == null();
104+
assert (*box).header.prev == null();
105105

106106
debug!("freeing box: %x", box as uint);
107107
rt_free(transmute(box));

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export unit;
6363
export uniq;
6464
export repr;
6565
export cleanup;
66+
export reflect;
6667

6768
// NDM seems to be necessary for resolve to work
6869
export option_iter;
@@ -230,6 +231,7 @@ mod mutable;
230231
mod flate;
231232
mod repr;
232233
mod cleanup;
234+
mod reflect;
233235

234236
// Modules supporting compiler-generated code
235237
// Exported but not part of the public interface

0 commit comments

Comments
 (0)