From 57662048f3b5340f174f51c4f7d9921968aa6a1a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 16 Apr 2016 17:12:56 -0700 Subject: Valgrind support in continuations. * unwind.c (revive_cont): When scanning the stack of the revived continuation to fix up pointers, we can save the Valgrind validity bits of each word, mark it defined, and then restore the validity bits. --- unwind.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'unwind.c') diff --git a/unwind.c b/unwind.c index a521c732..7495be1e 100644 --- a/unwind.c +++ b/unwind.c @@ -33,6 +33,9 @@ #include #include #include "config.h" +#if HAVE_VALGRIND +#include +#endif #include "lib.h" #include "gc.h" #include "args.h" @@ -754,11 +757,25 @@ static val revive_cont(val dc, val arg) for (ptr = space; ptr < space + cont->size; ptr += sizeof (cnum)) { uint_ptr_t *wordptr = coerce(uint_ptr_t *, ptr); - uint_ptr_t word = *wordptr; + uint_ptr_t word; +#if HAVE_VALGRIND + uint_ptr_t vbits = 0; + + if (opt_vg_debug) { + VALGRIND_GET_VBITS(wordptr, &vbits, sizeof *wordptr); + VALGRIND_MAKE_MEM_DEFINED(wordptr, sizeof *wordptr); + } +#endif + word = *wordptr; if (word >= orig_start - frame_slack && word < orig_end && is_ptr(coerce(val, word))) *wordptr = word + delta; + +#if HAVE_VALGRIND + if (opt_vg_debug) + VALGRIND_SET_VBITS(wordptr, &vbits, sizeof *wordptr); +#endif } uw_block_begin (cont->tag, result); -- cgit v1.2.3