Skip to content

Commit b28a555

Browse files
committed
Reuse monomorphized functions for different box types
The free glue for opaque boxes will pick the actual tydesc out of the box, and call its glue. Issue #1736
1 parent 3bd0338 commit b28a555

File tree

11 files changed

+228
-260
lines changed

11 files changed

+228
-260
lines changed

src/comp/metadata/tydecode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
301301
let inner = parse_ty(st, conv);
302302
ty::mk_named(st.tcx, inner, name)
303303
}
304+
'B' { ty::mk_opaque_box(st.tcx) }
304305
c { #error("unexpected char in type string: %c", c); fail;}
305306
}
306307
}

src/comp/metadata/tyencode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
192192
for tc: @ty::type_constr in cs { enc_ty_constr(w, cx, tc); }
193193
w.write_char(']');
194194
}
195+
ty::ty_opaque_box { w.write_char('B'); }
195196
}
196197
}
197198
fn enc_proto(w: io::writer, proto: proto) {

src/comp/middle/shape.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
381381
s += [shape_box];
382382
add_substr(s, shape_of(ccx, mt.ty, ty_param_map));
383383
}
384+
ty::ty_opaque_box {
385+
s += [shape_box];
386+
add_substr(s, [shape_u8]);
387+
}
384388
ty::ty_uniq(mt) {
385389
s += [shape_uniq];
386390
add_substr(s, shape_of(ccx, mt.ty, ty_param_map));

0 commit comments

Comments
 (0)