Skip to content

Commit 55260c6

Browse files
committed
---
yaml --- r: 1887 b: refs/heads/master c: f59e49c h: refs/heads/master i: 1885: 02dd2d4 1883: 8f06766 1879: 5ff4f14 1871: 636900e 1855: 40c883d v: v3
1 parent 31b9f1f commit 55260c6

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 26504871205d62ae0b501abb1dc0abc2f150bb3f
2+
refs/heads/master: f59e49c9a6eba3acbd6625df8dfd26c0388744a4

trunk/src/comp/middle/trans.rs

+21-17
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ fn mangle_name_by_type(@crate_ctxt cx, @ty.t t) -> str {
170170
auto f = metadata.def_to_str;
171171
cx.sha.input_str(metadata.ty_str(t, f));
172172
ret sep() + "rust" + sep()
173-
+ cx.sha.result_str() + sep()
173+
+ _str.substr(cx.sha.result_str(), 0u, 16u) + sep()
174174
+ path_name(cx.path);
175175
}
176176

@@ -891,6 +891,13 @@ fn decl_fastcall_fn(ModuleRef llmod, str name, TypeRef llty) -> ValueRef {
891891
ret decl_fn(llmod, name, lib.llvm.LLVMFastCallConv, llty);
892892
}
893893

894+
fn decl_private_fastcall_fn(ModuleRef llmod,
895+
str name, TypeRef llty) -> ValueRef {
896+
auto llfn = decl_fn(llmod, name, lib.llvm.LLVMFastCallConv, llty);
897+
llvm.LLVMSetLinkage(llfn, lib.llvm.LLVMPrivateLinkage as llvm.Linkage);
898+
ret llfn;
899+
}
900+
894901
fn decl_glue(ModuleRef llmod, type_names tn, str s) -> ValueRef {
895902
ret decl_cdecl_fn(llmod, s, T_fn(vec(T_taskptr(tn)), T_void()));
896903
}
@@ -1576,8 +1583,7 @@ fn declare_generic_glue(@crate_ctxt cx, @ty.t t, str name) -> ValueRef {
15761583
auto gcx = @rec(path=vec("glue", name) with *cx);
15771584
auto fn_name = mangle_name_by_type(gcx, t);
15781585
fn_name = sanitize(fn_name);
1579-
auto llfn = decl_fastcall_fn(cx.llmod, fn_name, llfnty);
1580-
llvm.LLVMSetLinkage(llfn, lib.llvm.LLVMPrivateLinkage as llvm.Linkage);
1586+
auto llfn = decl_private_fastcall_fn(cx.llmod, fn_name, llfnty);
15811587
ret llfn;
15821588
}
15831589

@@ -3231,8 +3237,8 @@ fn trans_for_each(@block_ctxt cx,
32313237
vec(rec(mode=ast.val, ty=decl_ty)),
32323238
plain_ty(ty.ty_nil), 0u);
32333239

3234-
let ValueRef lliterbody = decl_fastcall_fn(cx.fcx.ccx.llmod,
3235-
s, iter_body_llty);
3240+
let ValueRef lliterbody = decl_private_fastcall_fn(cx.fcx.ccx.llmod,
3241+
s, iter_body_llty);
32363242

32373243
// FIXME: handle ty params properly.
32383244
let vec[ast.ty_param] ty_params = vec();
@@ -3813,7 +3819,7 @@ fn trans_bind_thunk(@crate_ctxt cx,
38133819

38143820
let str s = mangle_name_by_seq(cx, "thunk");
38153821
let TypeRef llthunk_ty = get_pair_fn_ty(type_of(cx, incoming_fty));
3816-
let ValueRef llthunk = decl_fastcall_fn(cx.llmod, s, llthunk_ty);
3822+
let ValueRef llthunk = decl_private_fastcall_fn(cx.llmod, s, llthunk_ty);
38173823

38183824
auto fcx = new_fn_ctxt(cx, llthunk);
38193825
auto bcx = new_top_block_ctxt(fcx);
@@ -5402,11 +5408,10 @@ fn trans_vtbl(@crate_ctxt cx, TypeRef self_ty,
54025408

54035409
let @crate_ctxt mcx = extend_path(cx, m.node.ident);
54045410
let str s = mangle_name_by_seq(mcx, "method");
5405-
let ValueRef llfn = decl_fastcall_fn(cx.llmod, s, llfnty);
5411+
let ValueRef llfn = decl_private_fastcall_fn(cx.llmod, s, llfnty);
54065412
cx.item_ids.insert(m.node.id, llfn);
54075413
cx.item_symbols.insert(m.node.id, s);
54085414

5409-
54105415
trans_fn(mcx, m.node.meth, m.node.id, some[TypeRef](self_ty),
54115416
ty_params, m.node.ann);
54125417
methods += vec(llfn);
@@ -5713,7 +5718,7 @@ fn decl_fn_and_pair(@crate_ctxt cx,
57135718

57145719
// Declare the function itself.
57155720
let str s = mangle_name_by_seq(cx, flav);
5716-
let ValueRef llfn = decl_fastcall_fn(cx.llmod, s, llfty);
5721+
let ValueRef llfn = decl_private_fastcall_fn(cx.llmod, s, llfty);
57175722

57185723
// Declare the global constant pair that points to it.
57195724
let str ps = mangle_name_by_type(cx, node_ann_type(cx, ann));
@@ -5730,9 +5735,9 @@ fn register_fn_pair(@crate_ctxt cx, str ps, TypeRef llpairty, ValueRef llfn,
57305735

57315736
llvm.LLVMSetInitializer(gvar, pair);
57325737
llvm.LLVMSetGlobalConstant(gvar, True);
5733-
llvm.LLVMSetLinkage(gvar,
5734-
lib.llvm.LLVMPrivateLinkage
5735-
as llvm.Linkage);
5738+
llvm.LLVMSetVisibility(gvar,
5739+
lib.llvm.LLVMProtectedVisibility
5740+
as llvm.Visibility);
57365741

57375742
cx.item_ids.insert(id, llfn);
57385743
cx.item_symbols.insert(id, ps);
@@ -5776,9 +5781,8 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
57765781
// Declare the wrapper.
57775782
auto wrapper_type = native_fn_wrapper_type(cx, num_ty_param, ann);
57785783
let str s = mangle_name_by_seq(cx, "wrapper");
5779-
let ValueRef wrapper_fn = decl_fastcall_fn(cx.llmod, s, wrapper_type);
5780-
llvm.LLVMSetLinkage(wrapper_fn, lib.llvm.LLVMPrivateLinkage
5781-
as llvm.Linkage);
5784+
let ValueRef wrapper_fn = decl_private_fastcall_fn(cx.llmod, s,
5785+
wrapper_type);
57825786

57835787
// Declare the global constant pair that points to it.
57845788
auto wrapper_pair_type = T_fn_pair(cx.tn, wrapper_type);
@@ -6267,9 +6271,8 @@ fn decl_bzero_glue(ModuleRef llmod) -> ValueRef {
62676271
ret decl_fastcall_fn(llmod, abi.bzero_glue_name(), ty);
62686272
}
62696273

6270-
fn make_bzero_glue(ModuleRef llmod) -> ValueRef {
6274+
fn make_bzero_glue(ValueRef fun) -> ValueRef {
62716275
// We're not using the LLVM memset intrinsic. Same as with memcpy.
6272-
auto fun = decl_bzero_glue(llmod);
62736276
auto initbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("init"));
62746277
auto hdrbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("hdr"));
62756278
auto loopbb = llvm.LLVMAppendBasicBlock(fun, _str.buf("loop"));
@@ -6548,6 +6551,7 @@ fn make_common_glue(str output) {
65486551
auto glues = make_glues(llmod, tn);
65496552
create_crate_constant(crate_ptr, glues);
65506553
make_memcpy_glue(glues.memcpy_glue);
6554+
make_bzero_glue(glues.bzero_glue);
65516555

65526556
trans_exit_task_glue(glues, new_str_hash[ValueRef](), tn, llmod);
65536557

0 commit comments

Comments
 (0)