Skip to content

Commit 7d09e01

Browse files
committed
---
yaml --- r: 232757 b: refs/heads/try c: 6c512dc h: refs/heads/master i: 232755: 8c52290 v: v3
1 parent 72b0a14 commit 7d09e01

File tree

11 files changed

+29
-25
lines changed

11 files changed

+29
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: f3bd14ab112ff77565dbb57a69540bbae2607ee9
4+
refs/heads/try: 6c512dc52b6ddea8137e3e44effee7f140ed1f53
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_trans/trans/_match.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
11971197
monomorphize::field_ty(bcx.tcx(), substs, field)
11981198
}).unwrap();
11991199
let llty = type_of::type_of(bcx.ccx(), unsized_ty);
1200-
let scratch = alloca_no_lifetime(bcx, llty, "__struct_field_fat_ptr");
1200+
let scratch = alloca(bcx, llty, "__struct_field_fat_ptr");
12011201
let data = adt::trans_field_ptr(bcx, &*repr, struct_val, 0, arg_count);
12021202
let len = Load(bcx, expr::get_meta(bcx, val.val));
12031203
Store(bcx, data, expr::get_dataptr(bcx, scratch));
@@ -1524,12 +1524,8 @@ fn create_bindings_map<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat: &ast::Pat,
15241524
match bm {
15251525
ast::BindByValue(_) if !moves_by_default || reassigned =>
15261526
{
1527-
llmatch = alloca_no_lifetime(bcx,
1528-
llvariable_ty.ptr_to(),
1529-
"__llmatch");
1530-
let llcopy = alloca_no_lifetime(bcx,
1531-
llvariable_ty,
1532-
&bcx.name(name));
1527+
llmatch = alloca(bcx, llvariable_ty.ptr_to(), "__llmatch");
1528+
let llcopy = alloca(bcx, llvariable_ty, &bcx.name(name));
15331529
trmode = if moves_by_default {
15341530
TrByMoveIntoCopy(llcopy)
15351531
} else {
@@ -1540,15 +1536,11 @@ fn create_bindings_map<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pat: &ast::Pat,
15401536
// in this case, the final type of the variable will be T,
15411537
// but during matching we need to store a *T as explained
15421538
// above
1543-
llmatch = alloca_no_lifetime(bcx,
1544-
llvariable_ty.ptr_to(),
1545-
&bcx.name(name));
1539+
llmatch = alloca(bcx, llvariable_ty.ptr_to(), &bcx.name(name));
15461540
trmode = TrByMoveRef;
15471541
}
15481542
ast::BindByRef(_) => {
1549-
llmatch = alloca_no_lifetime(bcx,
1550-
llvariable_ty,
1551-
&bcx.name(name));
1543+
llmatch = alloca(bcx, llvariable_ty, &bcx.name(name));
15521544
trmode = TrByRef;
15531545
}
15541546
};
@@ -1749,6 +1741,7 @@ fn mk_binding_alloca<'blk, 'tcx, A, F>(bcx: Block<'blk, 'tcx>,
17491741

17501742
// Subtle: be sure that we *populate* the memory *before*
17511743
// we schedule the cleanup.
1744+
call_lifetime_start(bcx, llval);
17521745
let bcx = populate(arg, bcx, datum);
17531746
bcx.fcx.schedule_lifetime_end(cleanup_scope, llval);
17541747
bcx.fcx.schedule_drop_mem(cleanup_scope, llval, var_ty, lvalue.dropflag_hint(bcx));

branches/try/src/librustc_trans/trans/base.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,12 +1025,6 @@ pub fn alloc_ty<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, t: Ty<'tcx>, name: &str) ->
10251025
}
10261026

10271027
pub fn alloca(cx: Block, ty: Type, name: &str) -> ValueRef {
1028-
let p = alloca_no_lifetime(cx, ty, name);
1029-
call_lifetime_start(cx, p);
1030-
p
1031-
}
1032-
1033-
pub fn alloca_no_lifetime(cx: Block, ty: Type, name: &str) -> ValueRef {
10341028
let _icx = push_ctxt("alloca");
10351029
if cx.unreachable.get() {
10361030
unsafe {
@@ -1742,7 +1736,9 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
17421736
expr::SaveIn(d) => d,
17431737
expr::Ignore => {
17441738
if !type_is_zero_size(ccx, result_ty) {
1745-
alloc_ty(bcx, result_ty, "constructor_result")
1739+
let llresult = alloc_ty(bcx, result_ty, "constructor_result");
1740+
call_lifetime_start(bcx, llresult);
1741+
llresult
17461742
} else {
17471743
C_undef(type_of::type_of(ccx, result_ty).ptr_to())
17481744
}

branches/try/src/librustc_trans/trans/callee.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,9 @@ pub fn trans_call_inner<'a, 'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
725725
let llty = type_of::type_of(ccx, ret_ty);
726726
Some(common::C_undef(llty.ptr_to()))
727727
} else {
728-
Some(alloc_ty(bcx, ret_ty, "__llret"))
728+
let llresult = alloc_ty(bcx, ret_ty, "__llret");
729+
call_lifetime_start(bcx, llresult);
730+
Some(llresult)
729731
}
730732
} else {
731733
None

branches/try/src/librustc_trans/trans/cleanup.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
883883
}
884884
None => {
885885
let addr = base::alloca(pad_bcx, common::val_ty(llretval), "");
886+
base::call_lifetime_start(pad_bcx, addr);
886887
self.personality.set(Some(addr));
887888
build::Store(pad_bcx, llretval, addr);
888889
}

branches/try/src/librustc_trans/trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
504504
output: ty::FnOutput<'tcx>,
505505
name: &str) -> ValueRef {
506506
if self.needs_ret_allocas {
507-
base::alloca_no_lifetime(bcx, match output {
507+
base::alloca(bcx, match output {
508508
ty::FnConverging(output_type) => type_of::type_of(bcx.ccx(), output_type),
509509
ty::FnDiverging => Type::void(bcx.ccx())
510510
}, name)

branches/try/src/librustc_trans/trans/datum.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ pub fn lvalue_scratch_datum<'blk, 'tcx, A, F>(bcx: Block<'blk, 'tcx>,
306306
let scratch = alloca(bcx, llty, name);
307307

308308
// Subtle. Populate the scratch memory *before* scheduling cleanup.
309+
call_lifetime_start(bcx, scratch);
309310
let bcx = populate(arg, bcx, scratch);
310311
bcx.fcx.schedule_lifetime_end(scope, scratch);
311312
bcx.fcx.schedule_drop_mem(scope, scratch, ty, None);
@@ -324,6 +325,7 @@ pub fn rvalue_scratch_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
324325
-> Datum<'tcx, Rvalue> {
325326
let llty = type_of::type_of(bcx.ccx(), ty);
326327
let scratch = alloca(bcx, llty, name);
328+
call_lifetime_start(bcx, scratch);
327329
Datum::new(scratch, ty, Rvalue::new(ByRef))
328330
}
329331

branches/try/src/librustc_trans/trans/expr.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ pub fn trans<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
248248
} else {
249249
let llty = type_of::type_of(bcx.ccx(), const_ty);
250250
let scratch = alloca(bcx, llty, "const");
251+
call_lifetime_start(bcx, scratch);
251252
let lldest = if !const_ty.is_structural() {
252253
// Cast pointer to slot, because constants have different types.
253254
PointerCast(bcx, scratch, val_ty(global))
@@ -412,6 +413,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
412413
let llty = type_of::type_of(bcx.ccx(), target);
413414

414415
let scratch = alloca(bcx, llty, "__coerce_target");
416+
call_lifetime_start(bcx, scratch);
415417
let target_datum = Datum::new(scratch, target,
416418
Rvalue::new(ByRef));
417419
bcx = coerce_unsized(bcx, expr.span, source_datum, target_datum);
@@ -1445,7 +1447,11 @@ pub fn trans_adt<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
14451447
// temporary stack slot
14461448
let addr = match dest {
14471449
SaveIn(pos) => pos,
1448-
Ignore => alloc_ty(bcx, ty, "temp"),
1450+
Ignore => {
1451+
let llresult = alloc_ty(bcx, ty, "temp");
1452+
call_lifetime_start(bcx, llresult);
1453+
llresult
1454+
}
14491455
};
14501456

14511457
// This scope holds intermediates that must be cleaned should

branches/try/src/librustc_trans/trans/glue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ pub fn drop_ty_immediate<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
188188
-> Block<'blk, 'tcx> {
189189
let _icx = push_ctxt("drop_ty_immediate");
190190
let vp = alloca(bcx, type_of(bcx.ccx(), t), "");
191+
call_lifetime_start(bcx, vp);
191192
store_ty(bcx, v, vp, t);
192193
drop_ty_core(bcx, vp, t, debug_loc, skip_dtor, None)
193194
}

branches/try/src/librustc_trans/trans/intrinsic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,9 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
393393
expr::SaveIn(d) => d,
394394
expr::Ignore => {
395395
if !type_is_zero_size(ccx, ret_ty) {
396-
alloc_ty(bcx, ret_ty, "intrinsic_result")
396+
let llresult = alloc_ty(bcx, ret_ty, "intrinsic_result");
397+
call_lifetime_start(bcx, llresult);
398+
llresult
397399
} else {
398400
C_undef(llret_ty.ptr_to())
399401
}

branches/try/src/librustc_trans/trans/tvec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ pub fn trans_slice_vec<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
111111
// Always create an alloca even if zero-sized, to preserve
112112
// the non-null invariant of the inner slice ptr
113113
let llfixed = base::alloca(bcx, llfixed_ty, "");
114+
call_lifetime_start(bcx, llfixed);
114115

115116
if count > 0 {
116117
// Arrange for the backing array to be cleaned up.

0 commit comments

Comments
 (0)