Skip to content

Commit

Permalink
Switched calling conventions so that spawn with multiple arguments wo…
Browse files Browse the repository at this point in the history
…rks.
  • Loading branch information
Eric Holk committed May 27, 2011
1 parent d49998f commit 8cfc388
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/comp/middle/trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5949,7 +5949,6 @@ fn mk_spawn_wrapper(&@block_ctxt cx,
&ty::t args_ty) -> result {
auto llmod = cx.fcx.lcx.ccx.llmod;
let TypeRef args_ty_tref = type_of(cx.fcx.lcx.ccx, cx.sp, args_ty);
//let TypeRef wrapper_fn_type = T_fn([args_ty_tref], T_void());

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

// TODO: construct a name based on tname
auto llfndecl = decl_cdecl_fn(llmod, "spawn_wrap",
wrapper_fn_type);
auto llfndecl = decl_fastcall_fn(llmod, "spawn_wrap",
wrapper_fn_type);

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

fbcx.build.Call(llfn,
child_args);
fbcx.build.FastCall(llfn,
child_args);
fbcx.build.RetVoid();

finish_fn(fcx, fbcx.llbb);

// TODO: make sure we clean up everything we need to.
Expand Down
2 changes: 1 addition & 1 deletion src/rt/rust_upcall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ upcall_start_task(rust_task *spawner,
// here.
uintptr_t start_args[] = {0, 0, 0, args};

task->start(spawnee_fn, (uintptr_t)&start_args, sizeof(start_args));
task->start(spawnee_fn, (uintptr_t)start_args, sizeof(start_args));
return task;
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// -*- rust -*-

fn main() {
auto t = spawn child(10);
auto t = spawn child(10);
}

fn child(int i) {
log_err i;
log_err i;
}

// Local Variables:
Expand Down

0 comments on commit 8cfc388

Please sign in to comment.