1
Fork 0

"constant propagate" rust_new_exit_task_glue to its only use.

This commit is contained in:
Rafael Ávila de Espíndola 2011-05-24 15:51:22 -04:00
parent fbc0e840e3
commit fe90159b86
7 changed files with 12 additions and 20 deletions

View file

@ -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}; uintptr_t main_args[4] = {0, 0, 0, (uintptr_t)args->args};
dom->root_task->start((uintptr_t)rust_new_exit_task_glue, dom->root_task->start(main_fn,
main_fn,
(uintptr_t)&main_args, sizeof(main_args)); (uintptr_t)&main_args, sizeof(main_args));
int ret = dom->start_main_loop(); int ret = dom->start_main_loop();

View file

@ -262,8 +262,7 @@ rust_dom::start_main_loop() {
rust_timer timer(this); rust_timer timer(this);
DLOG(this, dom, "started domain loop"); DLOG(this, dom, "started domain loop");
DLOG(this, dom, "activate glue: " PTR ", exit glue: " PTR, DLOG(this, dom, "activate glue: " PTR, root_crate->get_activate_glue());
root_crate->get_activate_glue(), rust_new_exit_task_glue);
while (number_of_live_tasks() > 0) { while (number_of_live_tasks() > 0) {
A(this, kernel->is_deadlocked() == false, "deadlock"); A(this, kernel->is_deadlocked() == false, "deadlock");

View file

@ -357,8 +357,6 @@ public:
void flush(); void flush();
}; };
extern "C" void rust_new_exit_task_glue();
#include "rust_dwarf.h" #include "rust_dwarf.h"
class class

View file

@ -135,13 +135,13 @@ rust_task::~rust_task()
cache->deref(); cache->deref();
} }
extern "C" void rust_new_exit_task_glue();
void void
rust_task::start(uintptr_t exit_task_glue, rust_task::start(uintptr_t spawnee_fn,
uintptr_t spawnee_fn,
uintptr_t args, uintptr_t args,
size_t callsz) size_t callsz)
{ {
LOGPTR(dom, "exit-task glue", exit_task_glue);
LOGPTR(dom, "from spawnee", spawnee_fn); LOGPTR(dom, "from spawnee", spawnee_fn);
// Set sp to last uintptr_t-sized cell of segment // 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) 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) { for (size_t j = 0; j < n_callee_saves; ++j) {
*spp-- = (uintptr_t)NULL; *spp-- = (uintptr_t)NULL;

View file

@ -55,8 +55,7 @@ rust_task : public maybe_proxy<rust_task>,
~rust_task(); ~rust_task();
void start(uintptr_t exit_task_glue, void start(uintptr_t spawnee_fn,
uintptr_t spawnee_fn,
uintptr_t args, uintptr_t args,
size_t callsz); size_t callsz);
void grow(size_t n_frame_bytes); void grow(size_t n_frame_bytes);

View file

@ -560,8 +560,7 @@ upcall_start_task(rust_task *spawner,
", spawnee 0x%" PRIxPTR ", spawnee 0x%" PRIxPTR
", callsz %" PRIdPTR ")", task->name, task, ", callsz %" PRIdPTR ")", task->name, task,
spawnee_fn, callsz); spawnee_fn, callsz);
task->start((uintptr_t)rust_new_exit_task_glue, spawnee_fn, task->start(spawnee_fn, args, callsz);
args, callsz);
return task; return task;
} }
@ -612,18 +611,17 @@ static void *rust_thread_start(void *ptr)
extern "C" CDECL maybe_proxy<rust_task> * extern "C" CDECL maybe_proxy<rust_task> *
upcall_start_thread(rust_task *task, upcall_start_thread(rust_task *task,
rust_proxy<rust_task> *child_task_proxy, rust_proxy<rust_task> *child_task_proxy,
uintptr_t exit_task_glue,
uintptr_t spawnee_fn, uintptr_t spawnee_fn,
size_t callsz) { size_t callsz) {
LOG_UPCALL_ENTRY(task); LOG_UPCALL_ENTRY(task);
rust_dom *parenet_dom = task->dom; rust_dom *parenet_dom = task->dom;
rust_handle<rust_task> *child_task_handle = child_task_proxy->handle(); rust_handle<rust_task> *child_task_handle = child_task_proxy->handle();
LOG(task, task, LOG(task, task,
"exit_task_glue: " PTR ", spawnee_fn " PTR "spawnee_fn " PTR
", callsz %" PRIdPTR ")", ", callsz %" PRIdPTR ")",
exit_task_glue, spawnee_fn, callsz); spawnee_fn, callsz);
rust_task *child_task = child_task_handle->referent(); 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); task->rust_sp, callsz);
#if defined(__WIN32__) #if defined(__WIN32__)
HANDLE thread; HANDLE thread;

View file

@ -53,8 +53,7 @@ rust_task_test::worker::run() {
rust_handle<rust_dom> *handle = rust_handle<rust_dom> *handle =
kernel->create_domain(crate, "test"); kernel->create_domain(crate, "test");
rust_dom *domain = handle->referent(); rust_dom *domain = handle->referent();
domain->root_task->start((uintptr_t)rust_new_exit_task_glue, domain->root_task->start((uintptr_t)&task_entry, (uintptr_t)NULL, 0);
(uintptr_t)&task_entry, (uintptr_t)NULL, 0);
domain->start_main_loop(); domain->start_main_loop();
kernel->destroy_domain(domain); kernel->destroy_domain(domain);
} }