Stop storing cmp glue in tydescs
There's no such thing anymore, we can simply call upcalls.cmp_type.
This commit is contained in:
parent
b28a5552e3
commit
47143ee24a
4 changed files with 7 additions and 50 deletions
|
@ -44,7 +44,7 @@ const tydesc_field_unused: int = 6;
|
|||
const tydesc_field_sever_glue: int = 7;
|
||||
const tydesc_field_mark_glue: int = 8;
|
||||
const tydesc_field_unused2: int = 9;
|
||||
const tydesc_field_cmp_glue: int = 10;
|
||||
const tydesc_field_unused_2: int = 10;
|
||||
const tydesc_field_shape: int = 11;
|
||||
const tydesc_field_shape_tables: int = 12;
|
||||
const tydesc_field_n_params: int = 13;
|
||||
|
|
|
@ -977,7 +977,6 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t, ty_params: [uint])
|
|||
mutable take_glue: none,
|
||||
mutable drop_glue: none,
|
||||
mutable free_glue: none,
|
||||
mutable cmp_glue: none,
|
||||
ty_params: ty_params};
|
||||
log(debug, "--- declare_tydesc " + ty_to_str(ccx.tcx, t));
|
||||
ret info;
|
||||
|
@ -1055,7 +1054,6 @@ fn make_generic_glue(ccx: @crate_ctxt, t: ty::t, llfn: ValueRef,
|
|||
fn emit_tydescs(ccx: @crate_ctxt) {
|
||||
ccx.tydescs.items {|key, val|
|
||||
let glue_fn_ty = T_ptr(T_glue_fn(ccx));
|
||||
let cmp_fn_ty = T_ptr(T_cmp_glue_fn(ccx));
|
||||
let ti = val;
|
||||
let take_glue =
|
||||
alt ti.take_glue {
|
||||
|
@ -1072,11 +1070,6 @@ fn emit_tydescs(ccx: @crate_ctxt) {
|
|||
none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
|
||||
some(v) { ccx.stats.n_real_glues += 1u; v }
|
||||
};
|
||||
let cmp_glue =
|
||||
alt ti.cmp_glue {
|
||||
none { ccx.stats.n_null_glues += 1u; C_null(cmp_fn_ty) }
|
||||
some(v) { ccx.stats.n_real_glues += 1u; v }
|
||||
};
|
||||
|
||||
let shape = shape::shape_of(ccx, key, ti.ty_params);
|
||||
let shape_tables =
|
||||
|
@ -1095,7 +1088,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
|
|||
C_null(glue_fn_ty), // sever_glue
|
||||
C_null(glue_fn_ty), // mark_glue
|
||||
C_null(glue_fn_ty), // unused
|
||||
cmp_glue, // cmp_glue
|
||||
C_null(T_ptr(T_i8())), // cmp_glue
|
||||
C_shape(ccx, shape), // shape
|
||||
shape_tables, // shape_tables
|
||||
C_int(ccx, 0), // n_params
|
||||
|
@ -1548,7 +1541,6 @@ fn lazily_emit_all_tydesc_glue(ccx: @crate_ctxt,
|
|||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_take_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_drop_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_free_glue, static_ti);
|
||||
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_cmp_glue, static_ti);
|
||||
}
|
||||
|
||||
fn lazily_emit_all_generic_info_tydesc_glues(ccx: @crate_ctxt,
|
||||
|
@ -1611,17 +1603,6 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: int,
|
|||
ty_to_str(ccx.tcx, ti.ty));
|
||||
}
|
||||
}
|
||||
} else if field == abi::tydesc_field_cmp_glue {
|
||||
alt ti.cmp_glue {
|
||||
some(_) { }
|
||||
none {
|
||||
#debug("+++ lazily_emit_tydesc_glue CMP %s",
|
||||
ty_to_str(ccx.tcx, ti.ty));
|
||||
ti.cmp_glue = some(ccx.upcalls.cmp_type);
|
||||
#debug("--- lazily_emit_tydesc_glue CMP %s",
|
||||
ty_to_str(ccx.tcx, ti.ty));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1687,24 +1668,15 @@ fn call_cmp_glue(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t,
|
|||
|
||||
let llrawlhsptr = BitCast(bcx, lllhs, T_ptr(T_i8()));
|
||||
let llrawrhsptr = BitCast(bcx, llrhs, T_ptr(T_i8()));
|
||||
let ti = none::<@tydesc_info>;
|
||||
let ti = none;
|
||||
r = get_tydesc(bcx, t, false, ti).result;
|
||||
let lltydesc = r.val;
|
||||
bcx = r.bcx;
|
||||
lazily_emit_tydesc_glue(bcx_ccx(bcx), abi::tydesc_field_cmp_glue, ti);
|
||||
let lltydescs =
|
||||
GEPi(bcx, lltydesc, [0, abi::tydesc_field_first_param]);
|
||||
lltydescs = Load(bcx, lltydescs);
|
||||
|
||||
let llfn;
|
||||
alt ti {
|
||||
none {
|
||||
let llfnptr =
|
||||
GEPi(bcx, lltydesc, [0, abi::tydesc_field_cmp_glue]);
|
||||
llfn = Load(bcx, llfnptr);
|
||||
}
|
||||
some(sti) { llfn = option::get(sti.cmp_glue); }
|
||||
}
|
||||
let llfn = bcx_ccx(bcx).upcalls.cmp_type;
|
||||
|
||||
let llcmpresultptr = alloca(bcx, T_i1());
|
||||
Call(bcx, llfn, [llcmpresultptr, lltydesc, lltydescs,
|
||||
|
|
|
@ -47,7 +47,6 @@ type tydesc_info =
|
|||
mutable take_glue: option<ValueRef>,
|
||||
mutable drop_glue: option<ValueRef>,
|
||||
mutable free_glue: option<ValueRef>,
|
||||
mutable cmp_glue: option<ValueRef>,
|
||||
ty_params: [uint]};
|
||||
|
||||
/*
|
||||
|
@ -570,14 +569,6 @@ fn T_glue_fn(cx: @crate_ctxt) -> TypeRef {
|
|||
ret t;
|
||||
}
|
||||
|
||||
fn T_cmp_glue_fn(cx: @crate_ctxt) -> TypeRef {
|
||||
let s = "cmp_glue_fn";
|
||||
alt name_has_type(cx.tn, s) { some(t) { ret t; } _ {} }
|
||||
let t = T_tydesc_field(cx, abi::tydesc_field_cmp_glue);
|
||||
associate_type(cx.tn, s, t);
|
||||
ret t;
|
||||
}
|
||||
|
||||
fn T_tydesc(targ_cfg: @session::config) -> TypeRef {
|
||||
let tydesc = T_named_struct("tydesc");
|
||||
let tydescpp = T_ptr(T_ptr(tydesc));
|
||||
|
@ -585,15 +576,12 @@ fn T_tydesc(targ_cfg: @session::config) -> TypeRef {
|
|||
let glue_fn_ty =
|
||||
T_ptr(T_fn([T_ptr(T_nil()), T_ptr(T_nil()), tydescpp,
|
||||
pvoid], T_void()));
|
||||
let cmp_glue_fn_ty =
|
||||
T_ptr(T_fn([T_ptr(T_i1()), T_ptr(tydesc), tydescpp,
|
||||
pvoid, pvoid, T_i8()], T_void()));
|
||||
|
||||
let int_type = T_int(targ_cfg);
|
||||
let elems =
|
||||
[tydescpp, int_type, int_type,
|
||||
glue_fn_ty, glue_fn_ty, glue_fn_ty,
|
||||
T_ptr(T_i8()), glue_fn_ty, glue_fn_ty, glue_fn_ty, cmp_glue_fn_ty,
|
||||
T_ptr(T_i8()), glue_fn_ty, glue_fn_ty, glue_fn_ty, T_ptr(T_i8()),
|
||||
T_ptr(T_i8()), T_ptr(T_i8()), int_type, int_type];
|
||||
set_struct_body(tydesc, elems);
|
||||
ret tydesc;
|
||||
|
|
|
@ -221,9 +221,6 @@ public:
|
|||
|
||||
typedef void CDECL (glue_fn)(void *, void *,
|
||||
const type_desc **, void *);
|
||||
typedef void CDECL (cmp_glue_fn)(void *, void *,
|
||||
const type_desc **,
|
||||
void *, void *, int8_t);
|
||||
|
||||
struct rust_shape_tables {
|
||||
uint8_t *tags;
|
||||
|
@ -270,11 +267,11 @@ struct type_desc {
|
|||
glue_fn *take_glue;
|
||||
glue_fn *drop_glue;
|
||||
glue_fn *free_glue;
|
||||
void *unused;
|
||||
void *UNUSED;
|
||||
glue_fn *sever_glue; // For GC.
|
||||
glue_fn *mark_glue; // For GC.
|
||||
uintptr_t unused2;
|
||||
cmp_glue_fn *cmp_glue;
|
||||
void *UNUSED_2;
|
||||
const uint8_t *shape;
|
||||
const rust_shape_tables *shape_tables;
|
||||
uintptr_t n_params;
|
||||
|
|
Loading…
Reference in a new issue