rt: Extract prepare_valgrind_stack from register_valgrind_stack
This commit is contained in:
@@ -8,6 +8,10 @@ register_valgrind_stack(stk_seg *stk) {
|
|||||||
stk->valgrind_id =
|
stk->valgrind_id =
|
||||||
VALGRIND_STACK_REGISTER(&stk->data[0],
|
VALGRIND_STACK_REGISTER(&stk->data[0],
|
||||||
stk->end);
|
stk->end);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
prepare_valgrind_stack(stk_seg *stk) {
|
||||||
#ifndef NVALGRIND
|
#ifndef NVALGRIND
|
||||||
// Establish that the stack is accessible. This must be done when reusing
|
// Establish that the stack is accessible. This must be done when reusing
|
||||||
// old stack segments, since the act of popping the stack previously
|
// old stack segments, since the act of popping the stack previously
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ destroy_stack(T allocer, stk_seg *stk) {
|
|||||||
void
|
void
|
||||||
register_valgrind_stack(stk_seg *stk);
|
register_valgrind_stack(stk_seg *stk);
|
||||||
|
|
||||||
|
void
|
||||||
|
prepare_valgrind_stack(stk_seg *stk);
|
||||||
|
|
||||||
void
|
void
|
||||||
deregister_valgrind_stack(stk_seg *stk);
|
deregister_valgrind_stack(stk_seg *stk);
|
||||||
|
|
||||||
|
|||||||
@@ -568,6 +568,7 @@ rust_task::new_stack(size_t requested_sz) {
|
|||||||
stk = stk->prev;
|
stk = stk->prev;
|
||||||
A(thread, stk->prev == NULL, "Bogus stack ptr");
|
A(thread, stk->prev == NULL, "Bogus stack ptr");
|
||||||
register_valgrind_stack(stk);
|
register_valgrind_stack(stk);
|
||||||
|
prepare_valgrind_stack(stk);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
LOG(this, mem, "existing stack is not big enough");
|
LOG(this, mem, "existing stack is not big enough");
|
||||||
@@ -599,6 +600,7 @@ rust_task::new_stack(size_t requested_sz) {
|
|||||||
|
|
||||||
stk = new_stk;
|
stk = new_stk;
|
||||||
register_valgrind_stack(stk);
|
register_valgrind_stack(stk);
|
||||||
|
prepare_valgrind_stack(stk);
|
||||||
total_stack_sz += user_stack_size(new_stk);
|
total_stack_sz += user_stack_size(new_stk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ rust_task_thread::prepare_c_stack() {
|
|||||||
if (!cached_c_stack) {
|
if (!cached_c_stack) {
|
||||||
cached_c_stack = create_stack(kernel, C_STACK_SIZE);
|
cached_c_stack = create_stack(kernel, C_STACK_SIZE);
|
||||||
register_valgrind_stack(cached_c_stack);
|
register_valgrind_stack(cached_c_stack);
|
||||||
|
prepare_valgrind_stack(cached_c_stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user