mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
rustc: Use the abbreviated type names to avoid LLVM bitcode size explosion
This commit is contained in:
parent
da328b1ba9
commit
c4e13cd1fa
@ -45,9 +45,8 @@ const uint tag_index_table = 0x15u;
|
|||||||
// Type encoding
|
// Type encoding
|
||||||
|
|
||||||
// Compact string representation for ty.t values. API ty_str & parse_from_str.
|
// Compact string representation for ty.t values. API ty_str & parse_from_str.
|
||||||
// (The second has to be authed pure.) Extra parameters are for converting
|
// Extra parameters are for converting to/from def_ids in the string rep.
|
||||||
// to/from def_ids in the string rep. Whatever format you choose should not
|
// Whatever format you choose should not contain pipe characters.
|
||||||
// contain pipe characters.
|
|
||||||
|
|
||||||
mod Encode {
|
mod Encode {
|
||||||
|
|
||||||
|
@ -786,7 +786,8 @@ fn type_of_inner(@crate_ctxt cx, ty.t t) -> TypeRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check (llty as int != 0);
|
check (llty as int != 0);
|
||||||
llvm.LLVMAddTypeName(cx.llmod, _str.buf(ty.ty_to_str(cx.tcx, t)), llty);
|
llvm.LLVMAddTypeName(cx.llmod, _str.buf(ty.ty_to_abbrev_str(cx.tcx, t)),
|
||||||
|
llty);
|
||||||
cx.lltypes.insert(t, llty);
|
cx.lltypes.insert(t, llty);
|
||||||
ret llty;
|
ret llty;
|
||||||
}
|
}
|
||||||
@ -1645,7 +1646,7 @@ fn declare_tydesc(@local_ctxt cx, ty.t t) {
|
|||||||
auto glue_fn_ty = T_ptr(T_glue_fn(ccx.tn));
|
auto glue_fn_ty = T_ptr(T_glue_fn(ccx.tn));
|
||||||
|
|
||||||
auto name = sanitize(ccx.names.next("tydesc_" +
|
auto name = sanitize(ccx.names.next("tydesc_" +
|
||||||
ty.ty_to_str(cx.ccx.tcx, t)));
|
ty.ty_to_abbrev_str(cx.ccx.tcx, t)));
|
||||||
auto gvar = llvm.LLVMAddGlobal(ccx.llmod, T_tydesc(ccx.tn),
|
auto gvar = llvm.LLVMAddGlobal(ccx.llmod, T_tydesc(ccx.tn),
|
||||||
_str.buf(name));
|
_str.buf(name));
|
||||||
auto tydesc = C_struct(vec(C_null(T_ptr(T_ptr(T_tydesc(ccx.tn)))),
|
auto tydesc = C_struct(vec(C_null(T_ptr(T_ptr(T_tydesc(ccx.tn)))),
|
||||||
|
@ -627,6 +627,12 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
|
|||||||
ret s;
|
ret s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ty_to_abbrev_str(ctxt cx, t typ) -> str {
|
||||||
|
auto f = def_to_str;
|
||||||
|
auto ecx = @rec(ds=f, tcx=cx);
|
||||||
|
ret metadata.Encode.ty_str(ecx, typ);
|
||||||
|
}
|
||||||
|
|
||||||
// Type folds
|
// Type folds
|
||||||
|
|
||||||
type ty_walk = fn(t);
|
type ty_walk = fn(t);
|
||||||
|
Loading…
Reference in New Issue
Block a user