diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp index e7db7ed5e340..b5af9eef1b3e 100644 --- a/src/rt/rust.cpp +++ b/src/rt/rust.cpp @@ -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 *handle = kernel->create_domain(crate, "main"); + rust_handle *handle = kernel->create_domain("main"); rust_dom *dom = handle->referent(); command_line_args *args = new (dom) command_line_args(dom, argc, argv); diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index e3bbfe394499..7c42afa8f978 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -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), diff --git a/src/rt/rust_dom.h b/src/rt/rust_dom.h index fa61aa794064..41a69d5f6e80 100644 --- a/src/rt/rust_dom.h +++ b/src/rt/rust_dom.h @@ -7,12 +7,6 @@ struct rust_dom : public kernel_owned, rc_base 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, rc_base // 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, ...); diff --git a/src/rt/rust_kernel.cpp b/src/rt/rust_kernel.cpp index e1629b4fbf33..3c2ad01128ec 100644 --- a/src/rt/rust_kernel.cpp +++ b/src/rt/rust_kernel.cpp @@ -16,13 +16,13 @@ rust_kernel::rust_kernel(rust_srv *srv) : } rust_handle * -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 *handle = internal_get_dom_handle(dom); message_queue->associate(handle); domains.append(dom); diff --git a/src/rt/rust_kernel.h b/src/rt/rust_kernel.h index 42ca469e8f18..9b81e84a9aec 100644 --- a/src/rt/rust_kernel.h +++ b/src/rt/rust_kernel.h @@ -85,8 +85,7 @@ public: rust_kernel(rust_srv *srv); - rust_handle *create_domain(rust_crate const *root_crate, - const char *name); + rust_handle *create_domain(const char *name); void destroy_domain(rust_dom *dom); bool is_deadlocked(); diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index c86a071eddf3..07c9b6e3efc1 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -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 *child_dom_handle = - kernel->create_domain(parent_dom->root_crate, name); + kernel->create_domain(name); rust_handle *child_task_handle = kernel->get_task_handle(child_dom_handle->referent()->root_task); LOG(task, mem, "child name: %s, child_dom_handle: " PTR diff --git a/src/rt/test/rust_test_runtime.cpp b/src/rt/test/rust_test_runtime.cpp index ffbc15d95f6c..c683302dec2e 100644 --- a/src/rt/test/rust_test_runtime.cpp +++ b/src/rt/test/rust_test_runtime.cpp @@ -13,7 +13,7 @@ rust_test_runtime::~rust_test_runtime() { void rust_domain_test::worker::run() { - rust_handle *handle = kernel->create_domain(NULL, "test"); + rust_handle *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 *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();