Skip to content

Commit 82d82c7

Browse files
committed
---
yaml --- r: 92670 b: refs/heads/auto c: 5b0401f h: refs/heads/master v: v3
1 parent 3c5d8b9 commit 82d82c7

File tree

6 files changed

+20
-17
lines changed

6 files changed

+20
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: d7392bd3aec5ca3d017745f1a47b38df9ddaf968
16+
refs/heads/auto: 5b0401f0e8a60649c7e86cdb6ecdae0afc2f67ab
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
16851685
llenv: unsafe {
16861686
Cell::new(llvm::LLVMGetUndef(Type::i8p().to_ref()))
16871687
},
1688-
llretptr: None,
1688+
llretptr: Cell::new(None),
16891689
entry_bcx: None,
16901690
alloca_insert_pt: None,
16911691
llreturn: None,
@@ -1721,7 +1721,8 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
17211721
// Otherwise, we normally allocate the llretptr, unless we
17221722
// have been instructed to skip it for immediate return
17231723
// values.
1724-
fcx.llretptr = Some(make_return_pointer(fcx, substd_output_type));
1724+
fcx.llretptr.set(Some(make_return_pointer(fcx,
1725+
substd_output_type)));
17251726
}
17261727
}
17271728
fcx
@@ -1858,11 +1859,11 @@ pub fn finish_fn(fcx: @mut FunctionContext, last_bcx: @Block) {
18581859
// Builds the return block for a function.
18591860
pub fn build_return_block(fcx: &FunctionContext, ret_cx: @Block) {
18601861
// Return the value if this function immediate; otherwise, return void.
1861-
if fcx.llretptr.is_none() || fcx.caller_expects_out_pointer {
1862+
if fcx.llretptr.get().is_none() || fcx.caller_expects_out_pointer {
18621863
return RetVoid(ret_cx);
18631864
}
18641865

1865-
let retptr = Value(fcx.llretptr.unwrap());
1866+
let retptr = Value(fcx.llretptr.get().unwrap());
18661867
let retval = match retptr.get_dominating_store(ret_cx) {
18671868
// If there's only a single store to the ret slot, we can directly return
18681869
// the value that was stored and omit the store and the alloca
@@ -1877,7 +1878,7 @@ pub fn build_return_block(fcx: &FunctionContext, ret_cx: @Block) {
18771878
retval
18781879
}
18791880
// Otherwise, load the return value from the ret slot
1880-
None => Load(ret_cx, fcx.llretptr.unwrap())
1881+
None => Load(ret_cx, fcx.llretptr.get().unwrap())
18811882
};
18821883

18831884

@@ -1943,7 +1944,7 @@ pub fn trans_closure(ccx: @CrateContext,
19431944
if body.expr.is_none() || ty::type_is_voidish(bcx.tcx(), block_ty) {
19441945
bcx = controlflow::trans_block(bcx, body, expr::Ignore);
19451946
} else {
1946-
let dest = expr::SaveIn(fcx.llretptr.unwrap());
1947+
let dest = expr::SaveIn(fcx.llretptr.get().unwrap());
19471948
bcx = controlflow::trans_block(bcx, body, dest);
19481949
}
19491950

@@ -2139,11 +2140,11 @@ pub fn trans_enum_variant_or_tuple_like_struct<A:IdAndTy>(
21392140
let bcx = copy_args_to_allocas(fcx, bcx, fn_args, raw_llargs, arg_tys);
21402141

21412142
let repr = adt::represent_type(ccx, result_ty);
2142-
adt::trans_start_init(bcx, repr, fcx.llretptr.unwrap(), disr);
2143+
adt::trans_start_init(bcx, repr, fcx.llretptr.get().unwrap(), disr);
21432144
for (i, fn_arg) in fn_args.iter().enumerate() {
21442145
let lldestptr = adt::trans_field_ptr(bcx,
21452146
repr,
2146-
fcx.llretptr.unwrap(),
2147+
fcx.llretptr.get().unwrap(),
21472148
disr,
21482149
i);
21492150
let llarg = {

branches/auto/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ pub struct FunctionContext {
212212
// this is an alloca in the function. Otherwise, it's the hidden first
213213
// parameter to the function. After function construction, this should
214214
// always be Some.
215-
llretptr: Option<ValueRef>,
215+
llretptr: Cell<Option<ValueRef>>,
216216

217217
entry_bcx: Option<@Block>,
218218

branches/auto/src/librustc/middle/trans/controlflow.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,9 @@ pub fn trans_break_cont(bcx: @Block,
266266
Some(bcx) => bcx,
267267
// This is a return from a loop body block
268268
None => {
269-
Store(bcx, C_bool(!to_end), bcx.fcx.llretptr.unwrap());
269+
Store(bcx,
270+
C_bool(!to_end),
271+
bcx.fcx.llretptr.get().unwrap());
270272
cleanup_and_leave(bcx, None, Some(bcx.fcx.get_llreturn()));
271273
Unreachable(bcx);
272274
return bcx;
@@ -292,7 +294,7 @@ pub fn trans_cont(bcx: @Block, label_opt: Option<Name>) -> @Block {
292294
pub fn trans_ret(bcx: @Block, e: Option<@ast::Expr>) -> @Block {
293295
let _icx = push_ctxt("trans_ret");
294296
let mut bcx = bcx;
295-
let dest = match bcx.fcx.llretptr {
297+
let dest = match bcx.fcx.llretptr.get() {
296298
None => expr::Ignore,
297299
Some(retptr) => expr::SaveIn(retptr),
298300
};

branches/auto/src/librustc/middle/trans/intrinsic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
290290
// NB: This needs to be kept in lockstep with the TypeId struct in
291291
// libstd/unstable/intrinsics.rs
292292
let val = C_named_struct(type_of::type_of(ccx, output_type), [C_u64(hash)]);
293-
match bcx.fcx.llretptr {
293+
match bcx.fcx.llretptr.get() {
294294
Some(ptr) => {
295295
Store(bcx, val, ptr);
296296
RetVoid(bcx);
@@ -301,7 +301,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
301301
"init" => {
302302
let tp_ty = substs.tys[0];
303303
let lltp_ty = type_of::type_of(ccx, tp_ty);
304-
match bcx.fcx.llretptr {
304+
match bcx.fcx.llretptr.get() {
305305
Some(ptr) => { Store(bcx, C_null(lltp_ty), ptr); RetVoid(bcx); }
306306
None if ty::type_is_nil(tp_ty) => RetVoid(bcx),
307307
None => Ret(bcx, C_null(lltp_ty)),
@@ -349,7 +349,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
349349
if !ty::type_is_voidish(ccx.tcx, out_type) {
350350
let llsrcval = get_param(decl, first_real_arg);
351351
if type_is_immediate(ccx, in_type) {
352-
match fcx.llretptr {
352+
match fcx.llretptr.get() {
353353
Some(llretptr) => {
354354
Store(bcx, llsrcval, PointerCast(bcx, llretptr, llintype.ptr_to()));
355355
RetVoid(bcx);
@@ -379,7 +379,7 @@ pub fn trans_intrinsic(ccx: @CrateContext,
379379
// NB: Do not use a Load and Store here. This causes massive
380380
// code bloat when `transmute` is used on large structural
381381
// types.
382-
let lldestptr = fcx.llretptr.unwrap();
382+
let lldestptr = fcx.llretptr.get().unwrap();
383383
let lldestptr = PointerCast(bcx, lldestptr, Type::i8p());
384384
let llsrcptr = PointerCast(bcx, llsrcval, Type::i8p());
385385

branches/auto/src/librustc/middle/trans/reflect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl Reflector {
309309
let mut bcx = fcx.entry_bcx.unwrap();
310310
let arg = BitCast(bcx, arg, llptrty);
311311
let ret = adt::trans_get_discr(bcx, repr, arg, Some(Type::i64()));
312-
Store(bcx, ret, fcx.llretptr.unwrap());
312+
Store(bcx, ret, fcx.llretptr.get().unwrap());
313313
match fcx.llreturn {
314314
Some(llreturn) => cleanup_and_Br(bcx, bcx, llreturn),
315315
None => bcx = cleanup_block(bcx, Some(bcx.llbb))

0 commit comments

Comments
 (0)