From d7be4abdae6165668059515e0113021be6dddeb9 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 21 Mar 2012 16:11:46 -0700 Subject: [PATCH] rt: Fix valgrind stack hints --- src/rt/rust_task.h | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index a5a33013eeaf..0da640b21321 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -363,11 +363,6 @@ rust_task::return_c_stack() { // NB: This runs on the Rust stack inline void * rust_task::next_stack(size_t stk_sz, void *args_addr, size_t args_sz) { - stk_seg *maybe_next_stack = NULL; - if (stk != NULL) { - maybe_next_stack = stk->prev; - } - new_stack_fast(stk_sz + args_sz); A(thread, stk->end - (uintptr_t)stk->data >= stk_sz + args_sz, "Did not receive enough stack"); @@ -375,16 +370,11 @@ rust_task::next_stack(size_t stk_sz, void *args_addr, size_t args_sz) { // Push the function arguments to the new stack new_sp = align_down(new_sp - args_sz); - // When reusing a stack segment we need to tell valgrind that this area of - // memory is accessible before writing to it, because the act of popping - // the stack previously made all of the stack inaccessible. - if (maybe_next_stack == stk) { - // I don't know exactly where the region ends that valgrind needs us - // to mark accessible. On x86_64 these extra bytes aren't needed, but - // on i386 we get errors without. - int fudge_bytes = 16; - reuse_valgrind_stack(stk, new_sp - fudge_bytes); - } + // I don't know exactly where the region ends that valgrind needs us + // to mark accessible. On x86_64 these extra bytes aren't needed, but + // on i386 we get errors without. + const int fudge_bytes = 16; + reuse_valgrind_stack(stk, new_sp - fudge_bytes); memcpy(new_sp, args_addr, args_sz); record_stack_limit();