Skip to content

Commit ed9a793

Browse files
committed
auto merge of #6706 : brson/rust/glue, r=catamorphism
Instead of `glue_drop1234` it's `Type::<hash>::glue_drop1234` Haven't done any performance testing.
2 parents 212d6a2 + 7f642f3 commit ed9a793

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/librustc/back/link.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,17 @@ pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
727727
path_name(ccx.sess.ident_of(hash))]);
728728
}
729729

730+
pub fn mangle_internal_name_by_type_and_seq(ccx: @CrateContext,
731+
t: ty::t,
732+
name: &str) -> ~str {
733+
let s = ppaux::ty_to_str(ccx.tcx, t);
734+
let hash = get_symbol_hash(ccx, t);
735+
return mangle(ccx.sess,
736+
~[path_name(ccx.sess.ident_of(s)),
737+
path_name(ccx.sess.ident_of(hash)),
738+
path_name((ccx.names)(name))]);
739+
}
740+
730741
pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
731742
path: path,
732743
flav: &str) -> ~str {

src/librustc/middle/trans/glue.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
683683
let llsize = llsize_of(ccx, llty);
684684
let llalign = llalign_of(ccx, llty);
685685
let addrspace = declare_tydesc_addrspace(ccx, t);
686-
// FIXME #6574: this triggers duplicate LLVM symbols
687-
let name = @(if false /*ccx.sess.opts.debuginfo*/ {
688-
mangle_internal_name_by_type_only(ccx, t, "tydesc")
689-
} else {
690-
mangle_internal_name_by_seq(ccx, "tydesc")
691-
});
686+
let name = @mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
692687
note_unique_llvm_symbol(ccx, name);
693688
debug!("+++ declare_tydesc %s %s", ppaux::ty_to_str(ccx.tcx, t), *name);
694689
let gvar = str::as_c_str(*name, |buf| {
@@ -717,12 +712,7 @@ pub fn declare_generic_glue(ccx: @CrateContext, t: ty::t, llfnty: TypeRef,
717712
name: ~str) -> ValueRef {
718713
let _icx = ccx.insn_ctxt("declare_generic_glue");
719714
let name = name;
720-
// FIXME #6574 this triggers duplicate LLVM symbols
721-
let fn_nm = @(if false /*ccx.sess.opts.debuginfo*/ {
722-
mangle_internal_name_by_type_only(ccx, t, (~"glue_" + name))
723-
} else {
724-
mangle_internal_name_by_seq(ccx, (~"glue_" + name))
725-
});
715+
let fn_nm = @mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name));
726716
debug!("%s is for type %s", *fn_nm, ppaux::ty_to_str(ccx.tcx, t));
727717
note_unique_llvm_symbol(ccx, fn_nm);
728718
let llfn = decl_cdecl_fn(ccx.llmod, *fn_nm, llfnty);

0 commit comments

Comments
 (0)