Skip to content

Commit 00a34c9

Browse files
committed
---
yaml --- r: 97022 b: refs/heads/dist-snap c: ea5368c h: refs/heads/master v: v3
1 parent 0a3c379 commit 00a34c9

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
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 2c3f92699e1f01301739cb78e3dd567363231d2c
9+
refs/heads/dist-snap: ea5368ce6e5eb1c9b28e3e072dca4f0b063f15b2
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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)