Skip to content

Commit

Permalink
rustc: When landing pads are off, avoid skipping cleanup code.
Browse files Browse the repository at this point in the history
This forces various things to be created (e.g. drop glue), and also
happens to be necessary for GC liveness to recognize cleanups as
roots.
  • Loading branch information
Elliott Slaughter committed Aug 27, 2012
1 parent 5593add commit 38fee95
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/rustc/middle/trans/base.rs
Expand Up @@ -1233,8 +1233,12 @@ fn lazily_emit_tydesc_glue(ccx: @crate_ctxt, field: uint,
fn call_tydesc_glue_full(++bcx: block, v: ValueRef, tydesc: ValueRef,
field: uint, static_ti: Option<@tydesc_info>) {
let _icx = bcx.insn_ctxt("call_tydesc_glue_full");
if bcx.unreachable { return; }
let ccx = bcx.ccx();
// NB: Don't short-circuit even if this block is unreachable because
// GC-based cleanup needs to the see that the roots are live.
let no_lpads =
ccx.sess.opts.debugging_opts & session::no_landing_pads != 0;
if bcx.unreachable && !no_lpads { return; }

let static_glue_fn = match static_ti {
None => None,
Expand Down Expand Up @@ -4510,7 +4514,11 @@ fn trans_block_cleanups_(bcx: block,
/* cleanup_cx: block, */ is_lpad: bool) ->
block {
let _icx = bcx.insn_ctxt("trans_block_cleanups");
if bcx.unreachable { return bcx; }
// NB: Don't short-circuit even if this block is unreachable because
// GC-based cleanup needs to the see that the roots are live.
let no_lpads =
bcx.ccx().sess.opts.debugging_opts & session::no_landing_pads != 0;
if bcx.unreachable && !no_lpads { return bcx; }
let mut bcx = bcx;
do vec::riter(cleanups) |cu| {
match cu {
Expand Down

0 comments on commit 38fee95

Please sign in to comment.