librustc: De-@mut CrateContext::adt_reprs

This commit is contained in:
Patrick Walton 2013-12-18 17:58:24 -08:00
parent db83a957b6
commit a1747a6091
2 changed files with 11 additions and 6 deletions
src/librustc/middle/trans

@ -118,13 +118,18 @@ pub fn represent_node(bcx: @Block, node: ast::NodeId) -> @Repr {
/// Decides how to represent a given type.
pub fn represent_type(cx: &mut CrateContext, t: ty::t) -> @Repr {
debug!("Representing: {}", ty_to_str(cx.tcx, t));
match cx.adt_reprs.find(&t) {
Some(repr) => return *repr,
None => { }
{
let adt_reprs = cx.adt_reprs.borrow();
match adt_reprs.get().find(&t) {
Some(repr) => return *repr,
None => {}
}
}
let repr = @represent_type_uncached(cx, t);
debug!("Represented as: {:?}", repr)
cx.adt_reprs.insert(t, repr);
let mut adt_reprs = cx.adt_reprs.borrow_mut();
adt_reprs.get().insert(t, repr);
return repr;
}

@ -94,7 +94,7 @@ pub struct CrateContext {
module_data: RefCell<HashMap<~str, ValueRef>>,
lltypes: RefCell<HashMap<ty::t, Type>>,
llsizingtypes: RefCell<HashMap<ty::t, Type>>,
adt_reprs: HashMap<ty::t, @adt::Repr>,
adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
symbol_hasher: Sha256,
type_hashcodes: HashMap<ty::t, @str>,
type_short_names: HashMap<ty::t, ~str>,
@ -205,7 +205,7 @@ impl CrateContext {
module_data: RefCell::new(HashMap::new()),
lltypes: RefCell::new(HashMap::new()),
llsizingtypes: RefCell::new(HashMap::new()),
adt_reprs: HashMap::new(),
adt_reprs: RefCell::new(HashMap::new()),
symbol_hasher: symbol_hasher,
type_hashcodes: HashMap::new(),
type_short_names: HashMap::new(),