Skip to content

Commit e078a84

Browse files
committed
---
yaml --- r: 90722 b: refs/heads/master c: 13f85cb h: refs/heads/master v: v3
1 parent 7901dcb commit e078a84

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
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: 5dcc5165a6cabbe5dc28c6564464e655b6b43638
2+
refs/heads/master: 13f85cb097725a13ae24a6564c71597243b91c3d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub struct CrateContext {
6969
monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
7070
monomorphizing: RefCell<HashMap<ast::DefId, uint>>,
7171
// Cache generated vtables
72-
vtables: HashMap<(ty::t, mono_id), ValueRef>,
72+
vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
7373
// Cache of constant strings,
7474
const_cstr_cache: HashMap<@str, ValueRef>,
7575

@@ -196,7 +196,7 @@ impl CrateContext {
196196
non_inlineable_statics: HashSet::new(),
197197
monomorphized: RefCell::new(HashMap::new()),
198198
monomorphizing: RefCell::new(HashMap::new()),
199-
vtables: HashMap::new(),
199+
vtables: RefCell::new(HashMap::new()),
200200
const_cstr_cache: HashMap::new(),
201201
const_globals: HashMap::new(),
202202
const_values: HashMap::new(),

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,12 @@ pub fn get_vtable(bcx: @Block,
539539

540540
// Check the cache.
541541
let hash_id = (self_ty, vtable_id(ccx, &origins[0]));
542-
match ccx.vtables.find(&hash_id) {
543-
Some(&val) => { return val }
544-
None => { }
542+
{
543+
let vtables = ccx.vtables.borrow();
544+
match vtables.get().find(&hash_id) {
545+
Some(&val) => { return val }
546+
None => { }
547+
}
545548
}
546549

547550
// Not in the cache. Actually build it.
@@ -559,7 +562,9 @@ pub fn get_vtable(bcx: @Block,
559562
glue::lazily_emit_all_tydesc_glue(ccx, tydesc);
560563

561564
let vtable = make_vtable(ccx, tydesc, methods);
562-
ccx.vtables.insert(hash_id, vtable);
565+
566+
let mut vtables = ccx.vtables.borrow_mut();
567+
vtables.get().insert(hash_id, vtable);
563568
return vtable;
564569
}
565570

0 commit comments

Comments
 (0)