librustc: De-@mut CrateContext::non_inlineable_statics

This commit is contained in:
Patrick Walton 2013-12-18 18:11:41 -08:00
parent 02bdda2776
commit b5aa6eb69f
4 changed files with 18 additions and 7 deletions

View file

@ -61,7 +61,7 @@ pub struct EncodeParams<'a> {
tcx: ty::ctxt,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
non_inlineable_statics: &'a HashSet<ast::NodeId>,
non_inlineable_statics: &'a RefCell<HashSet<ast::NodeId>>,
link_meta: &'a LinkMeta,
cstore: @mut cstore::CStore,
encode_inlined_item: encode_inlined_item<'a>,
@ -90,7 +90,7 @@ pub struct EncodeContext<'a> {
stats: @mut Stats,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'a RefCell<HashMap<ast::NodeId, ~str>>,
non_inlineable_statics: &'a HashSet<ast::NodeId>,
non_inlineable_statics: &'a RefCell<HashSet<ast::NodeId>>,
link_meta: &'a LinkMeta,
cstore: &'a cstore::CStore,
encode_inlined_item: encode_inlined_item<'a>,
@ -923,7 +923,14 @@ fn encode_info_for_item(ecx: &EncodeContext,
encode_name(ecx, ebml_w, item.ident);
let elt = ast_map::path_pretty_name(item.ident, item.id as u64);
encode_path(ecx, ebml_w, path, elt);
if !ecx.non_inlineable_statics.contains(&item.id) {
let non_inlineable;
{
let non_inlineable_statics = ecx.non_inlineable_statics.borrow();
non_inlineable = non_inlineable_statics.get().contains(&item.id);
}
if !non_inlineable {
(ecx.encode_inlined_item)(ecx, ebml_w, path, ii_item(item));
}
encode_visibility(ebml_w, vis);

View file

@ -2545,7 +2545,10 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
if !inlineable {
debug!("{} not inlined", sym);
ccx.non_inlineable_statics.insert(id);
let mut non_inlineable_statics =
ccx.non_inlineable_statics
.borrow_mut();
non_inlineable_statics.get().insert(id);
}
let mut item_symbols = ccx.item_symbols

View file

@ -176,8 +176,9 @@ pub fn get_const_val(cx: @mut CrateContext,
}
let const_values = cx.const_values.borrow();
let non_inlineable_statics = cx.non_inlineable_statics.borrow();
(const_values.get().get_copy(&def_id.node),
!cx.non_inlineable_statics.contains(&def_id.node))
!non_inlineable_statics.get().contains(&def_id.node))
}
pub fn const_expr(cx: @mut CrateContext, e: &ast::Expr) -> (ValueRef, bool) {

View file

@ -64,7 +64,7 @@ pub struct CrateContext {
// A set of static items which cannot be inlined into other crates. This
// will pevent in ii_item() structures from being encoded into the metadata
// that is generated
non_inlineable_statics: HashSet<ast::NodeId>,
non_inlineable_statics: RefCell<HashSet<ast::NodeId>>,
// Cache instances of monomorphized functions
monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
monomorphizing: RefCell<HashMap<ast::DefId, uint>>,
@ -192,7 +192,7 @@ impl CrateContext {
finished_tydescs: false,
external: HashMap::new(),
external_srcs: HashMap::new(),
non_inlineable_statics: HashSet::new(),
non_inlineable_statics: RefCell::new(HashSet::new()),
monomorphized: RefCell::new(HashMap::new()),
monomorphizing: RefCell::new(HashMap::new()),
vtables: RefCell::new(HashMap::new()),