@@ -1292,11 +1292,22 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
1292
1292
// FIXME: switch gc/non-gc on layer of the type.
1293
1293
let rs =
1294
1294
alt ty:: struct ( bcx_tcx ( cx) , t) {
1295
- ty:: ty_str. { let v = cx. build . Load ( v0) ; trans_non_gc_free ( cx, v) }
1295
+ ty:: ty_str. {
1296
+ let v = cx. build . Load ( v0) ;
1297
+ if !bcx_ccx ( cx) . sess . get_opts ( ) . do_gc {
1298
+ trans_non_gc_free ( cx, v)
1299
+ } else {
1300
+ rslt ( cx, C_nil ( ) )
1301
+ }
1302
+ }
1296
1303
ty:: ty_vec ( _) {
1297
1304
let v = cx. build . Load ( v0) ;
1298
1305
let rs = iter_sequence ( cx, v, t, bind drop_ty ( _, _, _) ) ;
1299
- trans_non_gc_free ( rs. bcx , v)
1306
+ if !bcx_ccx ( cx) . sess . get_opts ( ) . do_gc {
1307
+ trans_non_gc_free ( rs. bcx , v)
1308
+ } else {
1309
+ rslt ( cx, C_nil ( ) )
1310
+ }
1300
1311
}
1301
1312
ty:: ty_box ( body_mt) {
1302
1313
let v = cx. build . Load ( v0) ;
@@ -1305,7 +1316,11 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
1305
1316
let body_ty = body_mt. ty ;
1306
1317
let body_val = load_if_immediate ( cx, body, body_ty) ;
1307
1318
let rs = drop_ty ( cx, body_val, body_ty) ;
1308
- trans_non_gc_free ( rs. bcx , v)
1319
+ if !bcx_ccx ( cx) . sess . get_opts ( ) . do_gc {
1320
+ trans_non_gc_free ( rs. bcx , v)
1321
+ } else {
1322
+ rslt ( cx, C_nil ( ) )
1323
+ }
1309
1324
}
1310
1325
ty:: ty_uniq ( _) {
1311
1326
fail "free uniq unimplemented" ;
@@ -1341,7 +1356,11 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
1341
1356
let ti = none[ @tydesc_info] ;
1342
1357
call_tydesc_glue_full ( cx, body, tydesc,
1343
1358
abi:: tydesc_field_drop_glue, ti) ;
1344
- trans_non_gc_free ( cx, b)
1359
+ if ( !bcx_ccx ( cx) . sess . get_opts ( ) . do_gc ) {
1360
+ trans_non_gc_free ( cx, b)
1361
+ } else {
1362
+ rslt ( cx, C_nil ( ) )
1363
+ }
1345
1364
}
1346
1365
ty:: ty_fn ( _, _, _, _, _) {
1347
1366
let box_cell =
@@ -1358,7 +1377,11 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
1358
1377
let ti = none[ @tydesc_info] ;
1359
1378
call_tydesc_glue_full ( cx, bindings, cx. build . Load ( tydescptr) ,
1360
1379
abi:: tydesc_field_drop_glue, ti) ;
1361
- trans_non_gc_free ( cx, v)
1380
+ if ( !bcx_ccx ( cx) . sess . get_opts ( ) . do_gc ) {
1381
+ trans_non_gc_free ( cx, v)
1382
+ } else {
1383
+ rslt ( cx, C_nil ( ) )
1384
+ }
1362
1385
}
1363
1386
_ { rslt( cx, C_nil ( ) ) }
1364
1387
} ;
0 commit comments