Skip to content

Commit 31d4fe3

Browse files
committed
Revert "Try a little harder to avoid creating new landing pads"
This reverts commit b8e31ac. Conflicts: src/comp/middle/trans.rs
1 parent 93de2f0 commit 31d4fe3

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/comp/middle/trans.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3748,11 +3748,11 @@ fn invoke_(bcx: @block_ctxt, llfn: ValueRef,
37483748

37493749
fn get_landing_pad(bcx: @block_ctxt) -> BasicBlockRef {
37503750
let scope_bcx = find_scope_for_lpad(bcx);
3751-
if scope_bcx.need_new_lpad {
3751+
if scope_bcx.cleanups_dirty {
37523752
let unwind_bcx = new_sub_block_ctxt(bcx, "unwind");
37533753
let lpadbb = trans_landing_pad(unwind_bcx);
37543754
scope_bcx.lpad = some(lpadbb);
3755-
scope_bcx.need_new_lpad = false;
3755+
scope_bcx.cleanups_dirty = false;
37563756
}
37573757
assert option::is_some(scope_bcx.lpad);
37583758
ret option::get(scope_bcx.lpad);
@@ -4566,7 +4566,7 @@ fn new_block_ctxt(cx: @fn_ctxt, parent: block_parent, kind: block_kind,
45664566
parent: parent,
45674567
kind: kind,
45684568
mutable cleanups: [],
4569-
mutable need_new_lpad: true,
4569+
mutable cleanups_dirty: true,
45704570
mutable lpad: option::none,
45714571
sp: cx.sp,
45724572
fcx: cx};
@@ -4602,7 +4602,7 @@ fn new_raw_block_ctxt(fcx: @fn_ctxt, llbb: BasicBlockRef) -> @block_ctxt {
46024602
parent: parent_none,
46034603
kind: NON_SCOPE_BLOCK,
46044604
mutable cleanups: [],
4605-
mutable need_new_lpad: true,
4605+
mutable cleanups_dirty: true,
46064606
mutable lpad: option::none,
46074607
sp: fcx.sp,
46084608
fcx: fcx};
@@ -4670,7 +4670,7 @@ fn llstaticallocas_block_ctxt(fcx: @fn_ctxt) -> @block_ctxt {
46704670
parent: parent_none,
46714671
kind: SCOPE_BLOCK,
46724672
mutable cleanups: [],
4673-
mutable need_new_lpad: true,
4673+
mutable cleanups_dirty: true,
46744674
mutable lpad: option::none,
46754675
sp: fcx.sp,
46764676
fcx: fcx};
@@ -4682,7 +4682,7 @@ fn llderivedtydescs_block_ctxt(fcx: @fn_ctxt) -> @block_ctxt {
46824682
parent: parent_none,
46834683
kind: SCOPE_BLOCK,
46844684
mutable cleanups: [],
4685-
mutable need_new_lpad: true,
4685+
mutable cleanups_dirty: true,
46864686
mutable lpad: option::none,
46874687
sp: fcx.sp,
46884688
fcx: fcx};

src/comp/middle/trans_common.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ tag cleanup {
273273
fn add_clean(cx: @block_ctxt, val: ValueRef, ty: ty::t) {
274274
let scope_cx = find_scope_cx(cx);
275275
scope_cx.cleanups += [clean(bind drop_ty(_, val, ty))];
276+
scope_cx.cleanups_dirty = true;
276277
}
277278
fn add_clean_temp(cx: @block_ctxt, val: ValueRef, ty: ty::t) {
278279
fn spill_and_drop(cx: @block_ctxt, val: ValueRef, ty: ty::t) ->
@@ -286,9 +287,7 @@ fn add_clean_temp(cx: @block_ctxt, val: ValueRef, ty: ty::t) {
286287
let scope_cx = find_scope_cx(cx);
287288
scope_cx.cleanups +=
288289
[clean_temp(val, bind spill_and_drop(_, val, ty))];
289-
if trans::type_is_immediate(bcx_ccx(cx), ty) {
290-
scope_cx.need_new_lpad = true;
291-
}
290+
scope_cx.cleanups_dirty = true;
292291
}
293292

294293
// Note that this only works for temporaries. We should, at some point, move
@@ -322,7 +321,7 @@ fn revoke_clean(cx: @block_ctxt, val: ValueRef, t: ty::t) -> @block_ctxt {
322321
std::vec::slice(sc_cx.cleanups, 0u, found as uint) +
323322
std::vec::slice(sc_cx.cleanups, (found as uint) + 1u,
324323
std::vec::len(sc_cx.cleanups));
325-
sc_cx.need_new_lpad = true;
324+
sc_cx.cleanups_dirty = true;
326325
ret cx;
327326
}
328327

@@ -394,7 +393,7 @@ type block_ctxt =
394393
parent: block_parent,
395394
kind: block_kind,
396395
mutable cleanups: [cleanup],
397-
mutable need_new_lpad: bool,
396+
mutable cleanups_dirty: bool,
398397
mutable lpad: option::t<BasicBlockRef>,
399398
sp: span,
400399
fcx: @fn_ctxt};

0 commit comments

Comments
 (0)