aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Bebenita <[email protected]>2010-07-28 12:36:59 -0700
committerGraydon Hoare <[email protected]>2010-07-28 20:30:29 -0700
commit06b52b70db868285de5cf71166e5ce5b9dfb8e00 (patch)
tree001f3d749cc48a65a7f230399b6ca17a1392b766 /src
parentWrap long lines. (diff)
downloadrust-06b52b70db868285de5cf71166e5ce5b9dfb8e00.tar.xz
rust-06b52b70db868285de5cf71166e5ce5b9dfb8e00.zip
Fix typos in comments, delete obsolete comments and dead commented code.
Diffstat (limited to 'src')
-rw-r--r--src/rt/rust.cpp6
-rw-r--r--src/rt/rust_dom.cpp2
-rw-r--r--src/rt/rust_internal.h19
-rw-r--r--src/rt/rust_task.h2
-rw-r--r--src/rt/rust_upcall.cpp65
5 files changed, 2 insertions, 92 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp
index 2200df11..9cc2fe41 100644
--- a/src/rt/rust.cpp
+++ b/src/rt/rust.cpp
@@ -1,12 +1,6 @@
#include "rust_internal.h"
#define TRACK_ALLOCATIONS
-// For debugging, keeps track of live allocations, so you can find out
-// exactly what leaked.
-
-//#ifdef TRACK_ALLOCATIONS
-//array_list<void *> allocation_list;
-//#endif
rust_srv::rust_srv() :
live_allocs(0)
diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp
index 205084ff..7392833d 100644
--- a/src/rt/rust_dom.cpp
+++ b/src/rt/rust_dom.cpp
@@ -217,8 +217,6 @@ void
rust_dom::reap_dead_tasks() {
for (size_t i = 0; i < dead_tasks.length(); ) {
rust_task *task = dead_tasks[i];
-// log(rust_log::TASK, "dead task 0x%" PRIxPTR " with ref_count: %d",
-// task, task->ref_count);
if (task->ref_count == 0) {
I(this, !task->waiting_tasks.length());
dead_tasks.swap_delete(task);
diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h
index bd9be504..1f140841 100644
--- a/src/rt/rust_internal.h
+++ b/src/rt/rust_internal.h
@@ -606,25 +606,6 @@ struct rust_token : public rust_cond {
#include "circular_buffer.h"
-//struct circ_buf : public dom_owned<circ_buf> {
-// static const size_t INIT_CIRC_BUF_UNITS = 8;
-// static const size_t MAX_CIRC_BUF_SIZE = 1 << 24;
-//
-// rust_dom *dom;
-// size_t alloc;
-// size_t unit_sz;
-// size_t next;
-// size_t unread;
-// uint8_t *data;
-//
-// circ_buf(rust_dom *dom, size_t unit_sz);
-// ~circ_buf();
-//
-// void transfer(void *dst);
-// void push(void *src);
-// void shift(void *dst);
-//};
-
#include "rust_chan.h"
//
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index 879cb61a..72b6deea 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -31,7 +31,7 @@ rust_task : public rust_proxy_delegate<rust_task>,
// Rendezvous pointer for receiving data when blocked on a port. If we're
// trying to read data and no data is available on any incoming channel,
// we block on the port, and yield control to the scheduler. Since, we
- // were not able to read anJything, we remember the location where the
+ // were not able to read anything, we remember the location where the
// result should go in the rendezvous_ptr, and let the sender write to
// that location before waking us up.
uintptr_t* rendezvous_ptr;
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 8ce40b57..77d39b85 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -74,7 +74,7 @@ extern "C" CDECL void upcall_del_port(rust_task *task, rust_port *port) {
}
/**
- * Creates a new channel, pointed to a specified port.
+ * Creates a new channel pointing to a given port.
*/
extern "C" CDECL rust_chan*
upcall_new_chan(rust_task *task, rust_port *port) {
@@ -115,69 +115,6 @@ upcall_clone_chan(rust_task *task,
return new (spawnee->dom) rust_chan(spawnee, chan->port);
}
-/*
- * Buffering protocol:
- *
- * - Reader attempts to read:
- * - Set reader to blocked-reading state.
- * - If buf with data exists:
- * - Attempt transmission.
- *
- * - Writer attempts to write:
- * - Set writer to blocked-writing state.
- * - Copy data into chan.
- * - Attempt transmission.
- *
- * - Transmission:
- * - Copy data from buf to reader
- * - Decr buf
- * - Set reader to running
- * - If buf now empty and blocked writer:
- * - Set blocked writer to running
- *
- */
-//
-//static int
-//attempt_transmission(rust_dom *dom, rust_chan *src, rust_task *dst) {
-// I(dom, src);
-// I(dom, dst);
-//
-// rust_port *port = src->port;
-// if (!port) {
-// dom->log(rust_log::COMM, "src died, transmission incomplete");
-// return 0;
-// }
-//
-// circular_buffer *buf = &src->buffer;
-// if (buf->is_empty()) {
-// dom->log(rust_log::COMM, "buffer empty, transmission incomplete");
-// return 0;
-// }
-//
-// if (!dst->blocked_on(port)) {
-// dom->log(rust_log::COMM,
-// "dst in non-reading state, transmission incomplete");
-// return 0;
-// }
-//
-// uintptr_t *dptr = dst->dptr;
-// dom->log(rust_log::COMM, "receiving %d bytes into dst_task=0x%" PRIxPTR
-// ", dptr=0x%" PRIxPTR, port->unit_sz, dst, dptr);
-// buf->dequeue(dptr);
-//
-// // Wake up the sender if its waiting for the send operation.
-// rust_task *sender = src->task;
-// rust_token *token = &src->token;
-// if (sender->blocked_on(token))
-// sender->wakeup(token);
-//
-// // Wake up the receiver, there is new data.
-// dst->wakeup(port);
-//
-// dom->log(rust_log::COMM, "transmission complete");
-// return 1;
-//}
-
extern "C" CDECL void upcall_yield(rust_task *task) {
LOG_UPCALL_ENTRY(task);
task->log(rust_log::UPCALL | rust_log::COMM, "upcall yield()");