提交 e84f79fe 编写于 作者: P Patrick Walton

librustc: De-`@mut` `llvm_insns` in the stats

上级 8c3a552a
......@@ -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);
}
}
......
......@@ -54,7 +54,7 @@ pub fn count_insn(&self, category: &str) {
}
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 @@ pub fn count_insn(&self, category: &str) {
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);
})
}
}
......
......@@ -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)
}
......
......@@ -220,7 +220,7 @@ pub fn new(sess: session::Session,
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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册