Skip to content

Commit 8cfc388

Browse files
author
Eric Holk
committed
Switched calling conventions so that spawn with multiple arguments works.
1 parent d49998f commit 8cfc388

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/comp/middle/trans.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5949,7 +5949,6 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
59495949
&ty::t args_ty) -> result {
59505950
auto llmod = cx.fcx.lcx.ccx.llmod;
59515951
let TypeRef args_ty_tref = type_of(cx.fcx.lcx.ccx, cx.sp, args_ty);
5952-
//let TypeRef wrapper_fn_type = T_fn([args_ty_tref], T_void());
59535952

59545953
let TypeRef wrapper_fn_type =
59555954
type_of_fn(cx.fcx.lcx.ccx, cx.sp, ast::proto_fn,
@@ -5963,8 +5962,8 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
59635962
ty_str(cx.fcx.lcx.ccx.tn, wrapper_fn_type));
59645963

59655964
// TODO: construct a name based on tname
5966-
auto llfndecl = decl_cdecl_fn(llmod, "spawn_wrap",
5967-
wrapper_fn_type);
5965+
auto llfndecl = decl_fastcall_fn(llmod, "spawn_wrap",
5966+
wrapper_fn_type);
59685967

59695968
log_err #fmt("spawn wrapper decl type: %s",
59705969
val_str(cx.fcx.lcx.ccx.tn, llfndecl));
@@ -6028,10 +6027,10 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
60286027
i += 1;
60296028
}
60306029

6031-
fbcx.build.Call(llfn,
6032-
child_args);
6030+
fbcx.build.FastCall(llfn,
6031+
child_args);
60336032
fbcx.build.RetVoid();
6034-
6033+
60356034
finish_fn(fcx, fbcx.llbb);
60366035

60376036
// TODO: make sure we clean up everything we need to.

src/rt/rust_upcall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ upcall_start_task(rust_task *spawner,
480480
// here.
481481
uintptr_t start_args[] = {0, 0, 0, args};
482482

483-
task->start(spawnee_fn, (uintptr_t)&start_args, sizeof(start_args));
483+
task->start(spawnee_fn, (uintptr_t)start_args, sizeof(start_args));
484484
return task;
485485
}
486486

src/test/run-pass/spawn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// -*- rust -*-
33

44
fn main() {
5-
auto t = spawn child(10);
5+
auto t = spawn child(10);
66
}
77

88
fn child(int i) {
9-
log_err i;
9+
log_err i;
1010
}
1111

1212
// Local Variables:

0 commit comments

Comments
 (0)