Skip to content

Commit fb50ef6

Browse files
committed
---
yaml --- r: 88894 b: refs/heads/snap-stage3 c: 0e2041c h: refs/heads/master v: v3
1 parent dd3867b commit fb50ef6

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-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: 13f85cb097725a13ae24a6564c71597243b91c3d
4+
refs/heads/snap-stage3: 0e2041c54b3065cc285ae19744e8acbff7533890
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/trans/common.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,12 @@ pub fn C_u8(i: uint) -> ValueRef {
890890
// our boxed-and-length-annotated strings.
891891
pub fn C_cstr(cx: &mut CrateContext, s: @str) -> ValueRef {
892892
unsafe {
893-
match cx.const_cstr_cache.find_equiv(&s) {
894-
Some(&llval) => return llval,
895-
None => ()
893+
{
894+
let const_cstr_cache = cx.const_cstr_cache.borrow();
895+
match const_cstr_cache.get().find_equiv(&s) {
896+
Some(&llval) => return llval,
897+
None => ()
898+
}
896899
}
897900

898901
let sc = llvm::LLVMConstStringInContext(cx.llcx,
@@ -907,9 +910,9 @@ pub fn C_cstr(cx: &mut CrateContext, s: @str) -> ValueRef {
907910
llvm::LLVMSetGlobalConstant(g, True);
908911
lib::llvm::SetLinkage(g, lib::llvm::InternalLinkage);
909912

910-
cx.const_cstr_cache.insert(s, g);
911-
912-
return g;
913+
let mut const_cstr_cache = cx.const_cstr_cache.borrow_mut();
914+
const_cstr_cache.get().insert(s, g);
915+
g
913916
}
914917
}
915918

branches/snap-stage3/src/librustc/middle/trans/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub struct CrateContext {
7171
// Cache generated vtables
7272
vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
7373
// Cache of constant strings,
74-
const_cstr_cache: HashMap<@str, ValueRef>,
74+
const_cstr_cache: RefCell<HashMap<@str, ValueRef>>,
7575

7676
// Reverse-direction for const ptrs cast from globals.
7777
// Key is an int, cast from a ValueRef holding a *T,
@@ -197,7 +197,7 @@ impl CrateContext {
197197
monomorphized: RefCell::new(HashMap::new()),
198198
monomorphizing: RefCell::new(HashMap::new()),
199199
vtables: RefCell::new(HashMap::new()),
200-
const_cstr_cache: HashMap::new(),
200+
const_cstr_cache: RefCell::new(HashMap::new()),
201201
const_globals: HashMap::new(),
202202
const_values: HashMap::new(),
203203
extern_const_values: HashMap::new(),

0 commit comments

Comments
 (0)