Skip to content

Commit e55aa6e

Browse files
committed
free uniq data we encounter on the sweep, walk thru them otherwise
1 parent f4a3a3b commit e55aa6e

File tree

6 files changed

+433
-262
lines changed

6 files changed

+433
-262
lines changed

src/comp/middle/shape.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,18 @@ const shape_vec: u8 = 11u8;
4646
const shape_tag: u8 = 12u8;
4747
const shape_box: u8 = 13u8;
4848
const shape_struct: u8 = 17u8;
49-
const shape_fn: u8 = 18u8;
49+
const shape_box_fn: u8 = 18u8;
5050
const shape_obj: u8 = 19u8;
5151
const shape_res: u8 = 20u8;
5252
const shape_var: u8 = 21u8;
5353
const shape_uniq: u8 = 22u8;
5454
const shape_opaque_closure_ptr: u8 = 23u8; // the closure itself.
5555
const shape_iface: u8 = 24u8;
56+
const shape_uniq_fn: u8 = 25u8;
57+
const shape_stack_fn: u8 = 26u8;
58+
const shape_bare_fn: u8 = 27u8;
59+
const shape_tydesc: u8 = 28u8;
60+
const shape_send_tydesc: u8 = 29u8;
5661

5762
// FIXME: This is a bad API in trans_common.
5863
fn C_u8(n: u8) -> ValueRef { ret trans_common::C_u8(n as uint); }
@@ -267,6 +272,14 @@ fn s_variant_tag_t(tcx: ty_ctxt) -> u8 {
267272
ret s_int(tcx);
268273
}
269274

275+
fn s_tydesc(_tcx: ty_ctxt) -> u8 {
276+
ret shape_tydesc;
277+
}
278+
279+
fn s_send_tydesc(_tcx: ty_ctxt) -> u8 {
280+
ret shape_send_tydesc;
281+
}
282+
270283
fn mk_ctxt(llmod: ModuleRef) -> ctxt {
271284
let llshapetablesty = trans_common::T_named_struct("shapes");
272285
let llshapetables =
@@ -305,8 +318,10 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint],
305318
ty::ty_bot. { s += [shape_u8]; }
306319
ty::ty_int(ast::ty_i.) { s += [s_int(ccx.tcx)]; }
307320
ty::ty_float(ast::ty_f.) { s += [s_float(ccx.tcx)]; }
308-
ty::ty_uint(ast::ty_u.) | ty::ty_ptr(_) | ty::ty_type. |
309-
ty::ty_send_type. | ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
321+
ty::ty_uint(ast::ty_u.) | ty::ty_ptr(_) |
322+
ty::ty_native(_) { s += [s_uint(ccx.tcx)]; }
323+
ty::ty_type. { s += [s_tydesc(ccx.tcx)]; }
324+
ty::ty_send_type. { s += [s_send_tydesc(ccx.tcx)]; }
310325
ty::ty_int(ast::ty_i8.) { s += [shape_i8]; }
311326
ty::ty_uint(ast::ty_u16.) { s += [shape_u16]; }
312327
ty::ty_int(ast::ty_i16.) { s += [shape_i16]; }
@@ -418,8 +433,17 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint],
418433
}
419434
}
420435
}
421-
ty::ty_fn(_) {
422-
s += [shape_fn];
436+
ty::ty_fn({proto: ast::proto_box., _}) {
437+
s += [shape_box_fn];
438+
}
439+
ty::ty_fn({proto: ast::proto_uniq., _}) {
440+
s += [shape_uniq_fn];
441+
}
442+
ty::ty_fn({proto: ast::proto_block., _}) {
443+
s += [shape_stack_fn];
444+
}
445+
ty::ty_fn({proto: ast::proto_bare., _}) {
446+
s += [shape_bare_fn];
423447
}
424448
ty::ty_opaque_closure_ptr(_) {
425449
s += [shape_opaque_closure_ptr];

0 commit comments

Comments
 (0)