Fix typos in comments, delete obsolete comments and dead commented code.

This commit is contained in:
Michael Bebenita 2010-07-28 12:36:59 -07:00 committed by Graydon Hoare
parent cc4906ba79
commit 06b52b70db
5 changed files with 2 additions and 92 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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"
//

View file

@ -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;

View file

@ -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()");