diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index ba495934387..5f89f17daf2 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -3748,11 +3748,11 @@ fn invoke_(bcx: @block_ctxt, llfn: ValueRef, fn get_landing_pad(bcx: @block_ctxt) -> BasicBlockRef { let scope_bcx = find_scope_for_lpad(bcx); - if scope_bcx.need_new_lpad { + if scope_bcx.cleanups_dirty { let unwind_bcx = new_sub_block_ctxt(bcx, "unwind"); let lpadbb = trans_landing_pad(unwind_bcx); scope_bcx.lpad = some(lpadbb); - scope_bcx.need_new_lpad = false; + scope_bcx.cleanups_dirty = false; } assert option::is_some(scope_bcx.lpad); ret option::get(scope_bcx.lpad); @@ -4566,7 +4566,7 @@ fn new_block_ctxt(cx: @fn_ctxt, parent: block_parent, kind: block_kind, parent: parent, kind: kind, mutable cleanups: [], - mutable need_new_lpad: true, + mutable cleanups_dirty: true, mutable lpad: option::none, sp: cx.sp, fcx: cx}; @@ -4602,7 +4602,7 @@ fn new_raw_block_ctxt(fcx: @fn_ctxt, llbb: BasicBlockRef) -> @block_ctxt { parent: parent_none, kind: NON_SCOPE_BLOCK, mutable cleanups: [], - mutable need_new_lpad: true, + mutable cleanups_dirty: true, mutable lpad: option::none, sp: fcx.sp, fcx: fcx}; @@ -4670,7 +4670,7 @@ fn llstaticallocas_block_ctxt(fcx: @fn_ctxt) -> @block_ctxt { parent: parent_none, kind: SCOPE_BLOCK, mutable cleanups: [], - mutable need_new_lpad: true, + mutable cleanups_dirty: true, mutable lpad: option::none, sp: fcx.sp, fcx: fcx}; @@ -4682,7 +4682,7 @@ fn llderivedtydescs_block_ctxt(fcx: @fn_ctxt) -> @block_ctxt { parent: parent_none, kind: SCOPE_BLOCK, mutable cleanups: [], - mutable need_new_lpad: true, + mutable cleanups_dirty: true, mutable lpad: option::none, sp: fcx.sp, fcx: fcx}; diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index eb4192c4e99..9e9d55f19ce 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -273,6 +273,7 @@ tag cleanup { fn add_clean(cx: @block_ctxt, val: ValueRef, ty: ty::t) { let scope_cx = find_scope_cx(cx); scope_cx.cleanups += [clean(bind drop_ty(_, val, ty))]; + scope_cx.cleanups_dirty = true; } fn add_clean_temp(cx: @block_ctxt, val: ValueRef, ty: ty::t) { 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) { let scope_cx = find_scope_cx(cx); scope_cx.cleanups += [clean_temp(val, bind spill_and_drop(_, val, ty))]; - if trans::type_is_immediate(bcx_ccx(cx), ty) { - scope_cx.need_new_lpad = true; - } + scope_cx.cleanups_dirty = true; } // 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 { std::vec::slice(sc_cx.cleanups, 0u, found as uint) + std::vec::slice(sc_cx.cleanups, (found as uint) + 1u, std::vec::len(sc_cx.cleanups)); - sc_cx.need_new_lpad = true; + sc_cx.cleanups_dirty = true; ret cx; } @@ -394,7 +393,7 @@ type block_ctxt = parent: block_parent, kind: block_kind, mutable cleanups: [cleanup], - mutable need_new_lpad: bool, + mutable cleanups_dirty: bool, mutable lpad: option::t, sp: span, fcx: @fn_ctxt};