diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | lib.c | 6 | ||||
-rw-r--r-- | lib.h | 3 |
3 files changed, 22 insertions, 0 deletions
@@ -1,5 +1,18 @@ 2009-11-25 Kaz Kylheku <kkylheku@gmail.com> + More valgrind integration. Vector objects keep displaced pointers + to vector data; they point to element 0 which is actually the third + element of the vector. If an object is only referenced by interior + pointers, Valgrind reports it as possibly leaked. This change + conditionally adds a pointer to the true start of the vector, + if Valgrind support is enabled. + + * lib.h (struct vec): vec_true_start, new member. + + * lib.c (vector, vec_set_fill): Maintain vec_true_start. + +2009-11-25 Kaz Kylheku <kkylheku@gmail.com> + First stab at Valgrind integration. First goal: eliminate false positives when gc is accessing uninitialized parts of the stack. @@ -1378,6 +1378,9 @@ val vector(val alloc) val *v = (val *) chk_malloc(alloc_plus * sizeof *v); vec->v.type = VEC; vec->v.vec = v + 2; +#ifdef HAVE_VALGRIND + vec->v.vec_true_start = v; +#endif v[0] = alloc; v[1] = zero; return vec; @@ -1406,6 +1409,9 @@ val vec_set_fill(val vec, val fill) (new_alloc + 2)*sizeof *newvec); vec->v.vec = newvec + 2; vec->v.vec[vec_alloc] = num(new_alloc); +#ifdef HAVE_VALGRIND + vec->v.vec_true_start = newvec; +#endif } if (fill_delta > 0) { @@ -108,6 +108,9 @@ struct vec { /* vec[-2] is allocated size */ /* vec[-1] is fill pointer */ val *vec; +#ifdef HAVE_VALGRIND + val *vec_true_start; +#endif }; /* |