diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index d12f37107a4..42b2e490404 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -367,14 +367,11 @@ rust_scheduler::init_tls() { tls_initialized = true; } -extern "C" CDECL void -record_sp(void *limit); - void rust_scheduler::place_task_in_tls(rust_task *task) { int result = pthread_setspecific(task_key, task); assert(!result && "Couldn't place the task in TLS!"); - record_sp(task->stk->data + RED_ZONE_SIZE); + task->record_stack_limit(); } rust_task * diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index d631a68f898..97e22618741 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -576,16 +576,20 @@ rust_task::new_stack(size_t stk_sz, void *args_addr, size_t args_sz) { new_sp = align_down(new_sp - (args_sz + sizeof_retaddr)); new_sp += sizeof_retaddr; memcpy(new_sp, args_addr, args_sz); - record_sp(stk_seg->data + RED_ZONE_SIZE); + record_stack_limit(); return new_sp; } void rust_task::del_stack() { del_stk(this, stk); - record_sp(stk->data + RED_ZONE_SIZE); + record_stack_limit(); } +void +rust_task::record_stack_limit() { + record_sp(stk->data + RED_ZONE_SIZE); +} // // Local Variables: // mode: C++ diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index aa5cc7d75f8..00a9fc277dc 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -199,6 +199,7 @@ rust_task : public kernel_owned, rust_cond void *new_stack(size_t stk_sz, void *args_addr, size_t args_sz); void del_stack(); + void record_stack_limit(); }; //