Skip to content

Commit 7437a56

Browse files
committed
librustc: De-@mut FunctionContext::entry_bcx
1 parent 05e57db commit 7437a56

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ pub fn make_return_pointer(fcx: @mut FunctionContext, output_type: ty::t) -> Val
16411641
llvm::LLVMGetParam(fcx.llfn, 0)
16421642
} else {
16431643
let lloutputtype = type_of::type_of(fcx.ccx, output_type);
1644-
let bcx = fcx.entry_bcx.unwrap();
1644+
let bcx = fcx.entry_bcx.get().unwrap();
16451645
Alloca(bcx, lloutputtype, "__make_return_pointer")
16461646
}
16471647
}
@@ -1686,7 +1686,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
16861686
Cell::new(llvm::LLVMGetUndef(Type::i8p().to_ref()))
16871687
},
16881688
llretptr: Cell::new(None),
1689-
entry_bcx: None,
1689+
entry_bcx: RefCell::new(None),
16901690
alloca_insert_pt: Cell::new(None),
16911691
llreturn: Cell::new(None),
16921692
llself: Cell::new(None),
@@ -1710,7 +1710,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
17101710
let entry_bcx = top_scope_block(fcx, opt_node_info);
17111711
Load(entry_bcx, C_null(Type::i8p()));
17121712

1713-
fcx.entry_bcx = Some(entry_bcx);
1713+
fcx.entry_bcx.set(Some(entry_bcx));
17141714
fcx.alloca_insert_pt.set(Some(
17151715
llvm::LLVMGetFirstInstruction(entry_bcx.llbb)));
17161716
}
@@ -1921,7 +1921,7 @@ pub fn trans_closure(ccx: @CrateContext,
19211921

19221922
// Create the first basic block in the function and keep a handle on it to
19231923
// pass to finish_fn later.
1924-
let bcx_top = fcx.entry_bcx.unwrap();
1924+
let bcx_top = fcx.entry_bcx.get().unwrap();
19251925
let mut bcx = bcx_top;
19261926
let block_ty = node_id_type(bcx, body.id);
19271927

@@ -2136,7 +2136,7 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
21362136

21372137
let raw_llargs = create_llargs_for_fn_args(fcx, no_self, fn_args);
21382138

2139-
let bcx = fcx.entry_bcx.unwrap();
2139+
let bcx = fcx.entry_bcx.get().unwrap();
21402140

21412141
insert_synthetic_type_entries(bcx, fn_args, arg_tys);
21422142
let bcx = copy_args_to_allocas(fcx, bcx, fn_args, raw_llargs, arg_tys);

src/librustc/middle/trans/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub fn load_environment(fcx: @mut FunctionContext,
304304
return;
305305
}
306306

307-
let bcx = fcx.entry_bcx.unwrap();
307+
let bcx = fcx.entry_bcx.get().unwrap();
308308

309309
// Load a pointer to the closure data, skipping over the box header:
310310
let llcdata = opaque_box_body(bcx, cdata_ty, fcx.llenv.get());

src/librustc/middle/trans/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ pub struct FunctionContext {
214214
// always be Some.
215215
llretptr: Cell<Option<ValueRef>>,
216216

217-
entry_bcx: Option<@Block>,
217+
entry_bcx: RefCell<Option<@Block>>,
218218

219219
// These elements: "hoisted basic blocks" containing
220220
// administrative activities that have to happen in only one place in
@@ -296,7 +296,7 @@ impl FunctionContext {
296296
.unwrap());
297297
}
298298
// Remove the cycle between fcx and bcx, so memory can be freed
299-
self.entry_bcx = None;
299+
self.entry_bcx.set(None);
300300
}
301301

302302
pub fn get_llreturn(&mut self) -> BasicBlockRef {

src/librustc/middle/trans/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ pub fn make_generic_glue_inner(ccx: @CrateContext,
669669
// llfn is expected be declared to take a parameter of the appropriate
670670
// type, so we don't need to explicitly cast the function parameter.
671671

672-
let bcx = fcx.entry_bcx.unwrap();
672+
let bcx = fcx.entry_bcx.get().unwrap();
673673
let rawptr0_arg = fcx.arg_pos(0u);
674674
let llrawptr0 = unsafe { llvm::LLVMGetParam(llfn, rawptr0_arg as c_uint) };
675675
let bcx = helper(bcx, llrawptr0, t);

src/librustc/middle/trans/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
148148

149149
set_always_inline(fcx.llfn);
150150

151-
let mut bcx = fcx.entry_bcx.unwrap();
151+
let mut bcx = fcx.entry_bcx.get().unwrap();
152152
let first_real_arg = fcx.arg_pos(0u);
153153

154154
let nm = ccx.sess.str_of(item.ident);

src/librustc/middle/trans/reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ impl Reflector {
306306
//
307307
llvm::LLVMGetParam(llfdecl, fcx.arg_pos(0u) as c_uint)
308308
};
309-
let mut bcx = fcx.entry_bcx.unwrap();
309+
let mut bcx = fcx.entry_bcx.get().unwrap();
310310
let arg = BitCast(bcx, arg, llptrty);
311311
let ret = adt::trans_get_discr(bcx, repr, arg, Some(Type::i64()));
312312
Store(bcx, ret, fcx.llretptr.get().unwrap());

0 commit comments

Comments
 (0)