Skip to content

Commit dad4264

Browse files
author
Eric Holk
committed
Working on 2 argument spawn. The arguments seem to be copied correctly once, but then they get lost.
1 parent bb4c7a9 commit dad4264

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/comp/middle/trans.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5882,9 +5882,7 @@ fn trans_spawn(&@block_ctxt cx,
58825882
e));
58835883
}
58845884

5885-
// Make the tuple. We have to reverse the types first though.
5886-
//vec::reverse[ty::t](arg_tys);
5887-
//vec::reverse[ValueRef](arg_vals);
5885+
// Make the tuple.
58885886
auto args_ty = ty::mk_imm_tup(cx.fcx.lcx.ccx.tcx, arg_tys);
58895887

58905888
// Allocate and fill the tuple.

src/rt/rust_task.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,19 @@ rust_task::start(uintptr_t spawnee_fn,
171171
src += 1; // spawn-call task slot
172172
src += 1; // spawn-call closure-or-obj slot
173173

174-
*spp-- = (uintptr_t) *src; // vec
174+
spp -= (args_size / sizeof(uintptr_t)) - 1;
175+
memmove(spp, src, args_size);
176+
spp--;
177+
178+
//*spp-- = (uintptr_t) *src; // vec
179+
175180
*spp-- = (uintptr_t) 0x0; // closure-or-obj
176181
*spp-- = (uintptr_t) this; // task
177182
*spp-- = (uintptr_t) dummy_ret; // output address
178183

179184
I(dom, spp == align_down(spp));
180185
*spp-- = (uintptr_t) (uintptr_t) spawnee_fn;
181186

182-
183187
*spp-- = (uintptr_t) 0x0; // retp
184188

185189
*spp-- = (uintptr_t) rust_new_exit_task_glue;

src/test/run-pass/spawn2.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// xfail-stage0
2+
// xfail-stage1
3+
// xfail-stage2
4+
// -*- rust -*-
5+
6+
use std;
7+
8+
fn main() {
9+
spawn child(10, 20);
10+
}
11+
12+
fn child(int i, int j) {
13+
log_err i;
14+
log_err j;
15+
}

0 commit comments

Comments
 (0)