Dead code elimination.

This commit is contained in:
Rafael Ávila de Espíndola 2011-05-24 19:07:30 -04:00
parent de2e84e5b0
commit 395940f7e3
7 changed files with 9 additions and 18 deletions

View file

@ -84,7 +84,7 @@ rust_start(uintptr_t main_fn, rust_crate const *crate, int argc,
rust_srv *srv = new rust_srv();
rust_kernel *kernel = new rust_kernel(srv);
kernel->start();
rust_handle<rust_dom> *handle = kernel->create_domain(crate, "main");
rust_handle<rust_dom> *handle = kernel->create_domain("main");
rust_dom *dom = handle->referent();
command_line_args *args = new (dom) command_line_args(dom, argc, argv);

View file

@ -4,9 +4,8 @@
rust_dom::rust_dom(rust_kernel *kernel,
rust_message_queue *message_queue, rust_srv *srv,
rust_crate const *root_crate, const char *name) :
const char *name) :
interrupt_flag(0),
root_crate(root_crate),
_log(srv, this),
log_lvl(log_note),
srv(srv),

View file

@ -7,12 +7,6 @@ struct rust_dom : public kernel_owned<rust_dom>, rc_base<rust_dom>
uintptr_t interrupt_flag;
// Fields known only by the runtime:
// NB: the root crate must remain in memory until the root of the
// tree of domains exits. All domains within this tree have a
// copy of this root_crate value and use it for finding utility
// glue.
rust_crate const *root_crate;
rust_log _log;
uint32_t log_lvl;
rust_srv *srv;
@ -49,7 +43,7 @@ struct rust_dom : public kernel_owned<rust_dom>, rc_base<rust_dom>
// domain.
rust_dom(rust_kernel *kernel,
rust_message_queue *message_queue, rust_srv *srv,
rust_crate const *root_crate, const char *name);
const char *name);
~rust_dom();
void activate(rust_task *task);
void log(rust_task *task, uint32_t level, char const *fmt, ...);

View file

@ -16,13 +16,13 @@ rust_kernel::rust_kernel(rust_srv *srv) :
}
rust_handle<rust_dom> *
rust_kernel::create_domain(const rust_crate *crate, const char *name) {
rust_kernel::create_domain(const char *name) {
_kernel_lock.lock();
rust_message_queue *message_queue =
new (this) rust_message_queue(_srv, this);
rust_srv *srv = _srv->clone();
rust_dom *dom =
new (this) rust_dom(this, message_queue, srv, crate, name);
new (this) rust_dom(this, message_queue, srv, name);
rust_handle<rust_dom> *handle = internal_get_dom_handle(dom);
message_queue->associate(handle);
domains.append(dom);

View file

@ -85,8 +85,7 @@ public:
rust_kernel(rust_srv *srv);
rust_handle<rust_dom> *create_domain(rust_crate const *root_crate,
const char *name);
rust_handle<rust_dom> *create_domain(const char *name);
void destroy_domain(rust_dom *dom);
bool is_deadlocked();

View file

@ -573,7 +573,7 @@ upcall_new_thread(rust_task *task, const char *name) {
rust_dom *parent_dom = task->dom;
rust_kernel *kernel = parent_dom->kernel;
rust_handle<rust_dom> *child_dom_handle =
kernel->create_domain(parent_dom->root_crate, name);
kernel->create_domain(name);
rust_handle<rust_task> *child_task_handle =
kernel->get_task_handle(child_dom_handle->referent()->root_task);
LOG(task, mem, "child name: %s, child_dom_handle: " PTR

View file

@ -13,7 +13,7 @@ rust_test_runtime::~rust_test_runtime() {
void
rust_domain_test::worker::run() {
rust_handle<rust_dom> *handle = kernel->create_domain(NULL, "test");
rust_handle<rust_dom> *handle = kernel->create_domain("test");
for (int i = 0; i < TASKS; i++) {
handle->referent()->create_task(NULL, "child");
}
@ -49,9 +49,8 @@ void task_entry() {
void
rust_task_test::worker::run() {
rust_crate *crate = parent->suite->crate;
rust_handle<rust_dom> *handle =
kernel->create_domain(crate, "test");
kernel->create_domain("test");
rust_dom *domain = handle->referent();
domain->root_task->start((uintptr_t)&task_entry, (uintptr_t)NULL, 0);
domain->start_main_loop();