Skip to content

Commit 2af76b1

Browse files
committed
---
yaml --- r: 88884 b: refs/heads/snap-stage3 c: 2e46ac6 h: refs/heads/master v: v3
1 parent ac7e598 commit 2af76b1

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
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: 2612d76d2276d15e30c022426d2ae5222a080b83
4+
refs/heads/snap-stage3: 2e46ac6449a48948cefeec2fa74032ff528f7871
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,27 @@ fn mywrite(w: @mut MemWriter, fmt: &fmt::Arguments) {
6060
pub fn enc_ty(w: @mut MemWriter, cx: @ctxt, t: ty::t) {
6161
match cx.abbrevs {
6262
ac_no_abbrevs => {
63-
let result_str = match cx.tcx.short_names_cache.find(&t) {
64-
Some(&s) => s,
63+
let result_str_opt;
64+
{
65+
let short_names_cache = cx.tcx.short_names_cache.borrow();
66+
result_str_opt = short_names_cache.get()
67+
.find(&t)
68+
.map(|result| *result);
69+
}
70+
let result_str = match result_str_opt {
71+
Some(s) => s,
6572
None => {
6673
let wr = @mut MemWriter::new();
6774
enc_sty(wr, cx, &ty::get(t).sty);
6875
let s = str::from_utf8(*wr.inner_ref()).to_managed();
69-
cx.tcx.short_names_cache.insert(t, s);
76+
let mut short_names_cache = cx.tcx
77+
.short_names_cache
78+
.borrow_mut();
79+
short_names_cache.get().insert(t, s);
7080
s
71-
}
72-
};
73-
w.write(result_str.as_bytes());
81+
}
82+
};
83+
w.write(result_str.as_bytes());
7484
}
7585
ac_use_abbrevs(abbrevs) => {
7686
match abbrevs.find(&t) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct ctxt_ {
307307
freevars: freevars::freevar_map,
308308
tcache: type_cache,
309309
rcache: creader_cache,
310-
short_names_cache: @mut HashMap<t, @str>,
310+
short_names_cache: RefCell<HashMap<t, @str>>,
311311
needs_unwind_cleanup_cache: @mut HashMap<t, bool>,
312312
tc_cache: @mut HashMap<uint, TypeContents>,
313313
ast_ty_to_ty_cache: @mut HashMap<NodeId, ast_ty_to_ty_cache_entry>,
@@ -993,7 +993,7 @@ pub fn mk_ctxt(s: session::Session,
993993
freevars: freevars,
994994
tcache: @mut HashMap::new(),
995995
rcache: mk_rcache(),
996-
short_names_cache: new_ty_hash(),
996+
short_names_cache: RefCell::new(HashMap::new()),
997997
needs_unwind_cleanup_cache: new_ty_hash(),
998998
tc_cache: @mut HashMap::new(),
999999
ast_ty_to_ty_cache: @mut HashMap::new(),

0 commit comments

Comments
 (0)