1
Fork 0

librustc: De-@mut FunctionContext::llenv

This commit is contained in:
Patrick Walton 2013-12-20 20:33:22 -08:00
parent c909c34b5d
commit d7392bd3ae
3 changed files with 7 additions and 7 deletions

View file

@ -69,7 +69,7 @@ use util::sha2::Sha256;
use middle::trans::type_::Type;
use std::c_str::ToCStr;
use std::cell::RefCell;
use std::cell::{Cell, RefCell};
use std::hashmap::HashMap;
use std::libc::c_uint;
use std::vec;
@ -1683,7 +1683,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
let fcx = @mut FunctionContext {
llfn: llfndecl,
llenv: unsafe {
llvm::LLVMGetUndef(Type::i8p().to_ref())
Cell::new(llvm::LLVMGetUndef(Type::i8p().to_ref()))
},
llretptr: None,
entry_bcx: None,
@ -1702,9 +1702,9 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
ccx: ccx,
debug_context: debug_context,
};
fcx.llenv = unsafe {
fcx.llenv.set(unsafe {
llvm::LLVMGetParam(llfndecl, fcx.env_arg_pos() as c_uint)
};
});
unsafe {
let entry_bcx = top_scope_block(fcx, opt_node_info);
@ -1759,7 +1759,7 @@ pub fn create_llargs_for_fn_args(cx: @mut FunctionContext,
match self_arg {
impl_self(tt, self_mode) => {
cx.llself = Some(ValSelfData {
v: cx.llenv,
v: cx.llenv.get(),
t: tt,
is_copy: self_mode == ty::ByCopy
});

View file

@ -307,7 +307,7 @@ pub fn load_environment(fcx: @mut FunctionContext,
let bcx = fcx.entry_bcx.unwrap();
// Load a pointer to the closure data, skipping over the box header:
let llcdata = opaque_box_body(bcx, cdata_ty, fcx.llenv);
let llcdata = opaque_box_body(bcx, cdata_ty, fcx.llenv.get());
// Store the pointer to closure data in an alloca for debug info because that's what the
// llvm.dbg.declare intrinsic expects

View file

@ -206,7 +206,7 @@ pub struct FunctionContext {
// The implicit environment argument that arrives in the function we're
// creating.
llenv: ValueRef,
llenv: Cell<ValueRef>,
// The place to store the return value. If the return type is immediate,
// this is an alloca in the function. Otherwise, it's the hidden first