Skip to content

Commit dff256c

Browse files
committed
rt: Move valgrind stack configuration out of the hot path
1 parent 81e1564 commit dff256c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rt/rust_task_thread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,14 @@ rust_task_thread::prepare_c_stack() {
389389
I(this, !extra_c_stack);
390390
if (!cached_c_stack) {
391391
cached_c_stack = create_stack(kernel, C_STACK_SIZE);
392+
config_valgrind_stack(cached_c_stack);
392393
}
393394
}
394395

395396
void
396397
rust_task_thread::unprepare_c_stack() {
397398
if (extra_c_stack) {
399+
unconfig_valgrind_stack(extra_c_stack);
398400
destroy_stack(kernel, extra_c_stack);
399401
extra_c_stack = NULL;
400402
}
@@ -412,15 +414,13 @@ rust_task_thread::borrow_c_stack() {
412414
your_stack = cached_c_stack;
413415
cached_c_stack = NULL;
414416
}
415-
config_valgrind_stack(your_stack);
416417
return your_stack;
417418
}
418419

419420
// NB: Runs on the Rust stack
420421
void
421422
rust_task_thread::return_c_stack(stk_seg *stack) {
422423
I(this, !extra_c_stack);
423-
unconfig_valgrind_stack(stack);
424424
if (!cached_c_stack) {
425425
cached_c_stack = stack;
426426
} else {

0 commit comments

Comments
 (0)