Skip to content

Commit 55ca388

Browse files
committed
---
yaml --- r: 88946 b: refs/heads/snap-stage3 c: ea5368c h: refs/heads/master v: v3
1 parent 8aafe2a commit 55ca388

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: deeca5d586bfaa4aa60246f671a8d611d38f6248
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2c3f92699e1f01301739cb78e3dd567363231d2c
4+
refs/heads/snap-stage3: ea5368ce6e5eb1c9b28e3e072dca4f0b063f15b2
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/metadata/tydecode.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,15 +380,21 @@ fn parse_ty(st: &mut PState, conv: conv_did) -> ty::t {
380380
let key = ty::creader_cache_key {cnum: st.crate,
381381
pos: pos,
382382
len: len };
383-
match st.tcx.rcache.find(&key) {
384-
Some(&tt) => return tt,
383+
384+
let tt_opt = {
385+
let rcache = st.tcx.rcache.borrow();
386+
rcache.get().find_copy(&key)
387+
};
388+
match tt_opt {
389+
Some(tt) => return tt,
385390
None => {
386391
let mut ps = PState {
387392
pos: pos,
388393
.. *st
389394
};
390395
let tt = parse_ty(&mut ps, |x,y| conv(x,y));
391-
st.tcx.rcache.insert(key, tt);
396+
let mut rcache = st.tcx.rcache.borrow_mut();
397+
rcache.get().insert(key, tt);
392398
return tt;
393399
}
394400
}

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ pub struct creader_cache_key {
174174
len: uint
175175
}
176176

177-
type creader_cache = @mut HashMap<creader_cache_key, t>;
177+
type creader_cache = RefCell<HashMap<creader_cache_key, t>>;
178178

179179
struct intern_key {
180180
sty: *sty,
@@ -957,10 +957,6 @@ type type_cache = RefCell<HashMap<ast::DefId, ty_param_bounds_and_ty>>;
957957

958958
pub type node_type_table = @mut HashMap<uint,t>;
959959

960-
fn mk_rcache() -> creader_cache {
961-
return @mut HashMap::new();
962-
}
963-
964960
pub fn mk_ctxt(s: session::Session,
965961
dm: resolve::DefMap,
966962
named_region_map: @mut resolve_lifetime::NamedRegionMap,
@@ -987,7 +983,7 @@ pub fn mk_ctxt(s: session::Session,
987983
intrinsic_defs: RefCell::new(HashMap::new()),
988984
freevars: freevars,
989985
tcache: RefCell::new(HashMap::new()),
990-
rcache: mk_rcache(),
986+
rcache: RefCell::new(HashMap::new()),
991987
short_names_cache: RefCell::new(HashMap::new()),
992988
needs_unwind_cleanup_cache: RefCell::new(HashMap::new()),
993989
tc_cache: RefCell::new(HashMap::new()),

0 commit comments

Comments
 (0)