@@ -1313,7 +1313,21 @@ fn make_free_glue(bcx: @block_ctxt, v0: ValueRef, t: ty::t) {
1313
1313
trans_non_gc_free ( bcx, v)
1314
1314
} else { bcx }
1315
1315
}
1316
- ty:: ty_uniq ( _) { fail "free uniq unimplemented" ; }
1316
+ ty:: ty_uniq ( content_t) {
1317
+ let free_cx = new_sub_block_ctxt ( bcx, "uniq_free" ) ;
1318
+ let next_cx = new_sub_block_ctxt ( bcx, "uniq_free_next" ) ;
1319
+ let vptr = Load ( bcx, v0) ;
1320
+ let null_test = IsNull ( bcx, vptr) ;
1321
+ CondBr ( bcx, null_test, next_cx. llbb , free_cx. llbb ) ;
1322
+
1323
+ let bcx = free_cx;
1324
+ let bcx = drop_ty ( bcx, vptr, content_t) ;
1325
+ let bcx = trans_shared_free ( bcx, vptr) ;
1326
+ Store ( bcx, C_null ( val_ty ( vptr) ) , v0) ;
1327
+ Br ( bcx, next_cx. llbb ) ;
1328
+
1329
+ next_cx
1330
+ }
1317
1331
ty:: ty_obj ( _) {
1318
1332
// Call through the obj's own fields-drop glue first.
1319
1333
// Then free the body.
@@ -1366,10 +1380,7 @@ fn make_drop_glue(bcx: @block_ctxt, v0: ValueRef, t: ty::t) {
1366
1380
ty:: ty_str. { tvec:: make_drop_glue ( bcx, v0, t) }
1367
1381
ty:: ty_box ( _) { decr_refcnt_maybe_free ( bcx, v0, v0, t) }
1368
1382
ty:: ty_uniq ( _) {
1369
- let vptr = Load ( bcx, v0) ;
1370
- let bcx = trans_shared_free ( bcx, vptr) ;
1371
- Store ( bcx, C_null ( val_ty ( vptr) ) , v0) ;
1372
- bcx
1383
+ free_ty ( bcx, v0, t)
1373
1384
}
1374
1385
ty:: ty_obj ( _) {
1375
1386
let box_cell =
0 commit comments