diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2012-02-07 14:37:10 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-02-07 14:37:10 +0100 |
| commit | 47143ee24a135ee2a82864c9ff892fafe5cd262d (patch) | |
| tree | 70a103ed25a5b4f3bc1bc199d4f01b5fae1daf83 /src/comp | |
| parent | b28a5552e3e822063499c8fb7c6c0be6bb881863 (diff) | |
| download | rust-47143ee24a135ee2a82864c9ff892fafe5cd262d.tar.gz rust-47143ee24a135ee2a82864c9ff892fafe5cd262d.zip | |
Stop storing cmp glue in tydescs
There's no such thing anymore, we can simply call upcalls.cmp_type.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/back/abi.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/trans/base.rs | 34 | ||||
| -rw-r--r-- | src/comp/middle/trans/common.rs | 14 |
3 files changed, 5 insertions, 45 deletions
diff --git a/src/comp/back/abi.rs b/src/comp/back/abi.rs index a5670a03fa9..c02960deb00 100644 --- a/src/comp/back/abi.rs +++ b/src/comp/back/abi.rs @@ -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; diff --git a/src/comp/middle/trans/base.rs b/src/comp/middle/trans/base.rs index 2f4417d751a..16baec360d8 100644 --- a/src/comp/middle/trans/base.rs +++ b/src/comp/middle/trans/base.rs @@ -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, diff --git a/src/comp/middle/trans/common.rs b/src/comp/middle/trans/common.rs index 43daef253c1..fdac4fa165f 100644 --- a/src/comp/middle/trans/common.rs +++ b/src/comp/middle/trans/common.rs @@ -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; |
