Skip to content

Commit 8786306

Browse files
Eric Holkbrson
authored andcommitted
---
yaml --- r: 4041 b: refs/heads/master c: d79afd7 h: refs/heads/master i: 4039: dd28794 v: v3
1 parent 41030f6 commit 8786306

File tree

9 files changed

+22
-25
lines changed

9 files changed

+22
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 3ae4dcd41e72d197e3882835253745f79588b04a
2+
refs/heads/master: d79afd7916dc2b5353666c301b93c09fdba29134

trunk/src/comp/middle/trans_comm.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,11 @@ fn recv_val(&@block_ctxt cx, ValueRef to, &@ast::expr from, &ty::t unit_ty,
247247
bcx.build.Call(bcx.fcx.lcx.ccx.upcalls.recv,
248248
~[bcx.fcx.lltaskptr, lldataptr, llportptr]);
249249
auto data_load = load_if_immediate(bcx, to, unit_ty);
250-
auto cp = copy_val(bcx, action, to, data_load, unit_ty);
251-
bcx = cp.bcx;
252-
// TODO: Any cleanup need to be done here?
253-
ret rslt(bcx, to);
250+
//auto cp = copy_val(bcx, action, to, data_load, unit_ty);
251+
//bcx = cp.bcx;
252+
253+
add_clean_temp(cx, data_load, unit_ty);
254+
ret rslt(bcx, data_load);
254255
}
255256

256257
// Does a deep copy of a value. This is needed for passing arguments to child

trunk/src/rt/memory_region.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// NB: please do not commit code with this uncommented. It's
55
// hugely expensive and should only be used as a last resort.
66
//
7-
#define TRACK_ALLOCATIONS
7+
// #define TRACK_ALLOCATIONS
88

99
#define MAGIC 0xbadc0ffe
1010

trunk/src/rt/rust_chan.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
/**
55
* Create a new rust channel and associate it with the specified port.
66
*/
7-
rust_chan::rust_chan(rust_task *task,
8-
maybe_proxy<rust_port> *port,
7+
rust_chan::rust_chan(rust_kernel *kernel, maybe_proxy<rust_port> *port,
98
size_t unit_sz)
109
: ref_count(1),
11-
kernel(task->kernel),
12-
task(task),
10+
kernel(kernel),
1311
port(port),
1412
buffer(kernel, unit_sz) {
1513
if (port) {
@@ -39,6 +37,7 @@ void rust_chan::associate(maybe_proxy<rust_port> *port) {
3937
this, port);
4038
++this->ref_count;
4139
this->task = port->referent()->task;
40+
this->task->ref();
4241
this->port->referent()->chans.push(this);
4342
}
4443
}
@@ -59,6 +58,7 @@ void rust_chan::disassociate() {
5958
"disassociating chan: 0x%" PRIxPTR " from port: 0x%" PRIxPTR,
6059
this, port->referent());
6160
--this->ref_count;
61+
--this->task->ref_count;
6262
this->task = NULL;
6363
port->referent()->chans.swap_delete(this);
6464
}
@@ -118,7 +118,7 @@ rust_chan *rust_chan::clone(maybe_proxy<rust_task> *target) {
118118
target_task = target->as_proxy()->handle()->referent();
119119
}
120120
return new (target_task->kernel, "cloned chan")
121-
rust_chan(target_task, port, unit_sz);
121+
rust_chan(kernel, port, unit_sz);
122122
}
123123

124124
/**

trunk/src/rt/rust_chan.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ class rust_chan : public kernel_owned<rust_chan>,
55
public rust_cond {
66
public:
77
RUST_REFCOUNTED_WITH_DTOR(rust_chan, destroy())
8-
rust_chan(rust_task *task, maybe_proxy<rust_port> *port, size_t unit_sz);
8+
rust_chan(rust_kernel *kernel, maybe_proxy<rust_port> *port,
9+
size_t unit_sz);
910

1011
~rust_chan();
1112

1213
rust_kernel *kernel;
13-
smart_ptr<rust_task> task;
14+
rust_task *task;
1415
maybe_proxy<rust_port> *port;
1516
size_t idx;
1617
circular_buffer buffer;

trunk/src/rt/rust_port.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ rust_port::rust_port(rust_task *task, size_t unit_sz)
1010
PRIxPTR, (uintptr_t)task, unit_sz, (uintptr_t)this);
1111

1212
// Allocate a remote channel, for remote channel data.
13-
remote_channel = new (task->kernel, "remote chan")
14-
rust_chan(task, this, unit_sz);
13+
remote_channel = new (kernel, "remote chan")
14+
rust_chan(kernel, this, unit_sz);
1515
}
1616

1717
rust_port::~rust_port() {

trunk/src/rt/rust_upcall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ upcall_new_chan(rust_task *task, rust_port *port) {
130130
(uintptr_t) task, task->name, port);
131131
I(sched, port);
132132
return new (task->kernel, "rust_chan")
133-
rust_chan(task, port, port->unit_sz);
133+
rust_chan(task->kernel, port, port->unit_sz);
134134
}
135135

136136
/**

trunk/src/test/run-pass/task-comm-10.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// xfail-stage0
2-
// xfail-stage1
3-
// xfail-stage2
42

53
use std;
64
import std::task;

trunk/src/test/run-pass/task-comm-16.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
41
// -*- rust -*-
52

63
// Tests of ports and channels on various types
@@ -19,11 +16,11 @@ fn test_rec() {
1916
}
2017

2118
fn test_vec() {
22-
let port[vec[int]] po = port();
23-
let chan[vec[int]] ch = chan(po);
24-
let vec[int] v0 = [0, 1, 2];
19+
let port[int[]] po = port();
20+
let chan[int[]] ch = chan(po);
21+
let int[] v0 = ~[0, 1, 2];
2522
ch <| v0;
26-
let vec[int] v1;
23+
let int[] v1;
2724
po |> v1;
2825
assert (v1.(0) == 0);
2926
assert (v1.(1) == 1);

0 commit comments

Comments
 (0)