librustc: De-@mut llvm_insns in the stats

This commit is contained in:
Patrick Walton 2013-12-22 13:56:22 -08:00
parent 8c3a552ac5
commit e84f79feb1
4 changed files with 7 additions and 6 deletions

View File

@ -3268,7 +3268,8 @@ pub fn trans_crate(sess: session::Session,
}
}
if ccx.sess.count_llvm_insns() {
for (k, v) in ccx.stats.llvm_insns.iter() {
let llvm_insns = ccx.stats.llvm_insns.borrow();
for (k, v) in llvm_insns.get().iter() {
println!("{:7u} {}", *v, *k);
}
}

View File

@ -54,7 +54,7 @@ impl Builder {
}
if self.ccx.sess.count_llvm_insns() {
base::with_insn_ctxt(|v| {
let h = &mut self.ccx.stats.llvm_insns;
let mut h = self.ccx.stats.llvm_insns.borrow_mut();
// Build version of path with cycles removed.
@ -82,11 +82,11 @@ impl Builder {
s.push_char('/');
s.push_str(category);
let n = match h.find(&s) {
let n = match h.get().find(&s) {
Some(&n) => n,
_ => 0u
};
h.insert(s, n+1u);
h.get().insert(s, n+1u);
})
}
}

View File

@ -135,7 +135,7 @@ pub struct Stats {
n_inlines: Cell<uint>,
n_closures: Cell<uint>,
n_llvm_insns: Cell<uint>,
llvm_insns: HashMap<~str, uint>,
llvm_insns: RefCell<HashMap<~str, uint>>,
fn_stats: ~[(~str, uint, uint)] // (ident, time-in-ms, llvm-instructions)
}

View File

@ -220,7 +220,7 @@ impl CrateContext {
n_inlines: Cell::new(0u),
n_closures: Cell::new(0u),
n_llvm_insns: Cell::new(0u),
llvm_insns: HashMap::new(),
llvm_insns: RefCell::new(HashMap::new()),
fn_stats: ~[]
},
tydesc_type: tydesc_type,