@@ -1122,7 +1122,6 @@ fn declare_tydesc(cx: &@local_ctxt, sp: &span, t: ty::t, ty_params: &[uint])
1122
1122
mutable drop_glue: none :: < ValueRef > ,
1123
1123
mutable free_glue: none :: < ValueRef > ,
1124
1124
mutable cmp_glue: none :: < ValueRef > ,
1125
- mutable copy_glue: none :: < ValueRef > ,
1126
1125
ty_params: ty_params} ;
1127
1126
log "--- declare_tydesc " + ty_to_str ( cx. ccx . tcx , t) ;
1128
1127
ret info;
@@ -1216,7 +1215,6 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
1216
1215
for each pair: @{ key : ty:: t, val : @tydesc_info} in ccx. tydescs . items ( ) {
1217
1216
let glue_fn_ty = T_ptr ( T_glue_fn ( * ccx) ) ;
1218
1217
let cmp_fn_ty = T_ptr ( T_cmp_glue_fn ( * ccx) ) ;
1219
- let copy_fn_ty = T_ptr ( T_copy_glue_fn ( * ccx) ) ;
1220
1218
let ti = pair. val ;
1221
1219
let take_glue =
1222
1220
alt { ti. take_glue } {
@@ -1238,11 +1236,6 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
1238
1236
none. { ccx . stats . n_null_glues += 1 u; C_null ( cmp_fn_ty) }
1239
1237
some ( v) { ccx. stats . n_real_glues += 1 u; v }
1240
1238
} ;
1241
- let copy_glue =
1242
- alt { ti. copy_glue } {
1243
- none. { ccx . stats . n_null_glues += 1 u; C_null ( copy_fn_ty) }
1244
- some ( v) { ccx. stats . n_real_glues += 1 u; v }
1245
- } ;
1246
1239
1247
1240
let shape = shape:: shape_of ( ccx, pair. key ) ;
1248
1241
let shape_tables =
@@ -1257,7 +1250,7 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
1257
1250
take_glue, // take_glue
1258
1251
drop_glue, // drop_glue
1259
1252
free_glue, // free_glue
1260
- copy_glue , // copy_glue
1253
+ C_null ( T_ptr ( T_i8 ( ) ) ) , // unused
1261
1254
C_null ( glue_fn_ty) , // sever_glue
1262
1255
C_null ( glue_fn_ty) , // mark_glue
1263
1256
C_null ( glue_fn_ty) , // is_stateful
@@ -1274,14 +1267,6 @@ fn emit_tydescs(ccx: &@crate_ctxt) {
1274
1267
}
1275
1268
}
1276
1269
1277
- // NOTE this is currently just a complicated way to do memmove. I'm working on
1278
- // a representation of ivecs that will need pointers into itself, which must
1279
- // be adjusted when copying. Will flesh this out when the time comes.
1280
- fn make_copy_glue ( cx : & @block_ctxt , src : ValueRef , dst : ValueRef , t : ty:: t ) {
1281
- let bcx = memmove_ty ( cx, dst, src, t) . bcx ;
1282
- build_return ( bcx) ;
1283
- }
1284
-
1285
1270
fn make_take_glue ( cx : & @block_ctxt , v : ValueRef , t : ty:: t ) {
1286
1271
// NB: v is an *alias* of type t here, not a direct value.
1287
1272
@@ -2003,7 +1988,6 @@ fn lazily_emit_all_tydesc_glue(cx: &@block_ctxt,
2003
1988
lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_drop_glue, static_ti) ;
2004
1989
lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_free_glue, static_ti) ;
2005
1990
lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_cmp_glue, static_ti) ;
2006
- lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_copy_glue, static_ti) ;
2007
1991
}
2008
1992
2009
1993
fn lazily_emit_all_generic_info_tydesc_glues ( cx : & @block_ctxt ,
@@ -2083,20 +2067,6 @@ fn lazily_emit_tydesc_glue(cx: &@block_ctxt, field: int,
2083
2067
ty_to_str ( bcx_tcx ( cx) , ti. ty ) ] ;
2084
2068
}
2085
2069
}
2086
- } else if field == abi:: tydesc_field_copy_glue {
2087
- alt { ti. copy_glue } {
2088
- some ( _) { }
2089
- none. {
2090
- let lcx = cx. fcx . lcx ;
2091
- let glue_fn =
2092
- declare_generic_glue ( lcx, ti. ty , T_copy_glue_fn ( * lcx. ccx ) ,
2093
- "copy" ) ;
2094
- ti. copy_glue = some ( glue_fn) ;
2095
- make_generic_glue ( lcx, cx. sp , ti. ty , glue_fn,
2096
- copy_helper ( make_copy_glue) ,
2097
- ti. ty_params , "copy" ) ;
2098
- }
2099
- }
2100
2070
}
2101
2071
}
2102
2072
}
@@ -2186,45 +2156,6 @@ fn call_cmp_glue(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t,
2186
2156
ret rslt( r. bcx , bld:: Load ( r. bcx , llcmpresultptr) ) ;
2187
2157
}
2188
2158
2189
- fn call_copy_glue ( cx : & @block_ctxt , dst : ValueRef , src : ValueRef , t : ty:: t ,
2190
- take : bool ) -> @block_ctxt {
2191
- // You can't call this on immediate types. Those are simply copied with
2192
- // Load/Store.
2193
- assert ! type_is_immediate( bcx_ccx( cx) , t) ;
2194
- let srcptr = bld:: BitCast ( cx, src, T_ptr ( T_i8 ( ) ) ) ;
2195
- let dstptr = bld:: BitCast ( cx, dst, T_ptr ( T_i8 ( ) ) ) ;
2196
- let ti = none;
2197
- let { bcx, val: lltydesc } = get_tydesc ( cx, t, false , ti) . result ;
2198
- lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_copy_glue, ti) ;
2199
- let lltydescs = bld:: GEP
2200
- ( bcx, lltydesc, [ C_int ( 0 ) , C_int ( abi:: tydesc_field_first_param) ] ) ;
2201
- lltydescs = bld:: Load ( bcx, lltydescs) ;
2202
-
2203
- let llfn = alt ti {
2204
- none. {
2205
- bld : : Load ( bcx, bld:: GEP
2206
- ( bcx, lltydesc, [ C_int ( 0 ) , C_int ( abi:: tydesc_field_copy_glue) ] ) )
2207
- }
2208
- some( sti) { option:: get ( sti. copy_glue ) }
2209
- } ;
2210
- bld:: Call ( bcx, llfn, [ C_null ( T_ptr ( T_nil ( ) ) ) , bcx. fcx . lltaskptr ,
2211
- C_null ( T_ptr ( T_nil ( ) ) ) , lltydescs, srcptr, dstptr] ) ;
2212
- if take {
2213
- lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_take_glue, ti) ;
2214
- llfn = alt ti {
2215
- none. {
2216
- bld : : Load ( bcx, bld:: GEP ( bcx, lltydesc,
2217
- [ C_int ( 0 ) ,
2218
- C_int ( abi:: tydesc_field_take_glue) ] ) )
2219
- }
2220
- some( sti) { option:: get ( sti. take_glue ) }
2221
- } ;
2222
- bld:: Call ( bcx, llfn, [ C_null ( T_ptr ( T_nil ( ) ) ) , bcx. fcx . lltaskptr ,
2223
- C_null ( T_ptr ( T_nil ( ) ) ) , lltydescs, dstptr] ) ;
2224
- }
2225
- ret bcx;
2226
- }
2227
-
2228
2159
2229
2160
// Compares two values. Performs the simple scalar comparison if the types are
2230
2161
// scalar and calls to comparison glue otherwise.
@@ -2379,12 +2310,8 @@ fn copy_val_no_check(cx: &@block_ctxt, action: copy_action, dst: ValueRef,
2379
2310
let bcx = if action == DROP_EXISTING {
2380
2311
drop_ty ( cx, dst, t) . bcx
2381
2312
} else { cx } ;
2382
- if ty:: type_needs_copy_glue ( ccx. tcx , t) {
2383
- ret call_copy_glue ( bcx, dst, src, t, true ) ;
2384
- } else {
2385
- bcx = memmove_ty ( bcx, dst, src, t) . bcx ;
2386
- ret take_ty( bcx, dst, t) . bcx ;
2387
- }
2313
+ bcx = memmove_ty ( bcx, dst, src, t) . bcx ;
2314
+ ret take_ty( bcx, dst, t) . bcx ;
2388
2315
}
2389
2316
ccx. sess . bug ( "unexpected type in trans::copy_val_no_check: " +
2390
2317
ty_to_str ( ccx. tcx , t) ) ;
@@ -2421,11 +2348,7 @@ fn move_val(cx: @block_ctxt, action: copy_action, dst: ValueRef,
2421
2348
ret cx;
2422
2349
} else if type_is_structural_or_param ( tcx, t) {
2423
2350
if action == DROP_EXISTING { cx = drop_ty ( cx, dst, t) . bcx ; }
2424
- if ty:: type_needs_copy_glue ( tcx, t) {
2425
- cx = call_copy_glue ( cx, dst, src_val, t, false ) ;
2426
- } else {
2427
- cx = memmove_ty ( cx, dst, src_val, t) . bcx ;
2428
- }
2351
+ cx = memmove_ty ( cx, dst, src_val, t) . bcx ;
2429
2352
if src. is_mem {
2430
2353
ret zero_alloca ( cx, src_val, t) . bcx ;
2431
2354
} else { // Temporary value
0 commit comments