diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp index 1e708be0a49ff..e7db7ed5e3403 100644 --- a/src/rt/rust.cpp +++ b/src/rt/rust.cpp @@ -99,8 +99,7 @@ rust_start(uintptr_t main_fn, rust_crate const *crate, int argc, } uintptr_t main_args[4] = {0, 0, 0, (uintptr_t)args->args}; - dom->root_task->start((uintptr_t)rust_new_exit_task_glue, - main_fn, + dom->root_task->start(main_fn, (uintptr_t)&main_args, sizeof(main_args)); int ret = dom->start_main_loop(); diff --git a/src/rt/rust_dom.cpp b/src/rt/rust_dom.cpp index 7a3ed513d666b..d5187ca7480ae 100644 --- a/src/rt/rust_dom.cpp +++ b/src/rt/rust_dom.cpp @@ -262,8 +262,7 @@ rust_dom::start_main_loop() { rust_timer timer(this); DLOG(this, dom, "started domain loop"); - DLOG(this, dom, "activate glue: " PTR ", exit glue: " PTR, - root_crate->get_activate_glue(), rust_new_exit_task_glue); + DLOG(this, dom, "activate glue: " PTR, root_crate->get_activate_glue()); while (number_of_live_tasks() > 0) { A(this, kernel->is_deadlocked() == false, "deadlock"); diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h index 8bbc5f0d8f604..213c724e7cea4 100644 --- a/src/rt/rust_internal.h +++ b/src/rt/rust_internal.h @@ -357,8 +357,6 @@ rust_crate_cache : public dom_owned, void flush(); }; -extern "C" void rust_new_exit_task_glue(); - #include "rust_dwarf.h" class diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 13295f5ae7d2c..09665e112986b 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -135,13 +135,13 @@ rust_task::~rust_task() cache->deref(); } +extern "C" void rust_new_exit_task_glue(); + void -rust_task::start(uintptr_t exit_task_glue, - uintptr_t spawnee_fn, +rust_task::start(uintptr_t spawnee_fn, uintptr_t args, size_t callsz) { - LOGPTR(dom, "exit-task glue", exit_task_glue); LOGPTR(dom, "from spawnee", spawnee_fn); // Set sp to last uintptr_t-sized cell of segment @@ -184,7 +184,7 @@ rust_task::start(uintptr_t exit_task_glue, *spp-- = (uintptr_t) 0x0; // retp - *spp-- = (uintptr_t) exit_task_glue; + *spp-- = (uintptr_t) rust_new_exit_task_glue; for (size_t j = 0; j < n_callee_saves; ++j) { *spp-- = (uintptr_t)NULL; diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index 88d99879ace0e..1bfe7ae4bda48 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -55,8 +55,7 @@ rust_task : public maybe_proxy, ~rust_task(); - void start(uintptr_t exit_task_glue, - uintptr_t spawnee_fn, + void start(uintptr_t spawnee_fn, uintptr_t args, size_t callsz); void grow(size_t n_frame_bytes); diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 48d6a67ce44dc..c86a071eddf35 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -560,8 +560,7 @@ upcall_start_task(rust_task *spawner, ", spawnee 0x%" PRIxPTR ", callsz %" PRIdPTR ")", task->name, task, spawnee_fn, callsz); - task->start((uintptr_t)rust_new_exit_task_glue, spawnee_fn, - args, callsz); + task->start(spawnee_fn, args, callsz); return task; } @@ -612,18 +611,17 @@ static void *rust_thread_start(void *ptr) extern "C" CDECL maybe_proxy * upcall_start_thread(rust_task *task, rust_proxy *child_task_proxy, - uintptr_t exit_task_glue, uintptr_t spawnee_fn, size_t callsz) { LOG_UPCALL_ENTRY(task); rust_dom *parenet_dom = task->dom; rust_handle *child_task_handle = child_task_proxy->handle(); LOG(task, task, - "exit_task_glue: " PTR ", spawnee_fn " PTR + "spawnee_fn " PTR ", callsz %" PRIdPTR ")", - exit_task_glue, spawnee_fn, callsz); + spawnee_fn, callsz); rust_task *child_task = child_task_handle->referent(); - child_task->start(exit_task_glue, spawnee_fn, + child_task->start(spawnee_fn, task->rust_sp, callsz); #if defined(__WIN32__) HANDLE thread; diff --git a/src/rt/test/rust_test_runtime.cpp b/src/rt/test/rust_test_runtime.cpp index 717d8b0c5f4dd..ffbc15d95f6cc 100644 --- a/src/rt/test/rust_test_runtime.cpp +++ b/src/rt/test/rust_test_runtime.cpp @@ -53,8 +53,7 @@ rust_task_test::worker::run() { rust_handle *handle = kernel->create_domain(crate, "test"); rust_dom *domain = handle->referent(); - domain->root_task->start((uintptr_t)rust_new_exit_task_glue, - (uintptr_t)&task_entry, (uintptr_t)NULL, 0); + domain->root_task->start((uintptr_t)&task_entry, (uintptr_t)NULL, 0); domain->start_main_loop(); kernel->destroy_domain(domain); }