Skip to content

Commit 775fb86

Browse files
committed
---
yaml --- r: 88887 b: refs/heads/snap-stage3 c: b5218ba h: refs/heads/master i: 88885: 9240a77 88883: ac7e598 88879: d309cc8 v: v3
1 parent ef79d2a commit 775fb86

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
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: 6a0450c67d81c6969fa43c01d37a2f196b7d58ce
4+
refs/heads/snap-stage3: b5218ba6ad05f0c5a31575b2fe59949b3dc25129
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use middle::trans::type_::Type;
2727

2828
use util::sha2::Sha256;
2929

30+
use std::cell::RefCell;
3031
use std::c_str::ToCStr;
3132
use std::hashmap::{HashMap, HashSet};
3233
use std::local_data;
@@ -68,7 +69,7 @@ pub struct CrateContext {
6869
// that is generated
6970
non_inlineable_statics: HashSet<ast::NodeId>,
7071
// Cache instances of monomorphized functions
71-
monomorphized: HashMap<mono_id, ValueRef>,
72+
monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
7273
monomorphizing: HashMap<ast::DefId, uint>,
7374
// Cache generated vtables
7475
vtables: HashMap<(ty::t, mono_id), ValueRef>,
@@ -199,7 +200,7 @@ impl CrateContext {
199200
external: HashMap::new(),
200201
external_srcs: HashMap::new(),
201202
non_inlineable_statics: HashSet::new(),
202-
monomorphized: HashMap::new(),
203+
monomorphized: RefCell::new(HashMap::new()),
203204
monomorphizing: HashMap::new(),
204205
vtables: HashMap::new(),
205206
const_cstr_cache: HashMap::new(),

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,16 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
7676
psubsts.repr(ccx.tcx),
7777
hash_id);
7878

79-
match ccx.monomorphized.find(&hash_id) {
80-
Some(&val) => {
81-
debug!("leaving monomorphic fn {}",
82-
ty::item_path_str(ccx.tcx, fn_id));
83-
return (val, must_cast);
84-
}
85-
None => ()
79+
{
80+
let monomorphized = ccx.monomorphized.borrow();
81+
match monomorphized.get().find(&hash_id) {
82+
Some(&val) => {
83+
debug!("leaving monomorphic fn {}",
84+
ty::item_path_str(ccx.tcx, fn_id));
85+
return (val, must_cast);
86+
}
87+
None => ()
88+
}
8689
}
8790

8891
let tpt = ty::lookup_item_type(ccx.tcx, fn_id);
@@ -201,7 +204,8 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
201204

202205
let mk_lldecl = || {
203206
let lldecl = decl_internal_rust_fn(ccx, f.sig.inputs, f.sig.output, s);
204-
ccx.monomorphized.insert(hash_id, lldecl);
207+
let mut monomorphized = ccx.monomorphized.borrow_mut();
208+
monomorphized.get().insert(hash_id, lldecl);
205209
lldecl
206210
};
207211

0 commit comments

Comments
 (0)