Skip to content

Commit a25dc78

Browse files
committed
---
yaml --- r: 90732 b: refs/heads/master c: 25337a7 h: refs/heads/master v: v3
1 parent b870019 commit a25dc78

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: a1747a609122f6bc82f396897752d182fd583d4a
2+
refs/heads/master: 25337a7f9fd824ca26faee47a4bc4aaa6e542586
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

trunk/src/librustc/back/link.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,18 @@ pub fn symbol_hash(tcx: ty::ctxt,
521521
}
522522

523523
pub fn get_symbol_hash(ccx: &mut CrateContext, t: ty::t) -> @str {
524-
match ccx.type_hashcodes.find(&t) {
525-
Some(&h) => h,
526-
None => {
527-
let hash = symbol_hash(ccx.tcx, &mut ccx.symbol_hasher, t, &ccx.link_meta);
528-
ccx.type_hashcodes.insert(t, hash);
529-
hash
530-
}
524+
{
525+
let type_hashcodes = ccx.type_hashcodes.borrow();
526+
match type_hashcodes.get().find(&t) {
527+
Some(&h) => return h,
528+
None => {}
529+
}
531530
}
531+
532+
let mut type_hashcodes = ccx.type_hashcodes.borrow_mut();
533+
let hash = symbol_hash(ccx.tcx, &mut ccx.symbol_hasher, t, &ccx.link_meta);
534+
type_hashcodes.get().insert(t, hash);
535+
hash
532536
}
533537

534538

trunk/src/librustc/middle/trans/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub struct CrateContext {
9696
llsizingtypes: RefCell<HashMap<ty::t, Type>>,
9797
adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
9898
symbol_hasher: Sha256,
99-
type_hashcodes: HashMap<ty::t, @str>,
99+
type_hashcodes: RefCell<HashMap<ty::t, @str>>,
100100
type_short_names: HashMap<ty::t, ~str>,
101101
all_llvm_symbols: HashSet<@str>,
102102
tcx: ty::ctxt,
@@ -207,7 +207,7 @@ impl CrateContext {
207207
llsizingtypes: RefCell::new(HashMap::new()),
208208
adt_reprs: RefCell::new(HashMap::new()),
209209
symbol_hasher: symbol_hasher,
210-
type_hashcodes: HashMap::new(),
210+
type_hashcodes: RefCell::new(HashMap::new()),
211211
type_short_names: HashMap::new(),
212212
all_llvm_symbols: HashSet::new(),
213213
tcx: tcx,

0 commit comments

Comments
 (0)