Skip to content

Commit 97ceac7

Browse files
committed
librustc: De-@mut n_llvm_insns in the stats
1 parent 21e4e41 commit 97ceac7

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'a> StatRecorder<'a> {
146146
} else {
147147
0
148148
};
149-
let istart = ccx.stats.n_llvm_insns;
149+
let istart = ccx.stats.n_llvm_insns.get();
150150
StatRecorder {
151151
ccx: ccx,
152152
name: name,
@@ -162,13 +162,13 @@ impl<'a> Drop for StatRecorder<'a> {
162162
if self.ccx.sess.trans_stats() {
163163
let end = time::precise_time_ns();
164164
let elapsed = ((end - self.start) / 1_000_000) as uint;
165-
let iend = self.ccx.stats.n_llvm_insns;
165+
let iend = self.ccx.stats.n_llvm_insns.get();
166166
self.ccx.stats.fn_stats.push((self.name.to_owned(),
167167
elapsed,
168168
iend - self.istart));
169169
self.ccx.stats.n_fns.set(self.ccx.stats.n_fns.get() + 1);
170170
// Reset LLVM insn count to avoid compound costs.
171-
self.ccx.stats.n_llvm_insns = self.istart;
171+
self.ccx.stats.n_llvm_insns.set(self.istart);
172172
}
173173
}
174174
}

src/librustc/middle/trans/builder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ impl Builder {
4747

4848
pub fn count_insn(&self, category: &str) {
4949
if self.ccx.sess.trans_stats() {
50-
self.ccx.stats.n_llvm_insns += 1;
50+
self.ccx.stats.n_llvm_insns.set(self.ccx
51+
.stats
52+
.n_llvm_insns
53+
.get() + 1);
5154
}
5255
if self.ccx.sess.count_llvm_insns() {
5356
base::with_insn_ctxt(|v| {

src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ pub struct Stats {
134134
n_monos: Cell<uint>,
135135
n_inlines: Cell<uint>,
136136
n_closures: Cell<uint>,
137-
n_llvm_insns: uint,
137+
n_llvm_insns: Cell<uint>,
138138
llvm_insn_ctxt: ~[~str],
139139
llvm_insns: HashMap<~str, uint>,
140140
fn_stats: ~[(~str, uint, uint)] // (ident, time-in-ms, llvm-instructions)

src/librustc/middle/trans/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl CrateContext {
219219
n_monos: Cell::new(0u),
220220
n_inlines: Cell::new(0u),
221221
n_closures: Cell::new(0u),
222-
n_llvm_insns: 0u,
222+
n_llvm_insns: Cell::new(0u),
223223
llvm_insn_ctxt: ~[],
224224
llvm_insns: HashMap::new(),
225225
fn_stats: ~[]

0 commit comments

Comments
 (0)