Skip to content

Commit 395940f

Browse files
committed
Dead code elimination.
1 parent de2e84e commit 395940f

File tree

7 files changed

+9
-18
lines changed

7 files changed

+9
-18
lines changed

src/rt/rust.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ rust_start(uintptr_t main_fn, rust_crate const *crate, int argc,
8484
rust_srv *srv = new rust_srv();
8585
rust_kernel *kernel = new rust_kernel(srv);
8686
kernel->start();
87-
rust_handle<rust_dom> *handle = kernel->create_domain(crate, "main");
87+
rust_handle<rust_dom> *handle = kernel->create_domain("main");
8888
rust_dom *dom = handle->referent();
8989
command_line_args *args = new (dom) command_line_args(dom, argc, argv);
9090

src/rt/rust_dom.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
rust_dom::rust_dom(rust_kernel *kernel,
66
rust_message_queue *message_queue, rust_srv *srv,
7-
rust_crate const *root_crate, const char *name) :
7+
const char *name) :
88
interrupt_flag(0),
9-
root_crate(root_crate),
109
_log(srv, this),
1110
log_lvl(log_note),
1211
srv(srv),

src/rt/rust_dom.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ struct rust_dom : public kernel_owned<rust_dom>, rc_base<rust_dom>
77
uintptr_t interrupt_flag;
88

99
// Fields known only by the runtime:
10-
11-
// NB: the root crate must remain in memory until the root of the
12-
// tree of domains exits. All domains within this tree have a
13-
// copy of this root_crate value and use it for finding utility
14-
// glue.
15-
rust_crate const *root_crate;
1610
rust_log _log;
1711
uint32_t log_lvl;
1812
rust_srv *srv;
@@ -49,7 +43,7 @@ struct rust_dom : public kernel_owned<rust_dom>, rc_base<rust_dom>
4943
// domain.
5044
rust_dom(rust_kernel *kernel,
5145
rust_message_queue *message_queue, rust_srv *srv,
52-
rust_crate const *root_crate, const char *name);
46+
const char *name);
5347
~rust_dom();
5448
void activate(rust_task *task);
5549
void log(rust_task *task, uint32_t level, char const *fmt, ...);

src/rt/rust_kernel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ rust_kernel::rust_kernel(rust_srv *srv) :
1616
}
1717

1818
rust_handle<rust_dom> *
19-
rust_kernel::create_domain(const rust_crate *crate, const char *name) {
19+
rust_kernel::create_domain(const char *name) {
2020
_kernel_lock.lock();
2121
rust_message_queue *message_queue =
2222
new (this) rust_message_queue(_srv, this);
2323
rust_srv *srv = _srv->clone();
2424
rust_dom *dom =
25-
new (this) rust_dom(this, message_queue, srv, crate, name);
25+
new (this) rust_dom(this, message_queue, srv, name);
2626
rust_handle<rust_dom> *handle = internal_get_dom_handle(dom);
2727
message_queue->associate(handle);
2828
domains.append(dom);

src/rt/rust_kernel.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ class rust_kernel : public rust_thread {
8585

8686
rust_kernel(rust_srv *srv);
8787

88-
rust_handle<rust_dom> *create_domain(rust_crate const *root_crate,
89-
const char *name);
88+
rust_handle<rust_dom> *create_domain(const char *name);
9089
void destroy_domain(rust_dom *dom);
9190

9291
bool is_deadlocked();

src/rt/rust_upcall.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ upcall_new_thread(rust_task *task, const char *name) {
573573
rust_dom *parent_dom = task->dom;
574574
rust_kernel *kernel = parent_dom->kernel;
575575
rust_handle<rust_dom> *child_dom_handle =
576-
kernel->create_domain(parent_dom->root_crate, name);
576+
kernel->create_domain(name);
577577
rust_handle<rust_task> *child_task_handle =
578578
kernel->get_task_handle(child_dom_handle->referent()->root_task);
579579
LOG(task, mem, "child name: %s, child_dom_handle: " PTR

src/rt/test/rust_test_runtime.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rust_test_runtime::~rust_test_runtime() {
1313

1414
void
1515
rust_domain_test::worker::run() {
16-
rust_handle<rust_dom> *handle = kernel->create_domain(NULL, "test");
16+
rust_handle<rust_dom> *handle = kernel->create_domain("test");
1717
for (int i = 0; i < TASKS; i++) {
1818
handle->referent()->create_task(NULL, "child");
1919
}
@@ -49,9 +49,8 @@ void task_entry() {
4949

5050
void
5151
rust_task_test::worker::run() {
52-
rust_crate *crate = parent->suite->crate;
5352
rust_handle<rust_dom> *handle =
54-
kernel->create_domain(crate, "test");
53+
kernel->create_domain("test");
5554
rust_dom *domain = handle->referent();
5655
domain->root_task->start((uintptr_t)&task_entry, (uintptr_t)NULL, 0);
5756
domain->start_main_loop();

0 commit comments

Comments
 (0)