Skip to content

Commit

Permalink
"constant propagate" rust_new_exit_task_glue to its only use.
Browse files Browse the repository at this point in the history
  • Loading branch information
cixtor committed May 24, 2011
1 parent fbc0e84 commit fe90159
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/rt/rust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions src/rt/rust_dom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions src/rt/rust_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,6 @@ rust_crate_cache : public dom_owned<rust_crate_cache>,
void flush();
};

extern "C" void rust_new_exit_task_glue();

#include "rust_dwarf.h"

class
Expand Down
8 changes: 4 additions & 4 deletions src/rt/rust_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/rt/rust_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ rust_task : public maybe_proxy<rust_task>,

~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);
Expand Down
10 changes: 4 additions & 6 deletions src/rt/rust_upcall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -612,18 +611,17 @@ static void *rust_thread_start(void *ptr)
extern "C" CDECL maybe_proxy<rust_task> *
upcall_start_thread(rust_task *task,
rust_proxy<rust_task> *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<rust_task> *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;
Expand Down
3 changes: 1 addition & 2 deletions src/rt/test/rust_test_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ rust_task_test::worker::run() {
rust_handle<rust_dom> *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);
}
Expand Down

0 comments on commit fe90159

Please sign in to comment.