librustc: De-@mut lltypes.
This commit is contained in:
parent
8c194a0136
commit
06805209e4
2 changed files with 13 additions and 8 deletions
|
|
@ -92,7 +92,7 @@ pub struct CrateContext {
|
|||
impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
|
||||
|
||||
module_data: RefCell<HashMap<~str, ValueRef>>,
|
||||
lltypes: HashMap<ty::t, Type>,
|
||||
lltypes: RefCell<HashMap<ty::t, Type>>,
|
||||
llsizingtypes: HashMap<ty::t, Type>,
|
||||
adt_reprs: HashMap<ty::t, @adt::Repr>,
|
||||
symbol_hasher: Sha256,
|
||||
|
|
@ -203,7 +203,7 @@ impl CrateContext {
|
|||
extern_const_values: RefCell::new(HashMap::new()),
|
||||
impl_method_cache: RefCell::new(HashMap::new()),
|
||||
module_data: RefCell::new(HashMap::new()),
|
||||
lltypes: HashMap::new(),
|
||||
lltypes: RefCell::new(HashMap::new()),
|
||||
llsizingtypes: HashMap::new(),
|
||||
adt_reprs: HashMap::new(),
|
||||
symbol_hasher: symbol_hasher,
|
||||
|
|
|
|||
|
|
@ -173,11 +173,12 @@ pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
|
|||
// NB: If you update this, be sure to update `sizing_type_of()` as well.
|
||||
pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
|
||||
// Check the cache.
|
||||
match cx.lltypes.find(&t) {
|
||||
Some(&llty) => {
|
||||
return llty;
|
||||
{
|
||||
let lltypes = cx.lltypes.borrow();
|
||||
match lltypes.get().find(&t) {
|
||||
Some(&llty) => return llty,
|
||||
None => ()
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
|
||||
debug!("type_of {} {:?}", t.repr(cx.tcx), t);
|
||||
|
|
@ -197,7 +198,8 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
|
|||
t_norm.repr(cx.tcx),
|
||||
t_norm,
|
||||
cx.tn.type_to_str(llty));
|
||||
cx.lltypes.insert(t, llty);
|
||||
let mut lltypes = cx.lltypes.borrow_mut();
|
||||
lltypes.get().insert(t, llty);
|
||||
return llty;
|
||||
}
|
||||
|
||||
|
|
@ -316,7 +318,10 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
|
|||
t.repr(cx.tcx),
|
||||
t,
|
||||
cx.tn.type_to_str(llty));
|
||||
cx.lltypes.insert(t, llty);
|
||||
{
|
||||
let mut lltypes = cx.lltypes.borrow_mut();
|
||||
lltypes.get().insert(t, llty);
|
||||
}
|
||||
|
||||
// If this was an enum or struct, fill in the type now.
|
||||
match ty::get(t).sty {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue