Skip to content

Remove outdated unreachable check from call_visit_glue #15784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions src/librustc/middle/trans/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,33 +178,12 @@ pub fn lazily_emit_visit_glue(ccx: &CrateContext, ti: &tydesc_info) -> ValueRef
}

// See [Note-arg-mode]
pub fn call_visit_glue(bcx: &Block, v: ValueRef, tydesc: ValueRef,
static_ti: Option<&tydesc_info>) {
let _icx = push_ctxt("call_tydesc_glue_full");
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.
if bcx.unreachable.get() && !ccx.sess().no_landing_pads() { return; }

let static_glue_fn = static_ti.map(|sti| lazily_emit_visit_glue(ccx, sti));

// When static type info is available, avoid casting to a generic pointer.
let llrawptr = if static_glue_fn.is_none() {
PointerCast(bcx, v, Type::i8p(ccx))
} else {
v
};
pub fn call_visit_glue(bcx: &Block, v: ValueRef, tydesc: ValueRef) {
let _icx = push_ctxt("call_visit_glue");

let llfn = {
match static_glue_fn {
None => {
// Select out the glue function to call from the tydesc
let llfnptr = GEPi(bcx, tydesc, [0u, abi::tydesc_field_visit_glue]);
Load(bcx, llfnptr)
}
Some(sgf) => sgf
}
};
// Select the glue function to call from the tydesc
let llfn = Load(bcx, GEPi(bcx, tydesc, [0u, abi::tydesc_field_visit_glue]));
let llrawptr = PointerCast(bcx, v, Type::i8p(bcx.ccx()));

Call(bcx, llfn, [llrawptr], []);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ pub fn trans_intrinsic_call<'a>(mut bcx: &'a Block<'a>, node: ast::NodeId,
let td = *llargs.get(0);
let visitor = *llargs.get(1);
let td = PointerCast(bcx, td, ccx.tydesc_type().ptr_to());
glue::call_visit_glue(bcx, visitor, td, None);
glue::call_visit_glue(bcx, visitor, td);
C_nil(ccx)
}
(_, "offset") => {
Expand Down