Skip to content

Commit 47143ee

Browse files
committed
Stop storing cmp glue in tydescs
There's no such thing anymore, we can simply call upcalls.cmp_type.
1 parent b28a555 commit 47143ee

File tree

4 files changed

+7
-50
lines changed

4 files changed

+7
-50
lines changed

src/comp/back/abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const tydesc_field_unused: int = 6;
4444
const tydesc_field_sever_glue: int = 7;
4545
const tydesc_field_mark_glue: int = 8;
4646
const tydesc_field_unused2: int = 9;
47-
const tydesc_field_cmp_glue: int = 10;
47+
const tydesc_field_unused_2: int = 10;
4848
const tydesc_field_shape: int = 11;
4949
const tydesc_field_shape_tables: int = 12;
5050
const tydesc_field_n_params: int = 13;

src/comp/middle/trans/base.rs

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,6 @@ fn declare_tydesc(ccx: @crate_ctxt, t: ty::t, ty_params: [uint])
977977
mutable take_glue: none,
978978
mutable drop_glue: none,
979979
mutable free_glue: none,
980-
mutable cmp_glue: none,
981980
ty_params: ty_params};
982981
log(debug, "--- declare_tydesc " + ty_to_str(ccx.tcx, t));
983982
ret info;
@@ -1055,7 +1054,6 @@ fn make_generic_glue(ccx: @crate_ctxt, t: ty::t, llfn: ValueRef,
10551054
fn emit_tydescs(ccx: @crate_ctxt) {
10561055
ccx.tydescs.items {|key, val|
10571056
let glue_fn_ty = T_ptr(T_glue_fn(ccx));
1058-
let cmp_fn_ty = T_ptr(T_cmp_glue_fn(ccx));
10591057
let ti = val;
10601058
let take_glue =
10611059
alt ti.take_glue {
@@ -1072,11 +1070,6 @@ fn emit_tydescs(ccx: @crate_ctxt) {
10721070
none { ccx.stats.n_null_glues += 1u; C_null(glue_fn_ty) }
10731071
some(v) { ccx.stats.n_real_glues += 1u; v }
10741072
};
1075-
let cmp_glue =
1076-
alt ti.cmp_glue {
1077-
none { ccx.stats.n_null_glues += 1u; C_null(cmp_fn_ty) }
1078-
some(v) { ccx.stats.n_real_glues += 1u; v }
1079-
};
10801073

10811074
let shape = shape::shape_of(ccx, key, ti.ty_params);
10821075
let shape_tables =
@@ -1095,7 +1088,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
10951088
C_null(glue_fn_ty), // sever_glue
10961089
C_null(glue_fn_ty), // mark_glue
10971090
C_null(glue_fn_ty), // unused
1098-
cmp_glue, // cmp_glue
1091+
C_null(T_ptr(T_i8())), // cmp_glue
10991092
C_shape(ccx, shape), // shape
11001093
shape_tables, // shape_tables
11011094
C_int(ccx, 0), // n_params
@@ -1548,7 +1541,6 @@ fn lazily_emit_all_tydesc_glue(ccx: @crate_ctxt,
15481541
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_take_glue, static_ti);
15491542
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_drop_glue, static_ti);
15501543
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_free_glue, static_ti);
1551-
lazily_emit_tydesc_glue(ccx, abi::tydesc_field_cmp_glue, static_ti);
15521544
}
15531545

15541546
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,
16111603
ty_to_str(ccx.tcx, ti.ty));
16121604
}
16131605
}
1614-
} else if field == abi::tydesc_field_cmp_glue {
1615-
alt ti.cmp_glue {
1616-
some(_) { }
1617-
none {
1618-
#debug("+++ lazily_emit_tydesc_glue CMP %s",
1619-
ty_to_str(ccx.tcx, ti.ty));
1620-
ti.cmp_glue = some(ccx.upcalls.cmp_type);
1621-
#debug("--- lazily_emit_tydesc_glue CMP %s",
1622-
ty_to_str(ccx.tcx, ti.ty));
1623-
}
1624-
}
16251606
}
16261607
}
16271608
}
@@ -1687,24 +1668,15 @@ fn call_cmp_glue(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t,
16871668

16881669
let llrawlhsptr = BitCast(bcx, lllhs, T_ptr(T_i8()));
16891670
let llrawrhsptr = BitCast(bcx, llrhs, T_ptr(T_i8()));
1690-
let ti = none::<@tydesc_info>;
1671+
let ti = none;
16911672
r = get_tydesc(bcx, t, false, ti).result;
16921673
let lltydesc = r.val;
16931674
bcx = r.bcx;
1694-
lazily_emit_tydesc_glue(bcx_ccx(bcx), abi::tydesc_field_cmp_glue, ti);
16951675
let lltydescs =
16961676
GEPi(bcx, lltydesc, [0, abi::tydesc_field_first_param]);
16971677
lltydescs = Load(bcx, lltydescs);
16981678

1699-
let llfn;
1700-
alt ti {
1701-
none {
1702-
let llfnptr =
1703-
GEPi(bcx, lltydesc, [0, abi::tydesc_field_cmp_glue]);
1704-
llfn = Load(bcx, llfnptr);
1705-
}
1706-
some(sti) { llfn = option::get(sti.cmp_glue); }
1707-
}
1679+
let llfn = bcx_ccx(bcx).upcalls.cmp_type;
17081680

17091681
let llcmpresultptr = alloca(bcx, T_i1());
17101682
Call(bcx, llfn, [llcmpresultptr, lltydesc, lltydescs,

src/comp/middle/trans/common.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ type tydesc_info =
4747
mutable take_glue: option<ValueRef>,
4848
mutable drop_glue: option<ValueRef>,
4949
mutable free_glue: option<ValueRef>,
50-
mutable cmp_glue: option<ValueRef>,
5150
ty_params: [uint]};
5251

5352
/*
@@ -570,30 +569,19 @@ fn T_glue_fn(cx: @crate_ctxt) -> TypeRef {
570569
ret t;
571570
}
572571

573-
fn T_cmp_glue_fn(cx: @crate_ctxt) -> TypeRef {
574-
let s = "cmp_glue_fn";
575-
alt name_has_type(cx.tn, s) { some(t) { ret t; } _ {} }
576-
let t = T_tydesc_field(cx, abi::tydesc_field_cmp_glue);
577-
associate_type(cx.tn, s, t);
578-
ret t;
579-
}
580-
581572
fn T_tydesc(targ_cfg: @session::config) -> TypeRef {
582573
let tydesc = T_named_struct("tydesc");
583574
let tydescpp = T_ptr(T_ptr(tydesc));
584575
let pvoid = T_ptr(T_i8());
585576
let glue_fn_ty =
586577
T_ptr(T_fn([T_ptr(T_nil()), T_ptr(T_nil()), tydescpp,
587578
pvoid], T_void()));
588-
let cmp_glue_fn_ty =
589-
T_ptr(T_fn([T_ptr(T_i1()), T_ptr(tydesc), tydescpp,
590-
pvoid, pvoid, T_i8()], T_void()));
591579

592580
let int_type = T_int(targ_cfg);
593581
let elems =
594582
[tydescpp, int_type, int_type,
595583
glue_fn_ty, glue_fn_ty, glue_fn_ty,
596-
T_ptr(T_i8()), glue_fn_ty, glue_fn_ty, glue_fn_ty, cmp_glue_fn_ty,
584+
T_ptr(T_i8()), glue_fn_ty, glue_fn_ty, glue_fn_ty, T_ptr(T_i8()),
597585
T_ptr(T_i8()), T_ptr(T_i8()), int_type, int_type];
598586
set_struct_body(tydesc, elems);
599587
ret tydesc;

src/rt/rust_internal.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@ template <typename T> class ptr_vec : public task_owned<ptr_vec<T> > {
221221

222222
typedef void CDECL (glue_fn)(void *, void *,
223223
const type_desc **, void *);
224-
typedef void CDECL (cmp_glue_fn)(void *, void *,
225-
const type_desc **,
226-
void *, void *, int8_t);
227224

228225
struct rust_shape_tables {
229226
uint8_t *tags;
@@ -270,11 +267,11 @@ struct type_desc {
270267
glue_fn *take_glue;
271268
glue_fn *drop_glue;
272269
glue_fn *free_glue;
273-
void *unused;
270+
void *UNUSED;
274271
glue_fn *sever_glue; // For GC.
275272
glue_fn *mark_glue; // For GC.
276273
uintptr_t unused2;
277-
cmp_glue_fn *cmp_glue;
274+
void *UNUSED_2;
278275
const uint8_t *shape;
279276
const rust_shape_tables *shape_tables;
280277
uintptr_t n_params;

0 commit comments

Comments
 (0)