From e20752de68fe336e9fa184bef0616e31c738452c Mon Sep 17 00:00:00 2001 From: Michael Bebenita Date: Tue, 17 Aug 2010 23:26:43 -0700 Subject: [PATCH] Added labels to blocking conditions. --- src/rt/rust_dom.cpp | 7 ++++--- src/rt/rust_task.cpp | 5 ++++- src/rt/rust_task.h | 3 ++- src/rt/rust_upcall.cpp | 6 +++--- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index e49eeb2282e..c41e26881fc 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -363,9 +363,10 @@ rust_dom::log_state() { log(rust_log::TASK, "blocked tasks:"); for (size_t i = 0; i < blocked_tasks.length(); i++) { log(rust_log::TASK, - "\t task: %s @0x%" PRIxPTR ", blocked on: 0x%" PRIxPTR, + "\t task: %s @0x%" PRIxPTR ", blocked on: 0x%" PRIxPTR + " '%s'", blocked_tasks[i]->name, blocked_tasks[i], - blocked_tasks[i]->cond); + blocked_tasks[i]->cond, blocked_tasks[i]->cond_name); } } @@ -373,7 +374,7 @@ rust_dom::log_state() { log(rust_log::TASK, "dead tasks:"); for (size_t i = 0; i < dead_tasks.length(); i++) { log(rust_log::TASK, "\t task: %s 0x%" PRIxPTR ", ref_count: %d", - dead_tasks[i], dead_tasks[i]->name, + dead_tasks[i]->name, dead_tasks[i], dead_tasks[i]->ref_count); } } diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index cd38433ed70..12623255ff1 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -63,6 +63,7 @@ rust_task::rust_task(rust_dom *dom, rust_task *spawner, const char *name) : name(name), state(&dom->running_tasks), cond(NULL), + cond_name("none"), supervisor(spawner), idx(0), rendezvous_ptr(0), @@ -552,7 +553,7 @@ rust_task::transition(ptr_vec *src, ptr_vec *dst) } void -rust_task::block(rust_cond *on) +rust_task::block(rust_cond *on, const char* name) { log(rust_log::TASK, "Blocking on 0x%" PRIxPTR ", cond: 0x%" PRIxPTR, (uintptr_t) on, (uintptr_t) cond); @@ -561,6 +562,7 @@ rust_task::block(rust_cond *on) transition(&dom->running_tasks, &dom->blocked_tasks); cond = on; + cond_name = name; } void @@ -574,6 +576,7 @@ rust_task::wakeup(rust_cond *from) transition(&dom->blocked_tasks, &dom->running_tasks); I(dom, cond == from); cond = NULL; + cond_name = "none"; } void diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index b66ee5a1b6f..9a4e0c7bd7a 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -24,6 +24,7 @@ rust_task : public maybe_proxy, const char *const name; ptr_vec *state; rust_cond *cond; + const char *cond_name; rust_task *supervisor; // Parent-link for failure propagation. size_t idx; size_t gc_alloc_thresh; @@ -70,7 +71,7 @@ rust_task : public maybe_proxy, const char *state_str(); void transition(ptr_vec *svec, ptr_vec *dvec); - void block(rust_cond *on); + void block(rust_cond *on, const char* name); void wakeup(rust_cond *from); void die(); void unblock(); diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index fb85233c570..a3373870b5f 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -191,13 +191,13 @@ upcall_join(rust_task *task, maybe_proxy *target) { if (target->is_proxy()) { notify_message:: send(notify_message::JOIN, "join", task, target->as_proxy()); - task->block(target_task); + task->block(target_task, "joining remote task"); task->yield(2); } else { // If the other task is already dying, we don't have to wait for it. if (target_task->dead() == false) { target_task->tasks_waiting_to_join.push(task); - task->block(target_task); + task->block(target_task, "joining local task"); task->yield(2); } } @@ -238,7 +238,7 @@ upcall_recv(rust_task *task, uintptr_t *dptr, rust_port *port) { task->log(rust_log::COMM, "<=== waiting for rendezvous data ==="); task->rendezvous_ptr = dptr; - task->block(port); + task->block(port, "waiting for rendezvous data"); task->yield(3); }