summaryrefslogtreecommitdiff
path: root/gcc/ggc-page.c
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2008-02-19 04:13:05 +0000
committerHans-Peter Nilsson <hp@gcc.gnu.org>2008-02-19 04:13:05 +0000
commit35dee9803d79197725f25037eb176a164499eb8d (patch)
treeea3822f937ca2bf97d74dca204d93f8e7bb15773 /gcc/ggc-page.c
parent5ff3a2088013a1ba1dd79ca6cd27cc78f5640a3d (diff)
downloadgcc-35dee9803d79197725f25037eb176a164499eb8d.tar.gz
Support valgrind 3.3 for --enable-checking=valgrind.
* system.h: Consolidate ENABLE_VALGRIND_CHECKING-dependent defines here. [!VALGRIND_MAKE_MEM_NOACCESS]: Define as VALGRIND_MAKE_NOACCESS. [!VALGRIND_MAKE_MEM_DEFINED]: Define as VALGRIND_MAKE_READABLE. [!VALGRIND_MAKE_MEM_UNDEFINED]: Define as VALGRIND_MAKE_WRITABLE. * ggc-common.c: Remove ENABLE_VALGRIND_CHECKING-dependent defines. Replace use of VALGRIND_MAKE_READABLE, VALGRIND_MAKE_WRITABLE, and VALGRIND_MAKE_NOACCESS with VALGRIND_MAKE_MEM_DEFINED, VALGRIND_MAKE_MEM_UNDEFINED, and VALGRIND_MAKE_MEM_NOACCESS respectively. * ggc-zone.c: Similar. * ggc-page.c: Similar. From-SVN: r132407
Diffstat (limited to 'gcc/ggc-page.c')
-rw-r--r--gcc/ggc-page.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 94ffd503dc4..ea637b1b63c 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -31,18 +31,6 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "params.h"
#include "tree-flow.h"
-#ifdef ENABLE_VALGRIND_CHECKING
-# ifdef HAVE_VALGRIND_MEMCHECK_H
-# include <valgrind/memcheck.h>
-# elif defined HAVE_MEMCHECK_H
-# include <memcheck.h>
-# else
-# include <valgrind.h>
-# endif
-#else
-/* Avoid #ifdef:s when we can help it. */
-#define VALGRIND_DISCARD(x)
-#endif
/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a
file open. Prefer either to valloc. */
@@ -689,7 +677,7 @@ alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size)
/* Pretend we don't have access to the allocated pages. We'll enable
access to smaller pieces of the area in ggc_alloc. Discard the
handle to avoid handle leak. */
- VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (page, size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (page, size));
return page;
}
@@ -933,7 +921,7 @@ free_page (page_entry *entry)
/* Mark the page as inaccessible. Discard the handle to avoid handle
leak. */
- VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (entry->page, entry->bytes));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (entry->page, entry->bytes));
set_page_table_entry (entry->page, NULL);
@@ -1208,7 +1196,7 @@ ggc_alloc_stat (size_t size MEM_STAT_DECL)
exact same semantics in presence of memory bugs, regardless of
ENABLE_VALGRIND_CHECKING. We override this request below. Drop the
handle to avoid handle leak. */
- VALGRIND_DISCARD (VALGRIND_MAKE_WRITABLE (result, object_size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (result, object_size));
/* `Poison' the entire allocated object, including any padding at
the end. */
@@ -1216,14 +1204,14 @@ ggc_alloc_stat (size_t size MEM_STAT_DECL)
/* Make the bytes after the end of the object unaccessible. Discard the
handle to avoid handle leak. */
- VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS ((char *) result + size,
- object_size - size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS ((char *) result + size,
+ object_size - size));
#endif
/* Tell Valgrind that the memory is there, but its content isn't
defined. The bytes at the end of the object are still marked
unaccessible. */
- VALGRIND_DISCARD (VALGRIND_MAKE_WRITABLE (result, size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (result, size));
/* Keep track of how many bytes are being allocated. This
information is used in deciding when to collect. */
@@ -1358,11 +1346,11 @@ ggc_free (void *p)
#ifdef ENABLE_GC_CHECKING
/* Poison the data, to indicate the data is garbage. */
- VALGRIND_DISCARD (VALGRIND_MAKE_WRITABLE (p, size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (p, size));
memset (p, 0xa5, size);
#endif
/* Let valgrind know the object is free. */
- VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (p, size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (p, size));
#ifdef ENABLE_GC_ALWAYS_COLLECT
/* In the completely-anal-checking mode, we do *not* immediately free
@@ -1815,11 +1803,12 @@ poison_pages (void)
so the exact same memory semantics is kept, in case
there are memory errors. We override this request
below. */
- VALGRIND_DISCARD (VALGRIND_MAKE_WRITABLE (object, size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_UNDEFINED (object,
+ size));
memset (object, 0xa5, size);
/* Drop the handle to avoid handle leak. */
- VALGRIND_DISCARD (VALGRIND_MAKE_NOACCESS (object, size));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_NOACCESS (object, size));
}
}
}