Skip to content

Commit

Permalink
auto merge of #6706 : brson/rust/glue, r=catamorphism
Browse files Browse the repository at this point in the history
Instead of `glue_drop1234` it's `Type::<hash>::glue_drop1234`

Haven't done any performance testing.
  • Loading branch information
bors committed May 24, 2013
2 parents 212d6a2 + 7f642f3 commit ed9a793
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,17 @@ pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
path_name(ccx.sess.ident_of(hash))]);
}

pub fn mangle_internal_name_by_type_and_seq(ccx: @CrateContext,
t: ty::t,
name: &str) -> ~str {
let s = ppaux::ty_to_str(ccx.tcx, t);
let hash = get_symbol_hash(ccx, t);
return mangle(ccx.sess,
~[path_name(ccx.sess.ident_of(s)),
path_name(ccx.sess.ident_of(hash)),
path_name((ccx.names)(name))]);
}

pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
path: path,
flav: &str) -> ~str {
Expand Down
14 changes: 2 additions & 12 deletions src/librustc/middle/trans/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
let llsize = llsize_of(ccx, llty);
let llalign = llalign_of(ccx, llty);
let addrspace = declare_tydesc_addrspace(ccx, t);
// FIXME #6574: this triggers duplicate LLVM symbols
let name = @(if false /*ccx.sess.opts.debuginfo*/ {
mangle_internal_name_by_type_only(ccx, t, "tydesc")
} else {
mangle_internal_name_by_seq(ccx, "tydesc")
});
let name = @mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
note_unique_llvm_symbol(ccx, name);
debug!("+++ declare_tydesc %s %s", ppaux::ty_to_str(ccx.tcx, t), *name);
let gvar = str::as_c_str(*name, |buf| {
Expand Down Expand Up @@ -717,12 +712,7 @@ pub fn declare_generic_glue(ccx: @CrateContext, t: ty::t, llfnty: TypeRef,
name: ~str) -> ValueRef {
let _icx = ccx.insn_ctxt("declare_generic_glue");
let name = name;
// FIXME #6574 this triggers duplicate LLVM symbols
let fn_nm = @(if false /*ccx.sess.opts.debuginfo*/ {
mangle_internal_name_by_type_only(ccx, t, (~"glue_" + name))
} else {
mangle_internal_name_by_seq(ccx, (~"glue_" + name))
});
let fn_nm = @mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name));
debug!("%s is for type %s", *fn_nm, ppaux::ty_to_str(ccx.tcx, t));
note_unique_llvm_symbol(ccx, fn_nm);
let llfn = decl_cdecl_fn(ccx.llmod, *fn_nm, llfnty);
Expand Down

0 comments on commit ed9a793

Please sign in to comment.