Skip to content

Commit ec4b456

Browse files
committed
rustc: Remove the vstore handling of @str and @[].
1 parent e39cd20 commit ec4b456

20 files changed

+47
-129
lines changed

src/librustc/metadata/tydecode.rs

-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ fn parse_vstore(st: &mut PState, conv: conv_did) -> ty::vstore {
156156

157157
match next(st) {
158158
'~' => ty::vstore_uniq,
159-
'@' => ty::vstore_box,
160159
'&' => ty::vstore_slice(parse_region(st, conv)),
161160
c => st.tcx.sess.bug(format!("parse_vstore(): bad input '{}'", c))
162161
}

src/librustc/metadata/tyencode.rs

-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ pub fn enc_vstore(w: &mut MemWriter, cx: @ctxt, v: ty::vstore) {
219219
match v {
220220
ty::vstore_fixed(u) => mywrite!(w, "{}|", u),
221221
ty::vstore_uniq => mywrite!(w, "~"),
222-
ty::vstore_box => mywrite!(w, "@"),
223222
ty::vstore_slice(r) => {
224223
mywrite!(w, "&");
225224
enc_region(w, cx, r);

src/librustc/middle/lint.rs

-1
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,6 @@ fn check_heap_type(cx: &Context, span: Span, ty: ty::t) {
888888
ty::fold_ty(cx.tcx, ty, |t| {
889889
match ty::get(t).sty {
890890
ty::ty_box(_) |
891-
ty::ty_vec(_, ty::vstore_box) |
892891
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
893892
n_box += 1;
894893
}

src/librustc/middle/mem_categorization.rs

-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
178178
}
179179

180180
ty::ty_box(_) |
181-
ty::ty_vec(_, ty::vstore_box) |
182181
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
183182
Some(deref_ptr(gc_ptr))
184183
}

src/librustc/middle/trans/common.rs

-1
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ pub fn mono_data_classify(t: ty::t) -> MonoDataClass {
768768
ty::ty_float(_) => MonoFloat,
769769
ty::ty_rptr(..) | ty::ty_uniq(..) | ty::ty_box(..) |
770770
ty::ty_str(ty::vstore_uniq) | ty::ty_vec(_, ty::vstore_uniq) |
771-
ty::ty_str(ty::vstore_box) | ty::ty_vec(_, ty::vstore_box) |
772771
ty::ty_bare_fn(..) => MonoNonNull,
773772
// Is that everything? Would closures or slices qualify?
774773
_ => MonoBits

src/librustc/middle/trans/debuginfo.rs

-24
Original file line numberDiff line numberDiff line change
@@ -1896,23 +1896,6 @@ fn vec_metadata(cx: &CrateContext,
18961896
span);
18971897
}
18981898

1899-
fn boxed_vec_metadata(cx: &CrateContext,
1900-
element_type: ty::t,
1901-
span: Span)
1902-
-> DICompositeType {
1903-
let element_llvm_type = type_of::type_of(cx, element_type);
1904-
let vec_llvm_type = Type::vec(cx.sess.targ_cfg.arch, &element_llvm_type);
1905-
let vec_type_name: &str = format!("[{}]", ppaux::ty_to_str(cx.tcx, element_type));
1906-
let vec_metadata = vec_metadata(cx, element_type, span);
1907-
1908-
return boxed_type_metadata(
1909-
cx,
1910-
Some(vec_type_name),
1911-
vec_llvm_type,
1912-
vec_metadata,
1913-
span);
1914-
}
1915-
19161899
fn vec_slice_metadata(cx: &CrateContext,
19171900
vec_type: ty::t,
19181901
element_type: ty::t,
@@ -2093,9 +2076,6 @@ fn type_metadata(cx: &CrateContext,
20932076
let vec_metadata = vec_metadata(cx, i8_t, usage_site_span);
20942077
pointer_type_metadata(cx, t, vec_metadata)
20952078
}
2096-
ty::vstore_box => {
2097-
fail!("unexpected managed string")
2098-
}
20992079
ty::vstore_slice(_region) => {
21002080
vec_slice_metadata(cx, t, i8_t, usage_site_span)
21012081
}
@@ -2116,10 +2096,6 @@ fn type_metadata(cx: &CrateContext,
21162096
let vec_metadata = vec_metadata(cx, mt.ty, usage_site_span);
21172097
pointer_type_metadata(cx, t, vec_metadata)
21182098
}
2119-
ty::vstore_box => {
2120-
let boxed_vec_metadata = boxed_vec_metadata(cx, mt.ty, usage_site_span);
2121-
pointer_type_metadata(cx, t, boxed_vec_metadata)
2122-
}
21232099
ty::vstore_slice(_) => {
21242100
vec_slice_metadata(cx, t, mt.ty, usage_site_span)
21252101
}

src/librustc/middle/trans/glue.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ pub fn take_ty<'a>(bcx: &'a Block<'a>, v: ValueRef, t: ty::t)
6464
// NB: v is an *alias* of type t here, not a direct value.
6565
let _icx = push_ctxt("take_ty");
6666
match ty::get(t).sty {
67-
ty::ty_box(_) |
68-
ty::ty_vec(_, ty::vstore_box) | ty::ty_str(ty::vstore_box) => {
69-
incr_refcnt_of_boxed(bcx, v)
70-
}
67+
ty::ty_box(_) => incr_refcnt_of_boxed(bcx, v),
7168
ty::ty_trait(_, _, ty::BoxTraitStore, _, _) => {
7269
incr_refcnt_of_boxed(bcx, GEPi(bcx, v, [0u, abi::trt_field_box]))
7370
}
@@ -113,10 +110,6 @@ fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t {
113110
if !ty::type_needs_drop(tcx, typ) =>
114111
return ty::mk_box(tcx, ty::mk_nil()),
115112

116-
ty::ty_vec(mt, ty::vstore_box)
117-
if !ty::type_needs_drop(tcx, mt.ty) =>
118-
return ty::mk_box(tcx, ty::mk_nil()),
119-
120113
ty::ty_uniq(typ)
121114
if !ty::type_needs_drop(tcx, typ) =>
122115
return ty::mk_uniq(tcx, ty::mk_nil()),
@@ -326,11 +319,6 @@ fn make_drop_glue<'a>(bcx: &'a Block<'a>, v0: ValueRef, t: ty::t) -> &'a Block<'
326319
ty::ty_box(body_ty) => {
327320
decr_refcnt_maybe_free(bcx, v0, Some(body_ty))
328321
}
329-
ty::ty_str(ty::vstore_box) | ty::ty_vec(_, ty::vstore_box) => {
330-
let unit_ty = ty::sequence_element_type(ccx.tcx, t);
331-
let unboxed_vec_ty = ty::mk_mut_unboxed_vec(ccx.tcx, unit_ty);
332-
decr_refcnt_maybe_free(bcx, v0, Some(unboxed_vec_ty))
333-
}
334322
ty::ty_uniq(content_ty) => {
335323
let llbox = Load(bcx, v0);
336324
let not_null = IsNotNull(bcx, llbox);

src/librustc/middle/trans/reflect.rs

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ impl<'a> Reflector<'a> {
140140
}
141141
ty::vstore_slice(_) => (~"slice", ~[]),
142142
ty::vstore_uniq => (~"uniq", ~[]),
143-
ty::vstore_box => (~"box", ~[])
144143
}
145144
}
146145

src/librustc/middle/trans/tvec.rs

+6-26
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ pub fn expand_boxed_vec_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
4444
ty::ty_str(ty::vstore_uniq) | ty::ty_vec(_, ty::vstore_uniq) => {
4545
ty::mk_uniq(tcx, unboxed_vec_ty)
4646
}
47-
ty::ty_str(ty::vstore_box) | ty::ty_vec(_, ty::vstore_box) => {
48-
ty::mk_box(tcx, unboxed_vec_ty)
49-
}
5047
_ => tcx.sess.bug("non boxed-vec type \
5148
in tvec::expand_boxed_vec_ty")
5249
}
@@ -65,21 +62,6 @@ pub fn get_alloc(bcx: &Block, vptr: ValueRef) -> ValueRef {
6562
Load(bcx, GEPi(bcx, vptr, [0u, abi::vec_elt_alloc]))
6663
}
6764

68-
pub fn get_bodyptr(bcx: &Block, vptr: ValueRef, t: ty::t) -> ValueRef {
69-
let vt = vec_types(bcx, t);
70-
71-
let managed = match ty::get(vt.vec_ty).sty {
72-
ty::ty_str(ty::vstore_box) | ty::ty_vec(_, ty::vstore_box) => true,
73-
_ => false
74-
};
75-
76-
if managed {
77-
GEPi(bcx, vptr, [0u, abi::box_field_body])
78-
} else {
79-
vptr
80-
}
81-
}
82-
8365
pub fn get_dataptr(bcx: &Block, vptr: ValueRef) -> ValueRef {
8466
let _icx = push_ctxt("tvec::get_dataptr");
8567
GEPi(bcx, vptr, [0u, abi::vec_elt_elems, 0u])
@@ -381,7 +363,7 @@ pub fn trans_uniq_or_managed_vstore<'a>(bcx: &'a Block<'a>,
381363
let temp_scope = fcx.push_custom_cleanup_scope();
382364
fcx.schedule_free_value(cleanup::CustomScope(temp_scope), val, heap);
383365

384-
let dataptr = get_dataptr(bcx, get_bodyptr(bcx, val, vt.vec_ty));
366+
let dataptr = get_dataptr(bcx, val);
385367

386368
debug!("alloc_vec() returned val={}, dataptr={}",
387369
bcx.val_to_str(val), bcx.val_to_str(dataptr));
@@ -570,10 +552,9 @@ pub fn get_base_and_byte_len(bcx: &Block,
570552
let len = Mul(bcx, count, vt.llunit_size);
571553
(base, len)
572554
}
573-
ty::vstore_uniq | ty::vstore_box => {
555+
ty::vstore_uniq => {
574556
assert!(type_is_immediate(bcx.ccx(), vt.vec_ty));
575-
let llval = Load(bcx, llval);
576-
let body = get_bodyptr(bcx, llval, vec_ty);
557+
let body = Load(bcx, llval);
577558
(get_dataptr(bcx, body), get_fill(bcx, body))
578559
}
579560
}
@@ -610,10 +591,9 @@ pub fn get_base_and_len(bcx: &Block,
610591
let count = Load(bcx, GEPi(bcx, llval, [0u, abi::slice_elt_len]));
611592
(base, count)
612593
}
613-
ty::vstore_uniq | ty::vstore_box => {
594+
ty::vstore_uniq => {
614595
assert!(type_is_immediate(bcx.ccx(), vt.vec_ty));
615-
let llval = Load(bcx, llval);
616-
let body = get_bodyptr(bcx, llval, vec_ty);
596+
let body = Load(bcx, llval);
617597
(get_dataptr(bcx, body), UDiv(bcx, get_fill(bcx, body), vt.llunit_size))
618598
}
619599
}
@@ -730,7 +710,7 @@ pub fn iter_vec_uniq<'r,
730710
f: iter_vec_block<'r,'b>)
731711
-> &'b Block<'b> {
732712
let _icx = push_ctxt("tvec::iter_vec_uniq");
733-
let data_ptr = get_dataptr(bcx, get_bodyptr(bcx, vptr, vec_ty));
713+
let data_ptr = get_dataptr(bcx, vptr);
734714
iter_vec_raw(bcx, data_ptr, vec_ty, fill, f)
735715
}
736716

src/librustc/middle/trans/type_of.rs

-9
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ pub fn sizing_type_of(cx: &CrateContext, t: ty::t) -> Type {
115115
ty::ty_float(t) => Type::float_from_ty(t),
116116

117117
ty::ty_str(ty::vstore_uniq) |
118-
ty::ty_str(ty::vstore_box) |
119118
ty::ty_vec(_, ty::vstore_uniq) |
120-
ty::ty_vec(_, ty::vstore_box) |
121119
ty::ty_box(..) |
122120
ty::ty_uniq(..) |
123121
ty::ty_ptr(..) |
@@ -221,13 +219,6 @@ pub fn type_of(cx: &CrateContext, t: ty::t) -> Type {
221219
let name = llvm_type_name(cx, an_enum, did, substs.tps);
222220
adt::incomplete_type_of(cx, repr, name)
223221
}
224-
ty::ty_str(ty::vstore_box) => {
225-
fail!("unexpected managed string")
226-
}
227-
ty::ty_vec(ref mt, ty::vstore_box) => {
228-
let e_ty = type_of(cx, mt.ty);
229-
Type::at_box(cx, Type::vec(cx.sess.targ_cfg.arch, &e_ty)).ptr_to()
230-
}
231222
ty::ty_box(typ) => {
232223
Type::at_box(cx, type_of(cx, typ)).ptr_to()
233224
}

src/librustc/middle/ty.rs

+5-18
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ pub struct mt {
130130
pub enum vstore {
131131
vstore_fixed(uint),
132132
vstore_uniq,
133-
vstore_box,
134133
vstore_slice(Region)
135134
}
136135

@@ -1558,7 +1557,7 @@ pub fn type_is_box(ty: t) -> bool {
15581557

15591558
pub fn type_is_boxed(ty: t) -> bool {
15601559
match get(ty).sty {
1561-
ty_box(_) | ty_vec(_, vstore_box) | ty_str(vstore_box) => true,
1560+
ty_box(_) => true,
15621561
_ => false
15631562
}
15641563
}
@@ -1682,10 +1681,7 @@ fn type_needs_unwind_cleanup_(cx: ctxt, ty: t,
16821681
}
16831682
ty_uniq(_) |
16841683
ty_str(vstore_uniq) |
1685-
ty_str(vstore_box) |
1686-
ty_vec(_, vstore_uniq) |
1687-
ty_vec(_, vstore_box)
1688-
=> {
1684+
ty_vec(_, vstore_uniq) => {
16891685
// Once we're inside a box, the annihilator will find
16901686
// it and destroy it.
16911687
if !encountered_box {
@@ -2028,10 +2024,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20282024
tc_mt(cx, mt, cache).owned_pointer()
20292025
}
20302026

2031-
ty_vec(mt, vstore_box) => {
2032-
tc_mt(cx, mt, cache).managed_pointer()
2033-
}
2034-
20352027
ty_vec(ref mt, vstore_slice(r)) => {
20362028
tc_ty(cx, mt.ty, cache).reference(
20372029
borrowed_contents(r, mt.mutbl))
@@ -2041,10 +2033,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
20412033
tc_mt(cx, mt, cache)
20422034
}
20432035

2044-
ty_str(vstore_box) => {
2045-
TC::Managed
2046-
}
2047-
20482036
ty_str(vstore_slice(r)) => {
20492037
borrowed_contents(r, ast::MutImmutable)
20502038
}
@@ -2530,8 +2518,8 @@ pub fn type_is_pod(cx: ctxt, ty: t) -> bool {
25302518
ty_type | ty_ptr(_) | ty_bare_fn(_) => result = true,
25312519
// Boxed types
25322520
ty_box(_) | ty_uniq(_) | ty_closure(_) |
2533-
ty_str(vstore_uniq) | ty_str(vstore_box) |
2534-
ty_vec(_, vstore_uniq) | ty_vec(_, vstore_box) |
2521+
ty_str(vstore_uniq) |
2522+
ty_vec(_, vstore_uniq) |
25352523
ty_trait(_, _, _, _, _) | ty_rptr(_,_) => result = false,
25362524
// Structural types
25372525
ty_enum(did, ref substs) => {
@@ -4426,7 +4414,7 @@ pub fn normalize_ty(cx: ctxt, t: t) -> t {
44264414

44274415
fn fold_vstore(&mut self, vstore: vstore) -> vstore {
44284416
match vstore {
4429-
vstore_fixed(..) | vstore_uniq | vstore_box => vstore,
4417+
vstore_fixed(..) | vstore_uniq => vstore,
44304418
vstore_slice(_) => vstore_slice(ReStatic)
44314419
}
44324420
}
@@ -4863,7 +4851,6 @@ pub fn hash_crate_independent(tcx: ctxt, t: t, local_hash: ~str) -> u64 {
48634851
match v {
48644852
vstore_fixed(_) => hash.input([0]),
48654853
vstore_uniq => hash.input([1]),
4866-
vstore_box => hash.input([2]),
48674854
vstore_slice(r) => {
48684855
hash.input([3]);
48694856
region(hash, r);

src/librustc/middle/ty_fold.rs

-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ pub fn super_fold_vstore<T:TypeFolder>(this: &mut T,
202202
match vstore {
203203
ty::vstore_fixed(i) => ty::vstore_fixed(i),
204204
ty::vstore_uniq => ty::vstore_uniq,
205-
ty::vstore_box => ty::vstore_box,
206205
ty::vstore_slice(r) => ty::vstore_slice(this.fold_region(r)),
207206
}
208207
}

0 commit comments

Comments
 (0)