diff --git a/src/comp/back/abi.rs b/src/comp/back/abi.rs index 22e49436440f..df72ba5b1c27 100644 --- a/src/comp/back/abi.rs +++ b/src/comp/back/abi.rs @@ -52,7 +52,7 @@ const tydesc_field_align: int = 2; const tydesc_field_take_glue: int = 3; const tydesc_field_drop_glue: int = 4; const tydesc_field_free_glue: int = 5; -const tydesc_field_copy_glue: int = 6; +const tydesc_field_unused: int = 6; const tydesc_field_sever_glue: int = 7; const tydesc_field_mark_glue: int = 8; const tydesc_field_is_stateful: int = 9; diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 699c23d4fa27..c7078b849041 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1149,7 +1149,6 @@ fn declare_tydesc(cx: &@local_ctxt, sp: &span, t: ty::t, ty_params: &[uint]) mutable drop_glue: none::, mutable free_glue: none::, mutable cmp_glue: none::, - mutable copy_glue: none::, ty_params: ty_params}; log ~"--- declare_tydesc " + ty_to_str(cx.ccx.tcx, t); ret info; @@ -1245,7 +1244,6 @@ fn emit_tydescs(ccx: &@crate_ctxt) { for each pair: @{key: ty::t, val: @tydesc_info} in ccx.tydescs.items() { let glue_fn_ty = T_ptr(T_glue_fn(*ccx)); let cmp_fn_ty = T_ptr(T_cmp_glue_fn(*ccx)); - let copy_fn_ty = T_ptr(T_copy_glue_fn(*ccx)); let ti = pair.val; let take_glue = alt { ti.take_glue } { @@ -1267,11 +1265,6 @@ fn emit_tydescs(ccx: &@crate_ctxt) { none. { ccx.stats.n_null_glues += 1u; C_null(cmp_fn_ty) } some(v) { ccx.stats.n_real_glues += 1u; v } }; - let copy_glue = - alt { ti.copy_glue } { - none. { ccx.stats.n_null_glues += 1u; C_null(copy_fn_ty) } - some(v) { ccx.stats.n_real_glues += 1u; v } - }; let shape = shape::shape_of(ccx, pair.key); let shape_tables = @@ -1286,7 +1279,7 @@ fn emit_tydescs(ccx: &@crate_ctxt) { take_glue, // take_glue drop_glue, // drop_glue free_glue, // free_glue - copy_glue, // copy_glue + C_null(T_ptr(T_i8())), // unused C_null(glue_fn_ty), // sever_glue C_null(glue_fn_ty), // mark_glue C_null(glue_fn_ty), // is_stateful @@ -1304,14 +1297,6 @@ fn emit_tydescs(ccx: &@crate_ctxt) { } } -// NOTE this is currently just a complicated way to do memmove. I'm working on -// a representation of ivecs that will need pointers into itself, which must -// be adjusted when copying. Will flesh this out when the time comes. -fn make_copy_glue(cx: &@block_ctxt, src: ValueRef, dst: ValueRef, t: ty::t) { - let bcx = memmove_ty(cx, dst, src, t).bcx; - build_return(bcx); -} - fn make_take_glue(cx: &@block_ctxt, v: ValueRef, t: ty::t) { let bcx = cx; // NB: v is an *alias* of type t here, not a direct value. @@ -1878,7 +1863,6 @@ fn lazily_emit_all_tydesc_glue(cx: &@block_ctxt, lazily_emit_tydesc_glue(cx, abi::tydesc_field_drop_glue, static_ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_free_glue, static_ti); lazily_emit_tydesc_glue(cx, abi::tydesc_field_cmp_glue, static_ti); - lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, static_ti); } fn lazily_emit_all_generic_info_tydesc_glues(cx: &@block_ctxt, @@ -1958,20 +1942,6 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int, ty_to_str(bcx_tcx(cx), ti.ty)]; } } - } else if field == abi::tydesc_field_copy_glue { - alt { ti.copy_glue } { - some(_) {} - none. { - let lcx = cx.fcx.lcx; - let glue_fn = - declare_generic_glue(lcx, ti.ty, T_copy_glue_fn(*lcx.ccx), - ~"copy"); - ti.copy_glue = some(glue_fn); - make_generic_glue(lcx, cx.sp, ti.ty, glue_fn, - copy_helper(make_copy_glue), - ti.ty_params, ~"copy"); - } - } } } } @@ -2060,47 +2030,6 @@ fn call_cmp_glue(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t, ret rslt(r.bcx, Load(r.bcx, llcmpresultptr)); } -fn call_copy_glue(cx: &@block_ctxt, dst: ValueRef, src: ValueRef, t: ty::t, - take: bool) -> @block_ctxt { - // You can't call this on immediate types. Those are simply copied with - // Load/Store. - assert !type_is_immediate(bcx_ccx(cx), t); - let srcptr = BitCast(cx, src, T_ptr(T_i8())); - let dstptr = BitCast(cx, dst, T_ptr(T_i8())); - let ti = none; - let {bcx, val: lltydesc} = - get_tydesc(cx, t, false, tps_normal, ti).result; - lazily_emit_tydesc_glue(cx, abi::tydesc_field_copy_glue, ti); - let lltydescs = GEP - (bcx, lltydesc, [C_int(0), C_int(abi::tydesc_field_first_param)]); - lltydescs = Load(bcx, lltydescs); - - let llfn = alt ti { - none. { - Load(bcx, GEP - (bcx, lltydesc, [C_int(0), C_int(abi::tydesc_field_copy_glue)])) - } - some(sti) { option::get(sti.copy_glue) } - }; - Call(bcx, llfn, [C_null(T_ptr(T_nil())), bcx.fcx.lltaskptr, - C_null(T_ptr(T_nil())), lltydescs, srcptr, dstptr]); - if take { - lazily_emit_tydesc_glue(cx, abi::tydesc_field_take_glue, ti); - llfn = alt ti { - none. { - Load(bcx, GEP(bcx, lltydesc, - [C_int(0), - C_int(abi::tydesc_field_take_glue)])) - } - some(sti) { option::get(sti.take_glue) } - }; - Call(bcx, llfn, [C_null(T_ptr(T_nil())), bcx.fcx.lltaskptr, - C_null(T_ptr(T_nil())), lltydescs, dstptr]); - } - ret bcx; -} - - // Compares two values. Performs the simple scalar comparison if the types are // scalar and calls to comparison glue otherwise. fn compare(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t, diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 39a6b25f6ccc..1e60daec4702 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -87,7 +87,6 @@ type tydesc_info = mutable drop_glue: option::t, mutable free_glue: option::t, mutable cmp_glue: option::t, - mutable copy_glue: option::t, ty_params: [uint]}; /* @@ -620,14 +619,6 @@ fn T_cmp_glue_fn(cx: &crate_ctxt) -> TypeRef { ret t; } -fn T_copy_glue_fn(cx: &crate_ctxt) -> TypeRef { - let s = ~"copy_glue_fn"; - if cx.tn.name_has_type(s) { ret cx.tn.get_type(s); } - let t = T_tydesc_field(cx, abi::tydesc_field_copy_glue); - cx.tn.associate(s, t); - ret t; -} - fn T_tydesc(taskptr_type: TypeRef) -> TypeRef { let tydesc = T_named_struct(~"tydesc"); let tydescpp = T_ptr(T_ptr(tydesc)); @@ -638,13 +629,10 @@ fn T_tydesc(taskptr_type: TypeRef) -> TypeRef { let cmp_glue_fn_ty = T_ptr(T_fn([T_ptr(T_i1()), taskptr_type, T_ptr(tydesc), tydescpp, pvoid, pvoid, T_i8()], T_void())); - let copy_glue_fn_ty = - T_ptr(T_fn([T_ptr(T_nil()), taskptr_type, T_ptr(T_nil()), tydescpp, - pvoid, pvoid], T_void())); let elems = [tydescpp, T_int(), T_int(), glue_fn_ty, glue_fn_ty, glue_fn_ty, - copy_glue_fn_ty, glue_fn_ty, glue_fn_ty, glue_fn_ty, cmp_glue_fn_ty, + T_ptr(T_i8()), glue_fn_ty, glue_fn_ty, glue_fn_ty, cmp_glue_fn_ty, T_ptr(T_i8()), T_ptr(T_i8()), T_int(), T_int()]; set_struct_body(tydesc, elems); ret tydesc; diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h index 71e1377e396e..4a5d208915df 100644 --- a/src/rt/rust_internal.h +++ b/src/rt/rust_internal.h @@ -257,8 +257,6 @@ struct rust_timer { typedef void CDECL (glue_fn)(void *, rust_task *, void *, const type_desc **, void *); -typedef void CDECL (copy_glue_fn)(void *, rust_task *, void *, - const type_desc **, void *, void *); typedef void CDECL (cmp_glue_fn)(void *, rust_task *, void *, const type_desc **, void *, void *, int8_t); @@ -277,7 +275,7 @@ struct type_desc { glue_fn *take_glue; glue_fn *drop_glue; glue_fn *free_glue; - copy_glue_fn *copy_glue; + void *unused; glue_fn *sever_glue; // For GC. glue_fn *mark_glue; // For GC. uintptr_t is_stateful;