diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-04-16 17:12:56 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-04-16 17:12:56 -0700 |
commit | 57662048f3b5340f174f51c4f7d9921968aa6a1a (patch) | |
tree | 9063fea457716eb94bf0fff6f0613474f15312d5 /unwind.c | |
parent | 60b54600a7b005621b9b7125ae0e726e147a95ff (diff) | |
download | txr-57662048f3b5340f174f51c4f7d9921968aa6a1a.tar.gz txr-57662048f3b5340f174f51c4f7d9921968aa6a1a.tar.bz2 txr-57662048f3b5340f174f51c4f7d9921968aa6a1a.zip |
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.
Diffstat (limited to 'unwind.c')
-rw-r--r-- | unwind.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -33,6 +33,9 @@ #include <stdarg.h> #include <signal.h> #include "config.h" +#if HAVE_VALGRIND +#include <valgrind/memcheck.h> +#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); |