Skip to content

Commit d01e7cd

Browse files
committed
Represent boxed ifaces in a way similar to functions
They are now a (dictptr, box) pair, where box is a regular boxed representation of the inner type. This cuts down on some special case code. Also removes some code from trans::base that was moved to shape but then somehow restored in trans::base through a bad merge. Starts on issue #1567
1 parent b173485 commit d01e7cd

File tree

7 files changed

+69
-286
lines changed

7 files changed

+69
-286
lines changed

src/comp/middle/shape.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,13 @@ const shape_res: u8 = 20u8;
5757
const shape_var: u8 = 21u8;
5858
const shape_uniq: u8 = 22u8;
5959
const shape_opaque_closure_ptr: u8 = 23u8; // the closure itself.
60-
const shape_iface: u8 = 24u8;
6160
const shape_uniq_fn: u8 = 25u8;
6261
const shape_stack_fn: u8 = 26u8;
6362
const shape_bare_fn: u8 = 27u8;
6463
const shape_tydesc: u8 = 28u8;
6564
const shape_send_tydesc: u8 = 29u8;
6665
const shape_class: u8 = 30u8;
6766

68-
// FIXME: This is a bad API in trans_common.
69-
fn C_u8(n: u8) -> ValueRef { ret trans::common::C_u8(n as uint); }
70-
7167
fn hash_res_info(ri: res_info) -> uint {
7268
let h = 5381u;
7369
h *= 33u;
@@ -404,7 +400,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint]) -> [u8] {
404400
}
405401
add_substr(s, sub);
406402
}
407-
ty::ty_iface(_, _) { s += [shape_iface]; }
403+
ty::ty_iface(_, _) { s += [shape_box_fn]; }
408404
ty::ty_class(_, _) { s += [shape_class]; }
409405
ty::ty_res(did, raw_subt, tps) {
410406
let subt = ty::substitute_type_params(ccx.tcx, tps, raw_subt);
@@ -720,7 +716,7 @@ fn dynamic_metrics(cx: @block_ctxt, t: ty::t) -> metrics {
720716

721717
alt ty::get(t).struct {
722718
ty::ty_param(p, _) {
723-
let ti = none::<@tydesc_info>;
719+
let ti = none;
724720
let {bcx, val: tydesc} = base::get_tydesc(cx, t, false, ti).result;
725721
let szptr = GEPi(bcx, tydesc, [0, abi::tydesc_field_size]);
726722
let aptr = GEPi(bcx, tydesc, [0, abi::tydesc_field_align]);
@@ -783,7 +779,7 @@ fn dynamic_metrics(cx: @block_ctxt, t: ty::t) -> metrics {
783779
fn simplify_type(ccx: @crate_ctxt, typ: ty::t) -> ty::t {
784780
fn simplifier(ccx: @crate_ctxt, typ: ty::t) -> ty::t {
785781
alt ty::get(typ).struct {
786-
ty::ty_box(_) | ty::ty_iface(_, _) {
782+
ty::ty_box(_) | ty::ty_opaque_box {
787783
ret ty::mk_imm_box(ccx.tcx, ty::mk_nil(ccx.tcx));
788784
}
789785
ty::ty_uniq(_) {

0 commit comments

Comments
 (0)