File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -521,14 +521,18 @@ pub fn symbol_hash(tcx: ty::ctxt,
521
521
}
522
522
523
523
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
+ }
531
530
}
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
532
536
}
533
537
534
538
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ pub struct CrateContext {
96
96
llsizingtypes : RefCell < HashMap < ty:: t , Type > > ,
97
97
adt_reprs : RefCell < HashMap < ty:: t , @adt:: Repr > > ,
98
98
symbol_hasher : Sha256 ,
99
- type_hashcodes : HashMap < ty:: t , @str > ,
99
+ type_hashcodes : RefCell < HashMap < ty:: t , @str > > ,
100
100
type_short_names : HashMap < ty:: t , ~str > ,
101
101
all_llvm_symbols : HashSet < @str > ,
102
102
tcx : ty:: ctxt ,
@@ -207,7 +207,7 @@ impl CrateContext {
207
207
llsizingtypes : RefCell :: new ( HashMap :: new ( ) ) ,
208
208
adt_reprs : RefCell :: new ( HashMap :: new ( ) ) ,
209
209
symbol_hasher : symbol_hasher,
210
- type_hashcodes : HashMap :: new ( ) ,
210
+ type_hashcodes : RefCell :: new ( HashMap :: new ( ) ) ,
211
211
type_short_names : HashMap :: new ( ) ,
212
212
all_llvm_symbols : HashSet :: new ( ) ,
213
213
tcx : tcx,
You can’t perform that action at this time.
0 commit comments