diff options
| author | Jon Morton <jonanin@gmail.com> | 2012-04-02 00:13:39 -0500 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-04-02 14:21:08 -0700 |
| commit | 33a949eed6e6a5f2cba72663d92a0012e5439d80 (patch) | |
| tree | 59f07f38799aa1cc90b6d9e76d402c8e1dc2f323 /src/rt/rust_upcall.cpp | |
| parent | d0268cbe5f1347a1dc2a5762a981595687f161b6 (diff) | |
| download | rust-33a949eed6e6a5f2cba72663d92a0012e5439d80.tar.gz rust-33a949eed6e6a5f2cba72663d92a0012e5439d80.zip | |
Add global rust_get_current_task
Previously two methods existed: rust_sched_loop::get_task and rust_task::get_task_from_tcb. Merge both of them into one, trying the faster one (tcb) first, and if that fails, the slower one from the tls.
Diffstat (limited to 'src/rt/rust_upcall.cpp')
| -rw-r--r-- | src/rt/rust_upcall.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index def10eb9b21..56446ab83a3 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -47,7 +47,7 @@ static void check_stack_alignment() { } inline void call_upcall_on_c_stack(void *args, void *fn_ptr) { check_stack_alignment(); - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); task->call_on_c_stack(args, fn_ptr); } @@ -62,7 +62,7 @@ extern "C" void record_sp_limit(void *limit); */ extern "C" CDECL void upcall_call_shim_on_c_stack(void *args, void *fn_ptr) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); // FIXME (1226) - The shim functions generated by rustc contain the // morestack prologue, so we need to let them know they have enough @@ -85,7 +85,7 @@ upcall_call_shim_on_c_stack(void *args, void *fn_ptr) { */ extern "C" CDECL void upcall_call_shim_on_rust_stack(void *args, void *fn_ptr) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); // FIXME: Because of the hack in the other function that disables the // stack limit when entering the C stack, here we restore the stack limit @@ -116,7 +116,7 @@ struct s_fail_args { extern "C" CDECL void upcall_s_fail(s_fail_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); LOG_ERR(task, upcall, "upcall fail '%s', %s:%" PRIdPTR, args->expr, args->file, args->line); @@ -142,7 +142,7 @@ struct s_malloc_args { extern "C" CDECL void upcall_s_malloc(s_malloc_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); LOG(task, mem, "upcall malloc(0x%" PRIxPTR ")", args->td); @@ -179,7 +179,7 @@ struct s_free_args { extern "C" CDECL void upcall_s_free(s_free_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); rust_sched_loop *sched_loop = task->sched_loop; @@ -225,7 +225,7 @@ struct s_shared_malloc_args { extern "C" CDECL void upcall_s_shared_malloc(s_shared_malloc_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); LOG(task, mem, "upcall shared_malloc(%" PRIdPTR ")", args->nbytes); @@ -253,7 +253,7 @@ struct s_shared_free_args { extern "C" CDECL void upcall_s_shared_free(s_shared_free_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); rust_sched_loop *sched_loop = task->sched_loop; @@ -277,7 +277,7 @@ struct s_shared_realloc_args { extern "C" CDECL void upcall_s_shared_realloc(s_shared_realloc_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); args->retval = task->kernel->realloc(args->ptr, args->size); } @@ -298,7 +298,7 @@ struct s_vec_grow_args { extern "C" CDECL void upcall_s_vec_grow(s_vec_grow_args *args) { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); LOG_UPCALL_ENTRY(task); reserve_vec(task, args->vp, args->new_sz); (*args->vp)->fill = args->new_sz; @@ -320,7 +320,7 @@ extern "C" CDECL void upcall_s_str_concat(s_str_concat_args *args) { rust_vec *lhs = args->lhs; rust_vec *rhs = args->rhs; - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); size_t fill = lhs->fill + rhs->fill - 1; rust_vec* v = (rust_vec*)task->kernel->malloc(fill + sizeof(rust_vec), "str_concat"); @@ -377,7 +377,7 @@ upcall_rust_personality(int version, s_rust_personality_args args = {(_Unwind_Reason_Code)0, version, actions, exception_class, ue_header, context}; - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); // The personality function is run on the stack of the // last function that threw or landed, which is going @@ -444,7 +444,7 @@ upcall_log_type(const type_desc *tydesc, uint8_t *data, uint32_t level) { // NB: This needs to be blazing fast. Don't switch stacks extern "C" CDECL void * upcall_new_stack(size_t stk_sz, void *args_addr, size_t args_sz) { - rust_task *task = rust_task::get_task_from_tcb(); + rust_task *task = rust_get_current_task(); return task->next_stack(stk_sz, args_addr, args_sz); @@ -453,7 +453,7 @@ upcall_new_stack(size_t stk_sz, void *args_addr, size_t args_sz) { // NB: This needs to be blazing fast. Don't switch stacks extern "C" CDECL void upcall_del_stack() { - rust_task *task = rust_task::get_task_from_tcb(); + rust_task *task = rust_get_current_task(); task->prev_stack(); } @@ -463,7 +463,7 @@ upcall_del_stack() { // needs to acquire the value of the stack pointer extern "C" CDECL void upcall_reset_stack_limit() { - rust_task *task = rust_sched_loop::get_task(); + rust_task *task = rust_get_current_task(); task->reset_stack_limit(); } |
