Skip to content

Commit 008a6de

Browse files
committed
---
yaml --- r: 97152 b: refs/heads/dist-snap c: 9f67069 h: refs/heads/master v: v3
1 parent 8577238 commit 008a6de

File tree

4 files changed

+20
-13
lines changed

4 files changed

+20
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: e84f79feb17d0b17f5898b5df934c3a5588eb4cf
9+
refs/heads/dist-snap: 9f6706975b3cca6bcf13e353eb47e238d65d5fe9
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ impl<'a> Drop for StatRecorder<'a> {
163163
let end = time::precise_time_ns();
164164
let elapsed = ((end - self.start) / 1_000_000) as uint;
165165
let iend = self.ccx.stats.n_llvm_insns.get();
166-
self.ccx.stats.fn_stats.push((self.name.to_owned(),
167-
elapsed,
168-
iend - self.istart));
166+
{
167+
let mut fn_stats = self.ccx.stats.fn_stats.borrow_mut();
168+
fn_stats.get().push((self.name.to_owned(),
169+
elapsed,
170+
iend - self.istart));
171+
}
169172
self.ccx.stats.n_fns.set(self.ccx.stats.n_fns.get() + 1);
170173
// Reset LLVM insn count to avoid compound costs.
171174
self.ccx.stats.n_llvm_insns.set(self.istart);
@@ -3256,13 +3259,16 @@ pub fn trans_crate(sess: session::Session,
32563259
println!("n_inlines: {}", ccx.stats.n_inlines.get());
32573260
println!("n_closures: {}", ccx.stats.n_closures.get());
32583261
println("fn stats:");
3259-
3260-
ccx.stats.fn_stats.sort_by(|&(_, _, insns_a), &(_, _, insns_b)| insns_b.cmp(&insns_a));
3261-
3262-
for tuple in ccx.stats.fn_stats.iter() {
3263-
match *tuple {
3264-
(ref name, ms, insns) => {
3265-
println!("{} insns, {} ms, {}", insns, ms, *name);
3262+
{
3263+
let mut fn_stats = ccx.stats.fn_stats.borrow_mut();
3264+
fn_stats.get().sort_by(|&(_, _, insns_a), &(_, _, insns_b)| {
3265+
insns_b.cmp(&insns_a)
3266+
});
3267+
for tuple in fn_stats.get().iter() {
3268+
match *tuple {
3269+
(ref name, ms, insns) => {
3270+
println!("{} insns, {} ms, {}", insns, ms, *name);
3271+
}
32663272
}
32673273
}
32683274
}

branches/dist-snap/src/librustc/middle/trans/common.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ pub struct Stats {
136136
n_closures: Cell<uint>,
137137
n_llvm_insns: Cell<uint>,
138138
llvm_insns: RefCell<HashMap<~str, uint>>,
139-
fn_stats: ~[(~str, uint, uint)] // (ident, time-in-ms, llvm-instructions)
139+
// (ident, time-in-ms, llvm-instructions)
140+
fn_stats: RefCell<~[(~str, uint, uint)]>,
140141
}
141142

142143
pub struct BuilderRef_res {

branches/dist-snap/src/librustc/middle/trans/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl CrateContext {
221221
n_closures: Cell::new(0u),
222222
n_llvm_insns: Cell::new(0u),
223223
llvm_insns: RefCell::new(HashMap::new()),
224-
fn_stats: ~[]
224+
fn_stats: RefCell::new(~[]),
225225
},
226226
tydesc_type: tydesc_type,
227227
int_type: int_type,

0 commit comments

Comments
 (0)