File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed
trunk/src/librustc/middle/trans Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 37e3f2fe63a9e0a41d5ebca7d276401599f3e636
2
+ refs/heads/master: 1185fcc437e13cd1d492509361c29d05ee2548f6
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5
5
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ pub struct CrateContext {
89
89
// Cache of external const values
90
90
extern_const_values : RefCell < HashMap < ast:: DefId , ValueRef > > ,
91
91
92
- impl_method_cache : HashMap < ( ast:: DefId , ast:: Name ) , ast:: DefId > ,
92
+ impl_method_cache : RefCell < HashMap < ( ast:: DefId , ast:: Name ) , ast:: DefId > > ,
93
93
94
94
module_data : HashMap < ~str , ValueRef > ,
95
95
lltypes : HashMap < ty:: t , Type > ,
@@ -201,7 +201,7 @@ impl CrateContext {
201
201
const_globals : RefCell :: new ( HashMap :: new ( ) ) ,
202
202
const_values : RefCell :: new ( HashMap :: new ( ) ) ,
203
203
extern_const_values : RefCell :: new ( HashMap :: new ( ) ) ,
204
- impl_method_cache : HashMap :: new ( ) ,
204
+ impl_method_cache : RefCell :: new ( HashMap :: new ( ) ) ,
205
205
module_data : HashMap :: new ( ) ,
206
206
lltypes : HashMap :: new ( ) ,
207
207
llsizingtypes : HashMap :: new ( ) ,
Original file line number Diff line number Diff line change @@ -296,18 +296,22 @@ pub fn trans_static_method_callee(bcx: @Block,
296
296
pub fn method_with_name ( ccx : & mut CrateContext ,
297
297
impl_id : ast:: DefId ,
298
298
name : ast:: Name ) -> ast:: DefId {
299
- let meth_id_opt = ccx. impl_method_cache . find_copy ( & ( impl_id, name) ) ;
300
- match meth_id_opt {
301
- Some ( m) => return m,
302
- None => { }
299
+ {
300
+ let impl_method_cache = ccx. impl_method_cache . borrow ( ) ;
301
+ let meth_id_opt = impl_method_cache. get ( ) . find_copy ( & ( impl_id, name) ) ;
302
+ match meth_id_opt {
303
+ Some ( m) => return m,
304
+ None => { }
305
+ }
303
306
}
304
307
305
308
let imp = ccx. tcx . impls . find ( & impl_id)
306
309
. expect ( "could not find impl while translating" ) ;
307
310
let meth = imp. methods . iter ( ) . find ( |m| m. ident . name == name)
308
311
. expect ( "could not find method while translating" ) ;
309
312
310
- ccx. impl_method_cache . insert ( ( impl_id, name) , meth. def_id ) ;
313
+ let mut impl_method_cache = ccx. impl_method_cache . borrow_mut ( ) ;
314
+ impl_method_cache. get ( ) . insert ( ( impl_id, name) , meth. def_id ) ;
311
315
meth. def_id
312
316
}
313
317
You can’t perform that action at this time.
0 commit comments