Skip to content

Commit 5279504

Browse files
author
Eric Holk
committed
Generating names for wrappers, removed extra logging
1 parent 8cfc388 commit 5279504

File tree

1 file changed

+5
-35
lines changed

1 file changed

+5
-35
lines changed

src/comp/middle/trans.rs

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5925,7 +5925,7 @@ fn trans_spawn(&@block_ctxt cx,
59255925
T_int());
59265926

59275927
// Generate the wrapper function
5928-
auto wrapper = mk_spawn_wrapper(bcx, tname, func, args_ty);
5928+
auto wrapper = mk_spawn_wrapper(bcx, func, args_ty);
59295929
bcx = wrapper.bcx;
59305930
auto llfnptr_i = bcx.build.PointerCast(wrapper.val, T_int());
59315931
// TODO: this next line might be necessary...
@@ -5944,7 +5944,6 @@ fn trans_spawn(&@block_ctxt cx,
59445944
}
59455945

59465946
fn mk_spawn_wrapper(&@block_ctxt cx,
5947-
&str tname,
59485947
&@ast::expr func,
59495948
&ty::t args_ty) -> result {
59505949
auto llmod = cx.fcx.lcx.ccx.llmod;
@@ -5956,30 +5955,20 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
59565955
ty::idx_nil,
59575956
0u);
59585957

5959-
log_err #fmt("wrapper args type: %s",
5960-
ty_str(cx.fcx.lcx.ccx.tn, args_ty_tref));
5961-
log_err #fmt("wrapper fn desired type: %s",
5962-
ty_str(cx.fcx.lcx.ccx.tn, wrapper_fn_type));
5963-
59645958
// TODO: construct a name based on tname
5965-
auto llfndecl = decl_fastcall_fn(llmod, "spawn_wrap",
5959+
let str wrap_name = mangle_name_by_seq(cx.fcx.lcx.ccx,
5960+
[""],
5961+
"spawn_wrapper");
5962+
auto llfndecl = decl_fastcall_fn(llmod, wrap_name,
59665963
wrapper_fn_type);
59675964

5968-
log_err #fmt("spawn wrapper decl type: %s",
5969-
val_str(cx.fcx.lcx.ccx.tn, llfndecl));
5970-
59715965
auto fcx = new_fn_ctxt(cx.fcx.lcx, cx.sp, llfndecl);
59725966

59735967
auto fbcx = new_top_block_ctxt(fcx);
59745968

5975-
log_err #fmt("spawn wrapper type: %s", val_str(fcx.lcx.ccx.tn,
5976-
fcx.llfn));
5977-
59785969
// 3u to skip the three implicit args
59795970
let ValueRef arg = llvm::LLVMGetParam(fcx.llfn, 3u);
59805971

5981-
log_err #fmt("arg type: %s", val_str(fbcx.fcx.lcx.ccx.tn, arg));
5982-
59835972
let vec[ValueRef] child_args =
59845973
[llvm::LLVMGetParam(fcx.llfn, 0u),
59855974
llvm::LLVMGetParam(fcx.llfn, 1u),
@@ -5990,14 +5979,9 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
59905979
case(ty::ty_tup(?elements)) {
59915980
auto i = 0;
59925981
for(ty::mt m in elements) {
5993-
log_err #fmt("GEP arg %d", i);
59945982
auto src = fbcx.build.GEP(arg, [C_int(0), C_int(i)]);
59955983
i += 1;
59965984

5997-
log_err #fmt("generating load of type %s",
5998-
val_str(fbcx.fcx.lcx.ccx.tn,
5999-
src));
6000-
60015985
auto child_arg = fbcx.build.Load(src);
60025986

60035987
child_args += [child_arg];
@@ -6009,24 +5993,10 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
60095993
auto fnptr = trans_lval(fbcx, func).res;
60105994
fbcx = fnptr.bcx;
60115995

6012-
log_err "SPAWN 1";
60135996
auto llfnptr = fbcx.build.GEP(fnptr.val,
60145997
[C_int(0), C_int(0)]);
60155998
auto llfn = fbcx.build.Load(llfnptr);
60165999

6017-
log_err #fmt("Generating call to child function: %s",
6018-
val_str(fbcx.fcx.lcx.ccx.tn,
6019-
llfn));
6020-
6021-
auto i = 0;
6022-
for(ValueRef v in child_args) {
6023-
log_err #fmt("Arg %d: %s",
6024-
i,
6025-
val_str(fbcx.fcx.lcx.ccx.tn,
6026-
v));
6027-
i += 1;
6028-
}
6029-
60306000
fbcx.build.FastCall(llfn,
60316001
child_args);
60326002
fbcx.build.RetVoid();

0 commit comments

Comments
 (0)