template class ptr_vec<rust_task>;
+// Keeps track of all live domains, for debugging purposes.
+array_list<rust_dom*> _live_domains;
- rust_dom::rust_dom(rust_srv *srv, rust_crate const *root_crate) :
+ rust_dom::rust_dom(rust_srv *srv, rust_crate const *root_crate,
+ const char *name) :
interrupt_flag(0),
root_crate(root_crate),
_log(srv, this),
pthread_attr_setstacksize(&attr, 1024 * 1024);
pthread_attr_setdetachstate(&attr, true);
#endif
- root_task = new (this) rust_task(this, NULL);
+ root_task = new (this) rust_task(this, NULL, name);
+
+ if (_live_domains.replace(NULL, this) == false) {
+ _live_domains.append(this);
+ }
}
static void
rust_task *task;
rust_proxy<rust_task> *task_proxy;
while (_task_proxies.pop(&task, &task_proxy)) {
- log(rust_log::TASK, "deleting proxy 0x%" PRIxPTR
- " in dom 0x%" PRIxPTR,
- task_proxy, task_proxy->dom);
+ log(rust_log::TASK,
- "deleting proxy %" PRIxPTR " in dom %s @0x%" PRIxPTR,
++ "deleting proxy 0x%" PRIxPTR " in dom %s 0x%" PRIxPTR,
+ task_proxy, task_proxy->dom->name, task_proxy->dom);
delete task_proxy;
}
rust_port *port;
rust_proxy<rust_port> *port_proxy;
while (_port_proxies.pop(&port, &port_proxy)) {
- log(rust_log::TASK, "deleting proxy 0x%" PRIxPTR
- " in dom 0x%" PRIxPTR,
- port_proxy, port_proxy->dom);
+ log(rust_log::TASK,
- "deleting proxy %" PRIxPTR " in dom %s @0x%" PRIxPTR,
++ "deleting proxy 0x%" PRIxPTR " in dom %s 0x%" PRIxPTR,
+ port_proxy, port_proxy->dom->name, port_proxy->dom);
delete port_proxy;
}
}
rust_task *task = dead_tasks[i];
if (task->ref_count == 0) {
I(this, task->tasks_waiting_to_join.is_empty());
-
dead_tasks.swap_delete(task);
log(rust_log::TASK,
- "deleting unreferenced dead task 0x%" PRIxPTR, task);
+ "deleting unreferenced dead task %s @0x%" PRIxPTR,
+ task->name, task);
delete task;
continue;
}
if (!dead_tasks.is_empty()) {
log(rust_log::TASK, "dead tasks:");
for (size_t i = 0; i < dead_tasks.length(); i++) {
- log(rust_log::TASK, "\t task: 0x%" PRIxPTR ", ref_count: %d",
- dead_tasks[i], dead_tasks[i]->ref_count);
- log(rust_log::TASK, "\t task: %s @0x%" PRIxPTR,
- dead_tasks[i]->name, dead_tasks[i]);
++ log(rust_log::TASK, "\t task: %s 0x%" PRIxPTR ", ref_count: %d",
++ dead_tasks[i], dead_tasks[i]->name,
++ dead_tasks[i]->ref_count);
}
}
}
I(this, scheduled_task->running());
log(rust_log::TASK,
- "activating task 0x%" PRIxPTR
- ", sp=0x%" PRIxPTR
- ", ref_count=%d"
- ", state: %s",
- (uintptr_t)scheduled_task,
- scheduled_task->rust_sp,
- scheduled_task->ref_count,
- scheduled_task->state_str());
- "activating task %s @0x%" PRIxPTR ", sp=0x%" PRIxPTR,
- scheduled_task->name, (uintptr_t)scheduled_task,
- scheduled_task->rust_sp);
++ "activating task %s 0x%" PRIxPTR
++ ", sp=0x%" PRIxPTR
++ ", ref_count=%d"
++ ", state: %s",
++ scheduled_task->name,
++ (uintptr_t)scheduled_task,
++ scheduled_task->rust_sp,
++ scheduled_task->ref_count,
++ scheduled_task->state_str());
interrupt_flag = 0;
#define LOG_UPCALL_ENTRY(task) \
(task)->dom->get_log().reset_indent(0); \
(task)->log(rust_log::UPCALL, \
- "> UPCALL %s - task: 0x%" PRIxPTR \
- "> UPCALL %s - task: %s @0x%" PRIxPTR \
- " retpc: x%" PRIxPTR, \
++ "> UPCALL %s - task: %s 0x%" PRIxPTR \
+ " retpc: x%" PRIxPTR \
+ " ref_count: %d", \
__FUNCTION__, \
- (task), __builtin_return_address(0), \
+ (task)->name, (task), \
- __builtin_return_address(0)); \
++ __builtin_return_address(0), \
+ (task->ref_count)); \
(task)->dom->get_log().indent();
#else
#define LOG_UPCALL_ENTRY(task) \