about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-14 17:24:19 -0700
committerBrian Anderson <banderson@mozilla.com>2012-03-15 11:10:52 -0700
commitb278d675a231fdfe825c72e499d59e8a3d07ffaa (patch)
tree426a39a89561d56ac72e328aecc64c045a578e18 /src/rt/rust_builtin.cpp
parent337d860a8777a761267daaad9b561787b10e7c87 (diff)
downloadrust-b278d675a231fdfe825c72e499d59e8a3d07ffaa.tar.gz
rust-b278d675a231fdfe825c72e499d59e8a3d07ffaa.zip
rt: Look up ports through a single port table
Instead of a two-level lookup, just use one big table
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 9f2bb2d4652..de782c355c3 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -513,7 +513,6 @@ 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) {
-    // FIXME: make sure this is thread-safe
     bool sent = false;
     rust_task *task = rust_task_thread::get_task();
 
@@ -521,19 +520,13 @@ chan_id_send(type_desc *t, rust_task_id target_task_id,
         " port: 0x%" PRIxPTR, (uintptr_t) target_task_id,
         (uintptr_t) target_port_id);
 
-    rust_task *target_task = task->kernel->get_task_by_id(target_task_id);
-    if(target_task) {
-        rust_port *port = target_task->get_port_by_id(target_port_id);
-        if(port) {
-            port->send(sptr);
-            port->deref();
-            sent = true;
-        } else {
-            LOG(task, comm, "didn't get the port");
-        }
-        target_task->deref();
+    rust_port *port = task->kernel->get_port_by_id(target_port_id);
+    if(port) {
+        port->send(sptr);
+        port->deref();
+        sent = true;
     } else {
-        LOG(task, comm, "didn't get the task");
+        LOG(task, comm, "didn't get the port");
     }
     return (uintptr_t)sent;
 }