Skip to content

Commit

Permalink
Remove the unneeded final parameter from call_visit_glue
Browse files Browse the repository at this point in the history
call_visit_glue() is only ever called with None as its last argument, so
we can remove it as well.
  • Loading branch information
dotdash committed Jul 18, 2014
1 parent 33a4dd8 commit d368ffd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
25 changes: 4 additions & 21 deletions src/librustc/middle/trans/glue.rs
Expand Up @@ -178,29 +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>) {
pub fn call_visit_glue(bcx: &Block, v: ValueRef, tydesc: ValueRef) {
let _icx = push_ctxt("call_visit_glue");
let ccx = bcx.ccx();
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
};

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
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

5 comments on commit d368ffd

@bors
Copy link
Contributor

@bors bors commented on d368ffd Jul 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from luqmana
at dotdash@d368ffd

@bors
Copy link
Contributor

@bors bors commented on d368ffd Jul 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging dotdash/rust/unreach = d368ffd into auto

@bors
Copy link
Contributor

@bors bors commented on d368ffd Jul 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotdash/rust/unreach = d368ffd merged ok, testing candidate = 50481f5

@bors
Copy link
Contributor

@bors bors commented on d368ffd Jul 20, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 50481f5

Please sign in to comment.