Skip to content

Commit

Permalink
Reuse monomorphized functions for different box types
Browse files Browse the repository at this point in the history
The free glue for opaque boxes will pick the actual tydesc out of the
box, and call its glue.

Issue #1736
  • Loading branch information
marijnh committed Feb 7, 2012
1 parent 3bd0338 commit b28a555
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 260 deletions.
1 change: 1 addition & 0 deletions src/comp/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
let inner = parse_ty(st, conv);
ty::mk_named(st.tcx, inner, name)
}
'B' { ty::mk_opaque_box(st.tcx) }
c { #error("unexpected char in type string: %c", c); fail;}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/comp/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
for tc: @ty::type_constr in cs { enc_ty_constr(w, cx, tc); }
w.write_char(']');
}
ty::ty_opaque_box { w.write_char('B'); }
}
}
fn enc_proto(w: io::writer, proto: proto) {
Expand Down
4 changes: 4 additions & 0 deletions src/comp/middle/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
s += [shape_box];
add_substr(s, shape_of(ccx, mt.ty, ty_param_map));
}
ty::ty_opaque_box {
s += [shape_box];
add_substr(s, [shape_u8]);
}
ty::ty_uniq(mt) {
s += [shape_uniq];
add_substr(s, shape_of(ccx, mt.ty, ty_param_map));
Expand Down
Loading

0 comments on commit b28a555

Please sign in to comment.