Skip to content

Commit a06a05b

Browse files
committed
---
yaml --- r: 4875 b: refs/heads/master c: 7588a89 h: refs/heads/master i: 4873: 9f14915 4871: d51cf58 v: v3
1 parent 2acde8d commit a06a05b

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: b24f97801138cb675fbb9e9151d189b6527c4ef5
2+
refs/heads/master: 7588a895538800ffe88e2a4273a47020fec42e7d

trunk/src/comp/back/abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const vec_elt_data: int = 4;
4949
const tydesc_field_first_param: int = 0;
5050
const tydesc_field_size: int = 1;
5151
const tydesc_field_align: int = 2;
52-
const tydesc_field_copy_glue: int = 3;
52+
const tydesc_field_take_glue: int = 3;
5353
const tydesc_field_drop_glue: int = 4;
5454
const tydesc_field_free_glue: int = 5;
5555
const tydesc_field_sever_glue: int = 6;

trunk/src/comp/middle/trans.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ fn declare_tydesc(cx: &@local_ctxt, sp: &span, t: &ty::t, ty_params: &[uint])
11161116
tydesc: gvar,
11171117
size: llsize,
11181118
align: llalign,
1119-
mutable copy_glue: none::<ValueRef>,
1119+
mutable take_glue: none::<ValueRef>,
11201120
mutable drop_glue: none::<ValueRef>,
11211121
mutable free_glue: none::<ValueRef>,
11221122
mutable cmp_glue: none::<ValueRef>,
@@ -1202,8 +1202,8 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
12021202
let glue_fn_ty = T_ptr(T_glue_fn(*ccx));
12031203
let cmp_fn_ty = T_ptr(T_cmp_glue_fn(*ccx));
12041204
let ti = pair.val;
1205-
let copy_glue =
1206-
alt { ti.copy_glue } {
1205+
let take_glue =
1206+
alt { ti.take_glue } {
12071207
none. { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
12081208
some(v) { ccx.stats.n_real_glues += 1u; v }
12091209
};
@@ -1233,7 +1233,7 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
12331233
[C_null(T_ptr(T_ptr(ccx.tydesc_type))),
12341234
ti.size, // size
12351235
ti.align, // align
1236-
copy_glue, // copy_glue
1236+
take_glue, // take_glue
12371237
drop_glue, // drop_glue
12381238
free_glue, // free_glue
12391239
C_null(glue_fn_ty), // sever_glue
@@ -1253,7 +1253,7 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
12531253
}
12541254
}
12551255

1256-
fn make_copy_glue(cx: &@block_ctxt, v: ValueRef, t: &ty::t) {
1256+
fn make_take_glue(cx: &@block_ctxt, v: ValueRef, t: &ty::t) {
12571257
// NB: v is an *alias* of type t here, not a direct value.
12581258

12591259
let bcx;
@@ -1262,7 +1262,7 @@ fn make_copy_glue(cx: &@block_ctxt, v: ValueRef, t: &ty::t) {
12621262
bcx = incr_refcnt_of_boxed(cx, cx.build.Load(v)).bcx;
12631263
} else if ty::type_is_structural(bcx_tcx(cx), t) {
12641264
bcx = duplicate_heap_parts_if_necessary(cx, v, t).bcx;
1265-
bcx = iter_structural_ty(bcx, v, t, bind copy_ty(_, _, _)).bcx;
1265+
bcx = iter_structural_ty(bcx, v, t, bind take_ty(_, _, _)).bcx;
12661266
} else { bcx = cx; }
12671267

12681268
build_return(bcx);
@@ -1966,7 +1966,7 @@ fn iter_sequence(cx: @block_ctxt, v: ValueRef, t: &ty::t, f: &val_and_ty_fn)
19661966

19671967
fn lazily_emit_all_tydesc_glue(cx: &@block_ctxt,
19681968
static_ti: &option::t<@tydesc_info>) {
1969-
lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, static_ti);
1969+
lazily_emit_tydesc_glue(cx, abi::tydesc_field_take_glue, static_ti);
19701970
lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_glue, static_ti);
19711971
lazily_emit_tydesc_glue(cx, abi::tydesc_field_free_glue, static_ti);
19721972
lazily_emit_tydesc_glue(cx, abi::tydesc_field_cmp_glue, static_ti);
@@ -1984,18 +1984,18 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int,
19841984
alt static_ti {
19851985
none. { }
19861986
some(ti) {
1987-
if field == abi::tydesc_field_copy_glue {
1988-
alt { ti.copy_glue } {
1987+
if field == abi::tydesc_field_take_glue {
1988+
alt { ti.take_glue } {
19891989
some(_) { }
19901990
none. {
19911991
log #fmt["+++ lazily_emit_tydesc_glue TAKE %s",
19921992
ty_to_str(bcx_tcx(cx), ti.ty)];
19931993
let lcx = cx.fcx.lcx;
19941994
let glue_fn =
19951995
declare_generic_glue(lcx, ti.ty, T_glue_fn(*lcx.ccx),
1996-
"copy");
1997-
ti.copy_glue = some::<ValueRef>(glue_fn);
1998-
make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, make_copy_glue,
1996+
"take");
1997+
ti.take_glue = some::<ValueRef>(glue_fn);
1998+
make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, make_take_glue,
19991999
ti.ty_params, "take");
20002000
log #fmt["--- lazily_emit_tydesc_glue TAKE %s",
20012001
ty_to_str(bcx_tcx(cx), ti.ty)];
@@ -2059,8 +2059,8 @@ fn call_tydesc_glue_full(cx: &@block_ctxt, v: ValueRef, tydesc: ValueRef,
20592059
alt static_ti {
20602060
none. {/* no-op */ }
20612061
some(sti) {
2062-
if field == abi::tydesc_field_copy_glue {
2063-
static_glue_fn = sti.copy_glue;
2062+
if field == abi::tydesc_field_take_glue {
2063+
static_glue_fn = sti.take_glue;
20642064
} else if field == abi::tydesc_field_drop_glue {
20652065
static_glue_fn = sti.drop_glue;
20662066
} else if field == abi::tydesc_field_free_glue {
@@ -2147,10 +2147,10 @@ fn compare(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: &ty::t,
21472147
ret call_cmp_glue(cx, lhs, rhs, t, llop);
21482148
}
21492149

2150-
fn copy_ty(cx: &@block_ctxt, v: ValueRef, t: ty::t) -> result {
2150+
fn take_ty(cx: &@block_ctxt, v: ValueRef, t: ty::t) -> result {
21512151
if ty::type_has_pointers(bcx_tcx(cx), t) ||
21522152
ty::type_owns_heap_mem(bcx_tcx(cx), t) {
2153-
ret call_tydesc_glue(cx, v, t, abi::tydesc_field_copy_glue);
2153+
ret call_tydesc_glue(cx, v, t, abi::tydesc_field_take_glue);
21542154
}
21552155
ret rslt(cx, C_nil());
21562156
}
@@ -2257,7 +2257,7 @@ fn copy_val(cx: &@block_ctxt, action: copy_action, dst: ValueRef,
22572257
if action == DROP_EXISTING {
22582258
bcx = drop_ty(cx, cx.build.Load(dst), t).bcx;
22592259
} else { bcx = cx; }
2260-
bcx = copy_ty(bcx, src, t).bcx;
2260+
bcx = take_ty(bcx, src, t).bcx;
22612261
ret rslt(bcx, bcx.build.Store(src, dst));
22622262
} else if ty::type_is_structural(ccx.tcx, t) ||
22632263
ty::type_has_dynamic_size(ccx.tcx, t) {
@@ -2273,7 +2273,7 @@ fn copy_val(cx: &@block_ctxt, action: copy_action, dst: ValueRef,
22732273
do_copy_cx = drop_ty(do_copy_cx, dst, t).bcx;
22742274
}
22752275
do_copy_cx = memmove_ty(do_copy_cx, dst, src, t).bcx;
2276-
do_copy_cx = copy_ty(do_copy_cx, dst, t).bcx;
2276+
do_copy_cx = take_ty(do_copy_cx, dst, t).bcx;
22772277
do_copy_cx.build.Br(next_cx.llbb);
22782278

22792279
ret rslt(next_cx, C_nil());
@@ -2526,7 +2526,7 @@ fn trans_evec_append(cx: &@block_ctxt, t: &ty::t, lhs: ValueRef,
25262526
bcx = llvec_tydesc.bcx;
25272527
ti = none::<@tydesc_info>;
25282528
let llelt_tydesc = get_tydesc(bcx, elt_ty, false, ti).result;
2529-
lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, ti);
2529+
lazily_emit_tydesc_glue(cx, abi::tydesc_field_take_glue, ti);
25302530
lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_glue, ti);
25312531
lazily_emit_tydesc_glue(cx, abi::tydesc_field_free_glue, ti);
25322532
bcx = llelt_tydesc.bcx;
@@ -2784,7 +2784,7 @@ mod ivec {
27842784
bcx = rs.bcx;
27852785
rs = get_tydesc(bcx, unit_ty, false, no_tydesc_info).result;
27862786
bcx = rs.bcx;
2787-
lazily_emit_tydesc_glue(bcx, abi::tydesc_field_copy_glue, none);
2787+
lazily_emit_tydesc_glue(bcx, abi::tydesc_field_take_glue, none);
27882788
lazily_emit_tydesc_glue(bcx, abi::tydesc_field_drop_glue, none);
27892789
lazily_emit_tydesc_glue(bcx, abi::tydesc_field_free_glue, none);
27902790
let rhs_len_and_data = get_len_and_data(bcx, rhs, unit_ty);
@@ -3076,7 +3076,7 @@ mod ivec {
30763076
}
30773077

30783078
// NB: This does *not* adjust reference counts. The caller must have done
3079-
// this via copy_ty() beforehand.
3079+
// this via take_ty() beforehand.
30803080
fn duplicate_heap_part(cx: &@block_ctxt, orig_vptr: ValueRef,
30813081
unit_ty: ty::t) -> result {
30823082
// Cast to an opaque interior vector if we can't trust the pointer
@@ -4474,7 +4474,7 @@ fn trans_arg_expr(cx: &@block_ctxt, arg: &ty::arg, lldestty0: TypeRef,
44744474
if lv.is_mem {
44754475
val = load_if_immediate(bcx, val, e_ty);
44764476
}
4477-
bcx = copy_ty(bcx, val, e_ty).bcx;
4477+
bcx = take_ty(bcx, val, e_ty).bcx;
44784478
add_clean_temp(bcx, val, e_ty);
44794479
}
44804480
} else if type_is_immediate(ccx, e_ty) && !lv.is_mem {
@@ -5833,7 +5833,7 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, scope: @block_ctxt,
58335833
// Args that are locally assigned to need to do a local
58345834
// take/drop
58355835
if fcx.lcx.ccx.mut_map.contains_key(aarg.id) {
5836-
bcx = copy_ty(bcx, aval, arg_ty).bcx;
5836+
bcx = take_ty(bcx, aval, arg_ty).bcx;
58375837
add_clean(scope, addr, arg_ty);
58385838
}
58395839
}

trunk/src/comp/middle/trans_alt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ fn bind_irrefutable_pat(bcx: @block_ctxt, pat: &@ast::pat, val: ValueRef,
528528
let alloc = trans::alloca(bcx, llty);
529529
bcx = trans::memmove_ty(bcx, alloc, val, ty).bcx;
530530
let loaded = trans::load_if_immediate(bcx, alloc, ty);
531-
bcx = trans::copy_ty(bcx, loaded, ty).bcx;
531+
bcx = trans::take_ty(bcx, loaded, ty).bcx;
532532
table.insert(pat.id, alloc);
533533
trans_common::add_clean(bcx, alloc, ty);
534534
} else { table.insert(pat.id, val); }

trunk/src/comp/middle/trans_common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type tydesc_info =
8181
tydesc: ValueRef,
8282
size: ValueRef,
8383
align: ValueRef,
84-
mutable copy_glue: option::t<ValueRef>,
84+
mutable take_glue: option::t<ValueRef>,
8585
mutable drop_glue: option::t<ValueRef>,
8686
mutable free_glue: option::t<ValueRef>,
8787
mutable cmp_glue: option::t<ValueRef>,

trunk/src/rt/rust_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ struct type_desc {
272272
const type_desc **first_param;
273273
size_t size;
274274
size_t align;
275-
glue_fn *copy_glue;
275+
glue_fn *take_glue;
276276
glue_fn *drop_glue;
277277
glue_fn *free_glue;
278278
glue_fn *sever_glue; // For GC.

trunk/src/rt/rust_upcall.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ copy_elements(rust_task *task, type_desc *elem_t,
285285
memmove(dst, src, n);
286286

287287
// increment the refcount of each element of the vector
288-
if (elem_t->copy_glue) {
289-
glue_fn *copy_glue = elem_t->copy_glue;
288+
if (elem_t->take_glue) {
289+
glue_fn *take_glue = elem_t->take_glue;
290290
size_t elem_size = elem_t->size;
291291
const type_desc **tydescs = elem_t->first_param;
292292
for (char *p = dst; p < dst+n; p += elem_size) {
293-
copy_glue(NULL, task, NULL, tydescs, p);
293+
take_glue(NULL, task, NULL, tydescs, p);
294294
}
295295
}
296296
}

0 commit comments

Comments
 (0)