diff options
| author | bors <bors@rust-lang.org> | 2014-07-20 07:51:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-20 07:51:32 +0000 |
| commit | 50481f55030f02543e1b3b6ae008d77b1cef3e98 (patch) | |
| tree | 68d5379ab9d40a057f50cb5bddbfa1ad769dd869 | |
| parent | 320dbc18d89537b306226b74c3daa452ab828751 (diff) | |
| parent | d368ffdb26144fd1f451d3d8ba4344b0a8e82f99 (diff) | |
| download | rust-50481f55030f02543e1b3b6ae008d77b1cef3e98.tar.gz rust-50481f55030f02543e1b3b6ae008d77b1cef3e98.zip | |
auto merge of #15784 : dotdash/rust/unreach, r=luqmana
`call_visit_glue` is only ever called from trans_intrinsic, and the block won't be unreachable there. Also, the comment doesn't make sense anymore. When the code was introduced in 38fee9526a the function was also responsible for the cleanup glue, which is no longer the case. While we're at it, also fixed the debug message to output the right function name.
| -rw-r--r-- | src/librustc/middle/trans/glue.rs | 31 | ||||
| -rw-r--r-- | src/librustc/middle/trans/intrinsic.rs | 2 |
2 files changed, 6 insertions, 27 deletions
diff --git a/src/librustc/middle/trans/glue.rs b/src/librustc/middle/trans/glue.rs index aad7ba95a73..7afba95a98b 100644 --- a/src/librustc/middle/trans/glue.rs +++ b/src/librustc/middle/trans/glue.rs @@ -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], []); } diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index 2e3d7b291ea..bf8893904ca 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -296,7 +296,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") => { |
