Skip to content

Commit c9c5ee2

Browse files
committed
Implement non-internal ivecs
Vectors are now similar to our old, pre-internal vectors, except that they are uniquely owned, not refcounted. Their name should probably change too, then. I've renamed them to vec in the runtime, will do so throughout the compiler later.
1 parent 855e0a4 commit c9c5ee2

27 files changed

+487
-1548
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ endif
6262
# runtime used directly by the compiler -- the binaries built by the
6363
# snapshot won't know about the changes yet. Don't leave this on. Turn
6464
# it on, shapshot, and turn it off again.
65-
# CFG_USE_SNAP_LIBS_FOR_STAGE1 = 1
65+
CFG_USE_SNAP_LIBS_FOR_STAGE1 = 1
6666

6767
# version-string calculation
6868
CFG_GIT_DIR := $(CFG_SRC_DIR).git

src/comp/back/abi.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,12 @@ const closure_elt_bindings: int = 1;
9292

9393
const closure_elt_ty_params: int = 2;
9494

95-
const ivec_default_length: uint = 4u;
95+
const ivec_elt_fill: uint = 0u;
9696

97-
const ivec_elt_len: uint = 0u;
98-
99-
const ivec_elt_alen: uint = 1u;
97+
const ivec_elt_alloc: uint = 1u;
10098

10199
const ivec_elt_elems: uint = 2u;
102100

103-
const ivec_heap_stub_elt_zero: uint = 0u;
104-
105-
const ivec_heap_stub_elt_alen: uint = 1u;
106-
107-
const ivec_heap_stub_elt_ptr: uint = 2u;
108-
109-
const ivec_heap_elt_len: uint = 0u;
110-
111-
const ivec_heap_elt_elems: uint = 1u;
112-
113101
const worst_case_glue_call_args: int = 7;
114102

115103
const abi_version: uint = 1u;

src/comp/back/upcall.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ type upcalls =
4040
new_str: ValueRef,
4141
evec_append: ValueRef,
4242
get_type_desc: ValueRef,
43-
ivec_resize: ValueRef,
44-
ivec_spill: ValueRef,
45-
ivec_resize_shared: ValueRef,
46-
ivec_spill_shared: ValueRef,
43+
ivec_grow: ValueRef,
4744
ivec_push: ValueRef,
4845
cmp_type: ValueRef,
4946
log_type: ValueRef,
@@ -95,19 +92,13 @@ fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef,
9592
d(~"get_type_desc",
9693
[T_ptr(T_nil()), T_size_t(), T_size_t(), T_size_t(),
9794
T_ptr(T_ptr(tydesc_type)), T_int()], T_ptr(tydesc_type)),
98-
ivec_resize:
99-
d(~"ivec_resize", [T_ptr(T_opaque_ivec()), T_int()], T_void()),
100-
ivec_spill:
101-
d(~"ivec_spill", [T_ptr(T_opaque_ivec()), T_int()], T_void()),
102-
ivec_resize_shared:
103-
d(~"ivec_resize_shared", [T_ptr(T_opaque_ivec()), T_int()],
104-
T_void()),
105-
ivec_spill_shared:
106-
d(~"ivec_spill_shared", [T_ptr(T_opaque_ivec()), T_int()],
95+
ivec_grow:
96+
d(~"vec_grow", [T_ptr(T_ptr(T_opaque_ivec())), T_int()],
10797
T_void()),
10898
ivec_push:
109-
d(~"ivec_push", [T_ptr(T_opaque_ivec()), T_ptr(tydesc_type),
110-
T_ptr(T_i8())], T_void()),
99+
d(~"vec_push",
100+
[T_ptr(T_ptr(T_opaque_ivec())), T_ptr(tydesc_type),
101+
T_ptr(T_i8())], T_void()),
111102
cmp_type:
112103
dr(~"cmp_type",
113104
[T_ptr(T_i1()), taskptr_type, T_ptr(tydesc_type),

src/comp/middle/shape.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ fn shape_of(ccx: &@crate_ctxt, t: ty::t) -> [u8] {
313313
s += [shape_ivec];
314314
add_bool(s, true); // type is POD
315315
let unit_ty = ty::mk_mach(ccx.tcx, ast::ty_u8);
316-
add_size_hint(ccx, s, unit_ty);
317316
add_substr(s, shape_of(ccx, unit_ty));
318317
}
319318

@@ -365,7 +364,6 @@ fn shape_of(ccx: &@crate_ctxt, t: ty::t) -> [u8] {
365364
ty::ty_vec(mt) {
366365
s += [shape_ivec];
367366
add_bool(s, ty::type_is_pod(ccx.tcx, mt.ty));
368-
add_size_hint(ccx, s, mt.ty);
369367
add_substr(s, shape_of(ccx, mt.ty));
370368
}
371369
ty::ty_rec(fields) {
@@ -416,14 +414,6 @@ fn shape_of(ccx: &@crate_ctxt, t: ty::t) -> [u8] {
416414
ret s;
417415
}
418416

419-
fn add_size_hint(ccx: &@crate_ctxt, s: &mutable [u8], typ: ty::t) {
420-
if ty::type_has_dynamic_size(ccx.tcx, typ) { s += [0u8, 0u8, 0u8]; ret; }
421-
422-
let llty = trans::type_of(ccx, dummy_sp(), typ);
423-
add_u16(s, trans::llsize_of_real(ccx, llty) as u16);
424-
s += [trans::llalign_of_real(ccx, llty) as u8];
425-
}
426-
427417
// FIXME: We might discover other variants as we traverse these. Handle this.
428418
fn shape_of_variant(ccx: &@crate_ctxt, v: &ty::variant_info) -> [u8] {
429419
let s = [];

0 commit comments

Comments
 (0)