rt: Extract prepare_valgrind_stack from register_valgrind_stack

This commit is contained in:
Brian Anderson 2012-02-10 11:37:24 -08:00
parent c42492e6aa
commit 3406da49d9
4 changed files with 10 additions and 0 deletions

View file

@ -8,6 +8,10 @@ register_valgrind_stack(stk_seg *stk) {
stk->valgrind_id =
VALGRIND_STACK_REGISTER(&stk->data[0],
stk->end);
}
void
prepare_valgrind_stack(stk_seg *stk) {
#ifndef NVALGRIND
// Establish that the stack is accessible. This must be done when reusing
// old stack segments, since the act of popping the stack previously

View file

@ -42,6 +42,9 @@ destroy_stack(T allocer, stk_seg *stk) {
void
register_valgrind_stack(stk_seg *stk);
void
prepare_valgrind_stack(stk_seg *stk);
void
deregister_valgrind_stack(stk_seg *stk);

View file

@ -568,6 +568,7 @@ rust_task::new_stack(size_t requested_sz) {
stk = stk->prev;
A(thread, stk->prev == NULL, "Bogus stack ptr");
register_valgrind_stack(stk);
prepare_valgrind_stack(stk);
return;
} else {
LOG(this, mem, "existing stack is not big enough");
@ -599,6 +600,7 @@ rust_task::new_stack(size_t requested_sz) {
stk = new_stk;
register_valgrind_stack(stk);
prepare_valgrind_stack(stk);
total_stack_sz += user_stack_size(new_stk);
}

View file

@ -373,6 +373,7 @@ rust_task_thread::prepare_c_stack() {
if (!cached_c_stack) {
cached_c_stack = create_stack(kernel, C_STACK_SIZE);
register_valgrind_stack(cached_c_stack);
prepare_valgrind_stack(cached_c_stack);
}
}