Skip to content

Commit e84f79f

Browse files
committed
librustc: De-@mut llvm_insns in the stats
1 parent 8c3a552 commit e84f79f

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/librustc/middle/trans/base.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3268,7 +3268,8 @@ pub fn trans_crate(sess: session::Session,
32683268
}
32693269
}
32703270
if ccx.sess.count_llvm_insns() {
3271-
for (k, v) in ccx.stats.llvm_insns.iter() {
3271+
let llvm_insns = ccx.stats.llvm_insns.borrow();
3272+
for (k, v) in llvm_insns.get().iter() {
32723273
println!("{:7u} {}", *v, *k);
32733274
}
32743275
}

src/librustc/middle/trans/builder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Builder {
5454
}
5555
if self.ccx.sess.count_llvm_insns() {
5656
base::with_insn_ctxt(|v| {
57-
let h = &mut self.ccx.stats.llvm_insns;
57+
let mut h = self.ccx.stats.llvm_insns.borrow_mut();
5858

5959
// Build version of path with cycles removed.
6060

@@ -82,11 +82,11 @@ impl Builder {
8282
s.push_char('/');
8383
s.push_str(category);
8484

85-
let n = match h.find(&s) {
85+
let n = match h.get().find(&s) {
8686
Some(&n) => n,
8787
_ => 0u
8888
};
89-
h.insert(s, n+1u);
89+
h.get().insert(s, n+1u);
9090
})
9191
}
9292
}

src/librustc/middle/trans/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pub struct Stats {
135135
n_inlines: Cell<uint>,
136136
n_closures: Cell<uint>,
137137
n_llvm_insns: Cell<uint>,
138-
llvm_insns: HashMap<~str, uint>,
138+
llvm_insns: RefCell<HashMap<~str, uint>>,
139139
fn_stats: ~[(~str, uint, uint)] // (ident, time-in-ms, llvm-instructions)
140140
}
141141

src/librustc/middle/trans/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl CrateContext {
220220
n_inlines: Cell::new(0u),
221221
n_closures: Cell::new(0u),
222222
n_llvm_insns: Cell::new(0u),
223-
llvm_insns: HashMap::new(),
223+
llvm_insns: RefCell::new(HashMap::new()),
224224
fn_stats: ~[]
225225
},
226226
tydesc_type: tydesc_type,

0 commit comments

Comments
 (0)