Skip to content

Commit f0ea40b

Browse files
committed
---
yaml --- r: 88890 b: refs/heads/snap-stage3 c: df7f137 h: refs/heads/master v: v3
1 parent 223080f commit f0ea40b

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-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: 610096d8c80275726183919a96a1f0c886acdb0e
4+
refs/heads/snap-stage3: df7f1374d7a3bdf5a17c069e932d1f2f26ef000d
55
refs/heads/try: b160761e35efcd1207112b3b782c06633cf441a8
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use middle::typeck;
2222
use middle;
2323

2424
use std::cast;
25+
use std::cell::RefCell;
2526
use std::hashmap::{HashMap, HashSet};
2627
use std::io::mem::MemWriter;
2728
use std::io::{Writer, Seek, Decorator};
@@ -59,7 +60,7 @@ pub struct EncodeParams<'a> {
5960
diag: @mut span_handler,
6061
tcx: ty::ctxt,
6162
reexports2: middle::resolve::ExportMap2,
62-
item_symbols: &'a HashMap<ast::NodeId, ~str>,
63+
item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
6364
discrim_symbols: &'a HashMap<ast::NodeId, @str>,
6465
non_inlineable_statics: &'a HashSet<ast::NodeId>,
6566
link_meta: &'a LinkMeta,
@@ -89,7 +90,7 @@ pub struct EncodeContext<'a> {
8990
tcx: ty::ctxt,
9091
stats: @mut Stats,
9192
reexports2: middle::resolve::ExportMap2,
92-
item_symbols: &'a HashMap<ast::NodeId, ~str>,
93+
item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
9394
discrim_symbols: &'a HashMap<ast::NodeId, @str>,
9495
non_inlineable_statics: &'a HashSet<ast::NodeId>,
9596
link_meta: &'a LinkMeta,
@@ -283,7 +284,8 @@ fn encode_symbol(ecx: &EncodeContext,
283284
ebml_w: &mut writer::Encoder,
284285
id: NodeId) {
285286
ebml_w.start_tag(tag_items_data_item_symbol);
286-
match ecx.item_symbols.find(&id) {
287+
let item_symbols = ecx.item_symbols.borrow();
288+
match item_symbols.get().find(&id) {
287289
Some(x) => {
288290
debug!("encode_symbol(id={:?}, str={})", id, *x);
289291
ebml_w.writer.write(x.as_bytes());
@@ -763,7 +765,8 @@ fn encode_info_for_struct_ctor(ecx: &EncodeContext,
763765
encode_path(ecx, ebml_w, path, ast_map::path_name(name));
764766
encode_parent_item(ebml_w, local_def(struct_id));
765767

766-
if ecx.item_symbols.contains_key(&ctor_id) {
768+
let item_symbols = ecx.item_symbols.borrow();
769+
if item_symbols.get().contains_key(&ctor_id) {
767770
encode_symbol(ecx, ebml_w, ctor_id);
768771
}
769772

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,10 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
22892289

22902290
fn finish_register_fn(ccx: @mut CrateContext, sp: Span, sym: ~str, node_id: ast::NodeId,
22912291
llfn: ValueRef) {
2292-
ccx.item_symbols.insert(node_id, sym);
2292+
{
2293+
let mut item_symbols = ccx.item_symbols.borrow_mut();
2294+
item_symbols.get().insert(node_id, sym);
2295+
}
22932296

22942297
if !ccx.reachable.contains(&node_id) {
22952298
lib::llvm::SetLinkage(llfn, lib::llvm::InternalLinkage);
@@ -2537,7 +2540,10 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
25372540
debug!("{} not inlined", sym);
25382541
ccx.non_inlineable_statics.insert(id);
25392542
}
2540-
ccx.item_symbols.insert(i.id, sym);
2543+
2544+
let mut item_symbols = ccx.item_symbols
2545+
.borrow_mut();
2546+
item_symbols.get().insert(i.id, sym);
25412547
g
25422548
}
25432549
}
@@ -3195,7 +3201,8 @@ pub fn trans_crate(sess: session::Session,
31953201
let link_meta = ccx.link_meta.clone();
31963202
let llmod = ccx.llmod;
31973203
let mut reachable = ccx.reachable.iter().filter_map(|id| {
3198-
ccx.item_symbols.find(id).map(|s| s.to_owned())
3204+
let item_symbols = ccx.item_symbols.borrow();
3205+
item_symbols.get().find(id).map(|s| s.to_owned())
31993206
}).to_owned_vec();
32003207

32013208
// Make sure that some other crucial symbols are not eliminated from the

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct CrateContext {
5050
item_vals: RefCell<HashMap<ast::NodeId, ValueRef>>,
5151
exp_map2: resolve::ExportMap2,
5252
reachable: @mut HashSet<ast::NodeId>,
53-
item_symbols: HashMap<ast::NodeId, ~str>,
53+
item_symbols: RefCell<HashMap<ast::NodeId, ~str>>,
5454
link_meta: LinkMeta,
5555
enum_sizes: HashMap<ty::t, uint>,
5656
discrims: HashMap<ast::DefId, ValueRef>,
@@ -190,7 +190,7 @@ impl CrateContext {
190190
item_vals: RefCell::new(HashMap::new()),
191191
exp_map2: emap2,
192192
reachable: reachable,
193-
item_symbols: HashMap::new(),
193+
item_symbols: RefCell::new(HashMap::new()),
194194
link_meta: link_meta,
195195
enum_sizes: HashMap::new(),
196196
discrims: HashMap::new(),

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ pub fn trans_foreign_mod(ccx: @mut CrateContext,
360360
}
361361

362362
let lname = link_name(ccx, foreign_item);
363-
ccx.item_symbols.insert(foreign_item.id, lname.to_owned());
363+
let mut item_symbols = ccx.item_symbols.borrow_mut();
364+
item_symbols.get().insert(foreign_item.id, lname.to_owned());
364365
}
365366
}
366367

0 commit comments

Comments
 (0)