aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-04-25 16:59:49 -0700
committerPatrick Walton <[email protected]>2011-04-25 17:00:25 -0700
commitc4e13cd1fa451327a756efc0c23bbbdbb9e7e1ae (patch)
treeda2c6ec1d2c28e316ee97df032c615bb92ad2de4
parentKick ty_var and ty_local entries out of the type store. Pre-compute presence ... (diff)
downloadrust-c4e13cd1fa451327a756efc0c23bbbdbb9e7e1ae.tar.xz
rust-c4e13cd1fa451327a756efc0c23bbbdbb9e7e1ae.zip
rustc: Use the abbreviated type names to avoid LLVM bitcode size explosion
-rw-r--r--src/comp/middle/metadata.rs5
-rw-r--r--src/comp/middle/trans.rs5
-rw-r--r--src/comp/middle/ty.rs6
3 files changed, 11 insertions, 5 deletions
diff --git a/src/comp/middle/metadata.rs b/src/comp/middle/metadata.rs
index fee92395..bd1d5253 100644
--- a/src/comp/middle/metadata.rs
+++ b/src/comp/middle/metadata.rs
@@ -45,9 +45,8 @@ const uint tag_index_table = 0x15u;
// Type encoding
// 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
-// to/from def_ids in the string rep. Whatever format you choose should not
-// contain pipe characters.
+// Extra parameters are for converting to/from def_ids in the string rep.
+// Whatever format you choose should not contain pipe characters.
mod Encode {
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 8d8c9926..b7896ba4 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -786,7 +786,8 @@ fn type_of_inner(@crate_ctxt cx, ty.t t) -> TypeRef {
}
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);
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 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),
_str.buf(name));
auto tydesc = C_struct(vec(C_null(T_ptr(T_ptr(T_tydesc(ccx.tn)))),
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 194dcf44..ca461bc4 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -627,6 +627,12 @@ fn ty_to_str(ctxt cx, &t typ) -> str {
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 ty_walk = fn(t);