about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libcore/comm.rs16
-rw-r--r--src/rt/rust_builtin.cpp10
-rw-r--r--src/rt/rust_task.cpp6
-rw-r--r--src/rt/rust_task.h10
-rw-r--r--src/rt/rustrt.def.in2
5 files changed, 17 insertions, 27 deletions
diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs
index 1572972ffdf..8d10ab8850d 100644
--- a/src/libcore/comm.rs
+++ b/src/libcore/comm.rs
@@ -38,10 +38,9 @@ enum rust_port {}
 
 #[abi = "cdecl"]
 native mod rustrt {
-    fn get_task_id() -> task_id;
-    fn chan_id_send<T: send>(t: *sys::type_desc,
-                            target_task: task_id, target_port: port_id,
-                            data: T) -> libc::uintptr_t;
+    fn rust_port_id_send<T: send>(t: *sys::type_desc,
+                                  target_port: port_id,
+                                  data: T) -> libc::uintptr_t;
 
     fn new_port(unit_sz: libc::size_t) -> *rust_port;
     fn del_port(po: *rust_port);
@@ -63,7 +62,6 @@ native mod rusti {
     fn call_with_retptr<T: send>(&&f: fn@(*uint)) -> T;
 }
 
-type task_id = int;
 type port_id = int;
 
 // It's critical that this only have one variant, so it has a record
@@ -79,7 +77,7 @@ data will be silently dropped.  Channels may be duplicated and
 themselves transmitted over other channels.
 "]
 enum chan<T: send> {
-    chan_t(task_id, port_id)
+    chan_t(port_id)
 }
 
 resource port_ptr<T: send>(po: *rust_port) {
@@ -119,8 +117,8 @@ Sends data over a channel. The sent data is moved into the channel,
 whereupon the caller loses access to it.
 "]
 fn send<T: send>(ch: chan<T>, -data: T) {
-    let chan_t(t, p) = ch;
-    let res = rustrt::chan_id_send(sys::get_type_desc::<T>(), t, p, data);
+    let chan_t(p) = ch;
+    let res = rustrt::rust_port_id_send(sys::get_type_desc::<T>(), p, data);
     if res != 0u unsafe {
         // Data sent successfully
         unsafe::leak(data);
@@ -217,7 +215,7 @@ Constructs a channel. The channel is bound to the port used to
 construct it.
 "]
 fn chan<T: send>(p: port<T>) -> chan<T> {
-    chan_t(rustrt::get_task_id(), rustrt::get_port_id(***p))
+    chan_t(rustrt::get_port_id(***p))
 }
 
 #[test]
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index aa5b60f87a9..b7abcdd9c26 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -444,8 +444,8 @@ rust_new_task_in_sched(rust_sched_id id) {
 }
 
 extern "C" CDECL void
-rust_task_config_notify(rust_task *target, chan_handle *chan) {
-    target->config_notify(*chan);
+rust_task_config_notify(rust_task *target, rust_port_id *port) {
+    target->config_notify(*port);
 }
 
 extern "C" rust_task *
@@ -503,13 +503,11 @@ get_port_id(rust_port *port) {
 }
 
 extern "C" CDECL uintptr_t
-chan_id_send(type_desc *t, rust_task_id target_task_id,
-             rust_port_id target_port_id, void *sptr) {
+rust_port_id_send(type_desc *t, rust_port_id target_port_id, void *sptr) {
     bool sent = false;
     rust_task *task = rust_task_thread::get_task();
 
-    LOG(task, comm, "chan_id_send task: 0x%" PRIxPTR
-        " port: 0x%" PRIxPTR, (uintptr_t) target_task_id,
+    LOG(task, comm, "rust_port_id*_send port: 0x%" PRIxPTR,
         (uintptr_t) target_port_id);
 
     rust_port *port = task->kernel->get_port_by_id(target_port_id);
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index aba93576700..651488b2ebe 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -475,7 +475,7 @@ rust_task::notify(bool success) {
     // FIXME (1078) Do this in rust code
     if(notify_enabled) {
         rust_port *target_port =
-            kernel->get_port_by_id(notify_chan.port);
+            kernel->get_port_by_id(notify_port);
         if(target_port) {
             task_notification msg;
             msg.id = id;
@@ -719,9 +719,9 @@ rust_task::delete_all_stacks() {
 }
 
 void
-rust_task::config_notify(chan_handle chan) {
+rust_task::config_notify(rust_port_id port) {
     notify_enabled = true;
-    notify_chan = chan;
+    notify_port = port;
 }
 
 /*
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index 2d12de9f196..37b3a76e720 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -18,12 +18,6 @@
 #include "rust_stack.h"
 #include "rust_port_selector.h"
 
-// Corresponds to the rust chan (currently _chan) type.
-struct chan_handle {
-    rust_task_id task;
-    rust_port_id port;
-};
-
 struct rust_box;
 
 struct frame_glue_fns {
@@ -56,7 +50,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
 
     rust_task_id id;
     bool notify_enabled;
-    chan_handle notify_chan;
+    rust_port_id notify_port;
 
     context ctx;
     stk_seg *stk;
@@ -209,7 +203,7 @@ public:
     void check_stack_canary();
     void delete_all_stacks();
 
-    void config_notify(chan_handle chan);
+    void config_notify(rust_port_id port);
 
     void call_on_c_stack(void *args, void *fn_ptr);
     void call_on_rust_stack(void *args, void *fn_ptr);
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index 8a170ede233..4cec37ee347 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -1,4 +1,3 @@
-chan_id_send
 check_claims
 debug_box
 debug_fn
@@ -16,6 +15,7 @@ new_port
 new_task
 port_recv
 precise_time_ns
+rust_port_id_send
 rust_port_select
 rand_free
 rand_new