diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-11-25 13:12:28 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-11-25 13:12:28 -0800 |
commit | f95e76d93a4dbf27e15ca01f4e8b0ab7d3132a81 (patch) | |
tree | fc318779ce37ec9b967ecd67a923a7d07c5b0006 /gc.c | |
parent | 5355a54c26f6fbf6ac7a6fd74877f9ef71ab53e5 (diff) | |
download | txr-f95e76d93a4dbf27e15ca01f4e8b0ab7d3132a81.tar.gz txr-f95e76d93a4dbf27e15ca01f4e8b0ab7d3132a81.tar.bz2 txr-f95e76d93a4dbf27e15ca01f4e8b0ab7d3132a81.zip |
First stab at Valgrind integration. First goal: eliminate false
positives when gc is accessing uninitialized parts of the stack.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -32,6 +32,9 @@ #include <dirent.h> #include <wchar.h> #include "config.h" +#ifdef HAVE_VALGRIND +#include <valgrind/memcheck.h> +#endif #include "lib.h" #include "stream.h" #include "hash.h" @@ -281,6 +284,9 @@ static void mark_mem_region(val *low, val *high) while (low < high) { val maybe_obj = *low; +#ifdef HAVE_VALGRIND + VALGRIND_MAKE_MEM_DEFINED(&maybe_obj, sizeof maybe_obj); +#endif if (in_heap(maybe_obj)) { type_t t = maybe_obj->t.type; if ((t & FREE) == 0) @@ -299,10 +305,8 @@ static void mark(void) * First, scan the officially registered locations. */ - for (rootloc = prot_stack; rootloc != top; rootloc++) { - if (*rootloc) /* stack may have nulls */ - mark_obj(**rootloc); - } + for (rootloc = prot_stack; rootloc != top; rootloc++) + mark_obj(**rootloc); mark_mem_region(&gc_stack_top, gc_stack_bottom); } |