@@ -1186,7 +1186,7 @@ fn make_generic_glue_inner(cx: &@local_ctxt, sp: &span, t: &ty::t,
1186
1186
helper ( bcx, llval0, t) ;
1187
1187
}
1188
1188
copy_helper ( helper) {
1189
- let llrawptr1 = llvm:: LLVMGetParam ( llfn, 4 u ) ;
1189
+ let llrawptr1 = llvm:: LLVMGetParam ( llfn, 5 u ) ;
1190
1190
let llval1 = bcx. build . BitCast ( llrawptr1, llty) ;
1191
1191
helper ( bcx, llval0, llval1, t) ;
1192
1192
}
@@ -2178,6 +2178,45 @@ fn call_cmp_glue(cx: &@block_ctxt, lhs: ValueRef, rhs: ValueRef, t: &ty::t,
2178
2178
ret rslt( r. bcx , r. bcx . build . Load ( llcmpresultptr) ) ;
2179
2179
}
2180
2180
2181
+ fn call_copy_glue ( cx : & @block_ctxt , dst : ValueRef , src : ValueRef , t : & ty:: t ,
2182
+ take : bool ) -> @block_ctxt {
2183
+ // You can't call this on immediate types. Those are simply copied with
2184
+ // Load/Store.
2185
+ assert ! type_is_immediate( bcx_ccx( cx) , t) ;
2186
+ let srcptr = cx. build . BitCast ( src, T_ptr ( T_i8 ( ) ) ) ;
2187
+ let dstptr = cx. build . BitCast ( dst, T_ptr ( T_i8 ( ) ) ) ;
2188
+ let ti = none;
2189
+ let { bcx, val: lltydesc } = get_tydesc ( cx, t, false , ti) . result ;
2190
+ lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_copy_glue, ti) ;
2191
+ let lltydescs = bcx. build . GEP
2192
+ ( lltydesc, [ C_int ( 0 ) , C_int ( abi:: tydesc_field_first_param) ] ) ;
2193
+ lltydescs = bcx. build . Load ( lltydescs) ;
2194
+
2195
+ let llfn = alt ti {
2196
+ none. {
2197
+ bcx. build . Load ( bcx. build . GEP
2198
+ ( lltydesc, [ C_int ( 0 ) , C_int ( abi:: tydesc_field_copy_glue) ] ) )
2199
+ }
2200
+ some ( sti) { option:: get ( sti. copy_glue ) }
2201
+ } ;
2202
+ bcx. build . Call ( llfn, [ C_null ( T_ptr ( T_nil ( ) ) ) , bcx. fcx . lltaskptr ,
2203
+ C_null ( T_ptr ( T_nil ( ) ) ) , lltydescs, srcptr, dstptr] ) ;
2204
+ if take {
2205
+ lazily_emit_tydesc_glue ( cx, abi:: tydesc_field_take_glue, ti) ;
2206
+ llfn = alt ti {
2207
+ none. {
2208
+ bcx. build . Load ( bcx. build . GEP
2209
+ ( lltydesc, [ C_int ( 0 ) , C_int ( abi:: tydesc_field_take_glue) ] ) )
2210
+ }
2211
+ some ( sti) { option:: get ( sti. take_glue ) }
2212
+ } ;
2213
+ bcx. build . Call ( llfn, [ C_null ( T_ptr ( T_nil ( ) ) ) , bcx. fcx . lltaskptr ,
2214
+ C_null ( T_ptr ( T_nil ( ) ) ) , lltydescs, dstptr] ) ;
2215
+ }
2216
+ ret bcx;
2217
+ }
2218
+
2219
+
2181
2220
// Compares two values. Performs the simple scalar comparison if the types are
2182
2221
// scalar and calls to comparison glue otherwise.
2183
2222
fn compare ( cx : & @block_ctxt , lhs : ValueRef , rhs : ValueRef , t : & ty:: t ,
0 commit comments