librustc: Implement "-Z no-monomorphic-collapse" as a debugging tool to diagnose mysterious crashes we're seeing. rs=debug-tool
This commit is contained in:
parent
aa3aa3b1b2
commit
4fc03bac65
|
@ -65,6 +65,7 @@ const debug_llvm: uint = 1 << 13;
|
|||
const count_type_sizes: uint = 1 << 14;
|
||||
const meta_stats: uint = 1 << 15;
|
||||
const no_opt: uint = 1 << 16;
|
||||
const no_monomorphic_collapse: uint = 1 << 17;
|
||||
|
||||
fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
|
||||
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
|
||||
|
@ -90,6 +91,8 @@ fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
|
|||
count_type_sizes),
|
||||
(~"meta-stats", ~"gather metadata statistics", meta_stats),
|
||||
(~"no-opt", ~"do not optimize, even if -O is passed", no_opt),
|
||||
(~"no-monomorphic-collapse", ~"do not collapse template instantiations",
|
||||
no_monomorphic_collapse),
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -242,6 +245,9 @@ impl Session {
|
|||
fn borrowck_stats() -> bool { self.debugging_opt(borrowck_stats) }
|
||||
fn borrowck_note_pure() -> bool { self.debugging_opt(borrowck_note_pure) }
|
||||
fn borrowck_note_loan() -> bool { self.debugging_opt(borrowck_note_loan) }
|
||||
fn no_monomorphic_collapse() -> bool {
|
||||
self.debugging_opt(no_monomorphic_collapse)
|
||||
}
|
||||
|
||||
fn str_of(id: ast::ident) -> ~str {
|
||||
*self.parse_sess.interner.get(id)
|
||||
|
|
|
@ -320,6 +320,11 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
|
|||
let param_ids = match param_uses {
|
||||
Some(uses) => {
|
||||
vec::map2(precise_param_ids, uses, |id, uses| {
|
||||
if ccx.sess.no_monomorphic_collapse() {
|
||||
match *id {
|
||||
(a, b) => mono_precise(a, b)
|
||||
}
|
||||
} else {
|
||||
match *id {
|
||||
(a, b@Some(_)) => mono_precise(a, b),
|
||||
(subst, None) => {
|
||||
|
@ -354,6 +359,7 @@ fn make_mono_id(ccx: @crate_ctxt, item: ast::def_id, substs: ~[ty::t],
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
None => {
|
||||
|
|
Loading…
Reference in a new issue