From b898fa85675826496de2c476276ff8ca4af756bf Mon Sep 17 00:00:00 2001 From: ivmai Date: Thu, 5 May 2011 05:24:48 +0000 Subject: [PATCH] 2011-05-05 Ivan Maidanski * dbg_mlc.c (GC_has_other_debug_info): Fix punctuation in the comment. * dbg_mlc.c (GC_FREED_MEM_MARKER): New macro. * dbg_mlc.c (GC_debug_free): Use GC_FREED_MEM_MARKER. * dbg_mlc.c (GC_smashed): Refine documentation. * mark.c (GC_push_selected): Change dirty_fn return type to GC_bool. * os_dep.c (GC_page_was_ever_dirty): Make GC_INNER. * reclaim.c (GC_reclaim_small_nonempty_block): Remove "kind" local variable. * reclaim.c (GC_reclaim_block): Pass true constant to GC_reclaim_small_nonempty_block (instead of report_if_found). * doc/README.autoconf: Update; fix a typo. * include/private/gcconfig.h (GC_WORD_C): New macro. --- ChangeLog | 17 +++++++++++++++++ dbg_mlc.c | 21 +++++++++++++++------ doc/README.autoconf | 6 +++--- include/private/gcconfig.h | 12 +++++++++++- mark.c | 2 +- os_dep.c | 2 +- reclaim.c | 8 +++----- 7 files changed, 51 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index e067b2ce..d6278469 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2011-05-05 Ivan Maidanski + + * dbg_mlc.c (GC_has_other_debug_info): Fix punctuation in the + comment. + * dbg_mlc.c (GC_FREED_MEM_MARKER): New macro. + * dbg_mlc.c (GC_debug_free): Use GC_FREED_MEM_MARKER. + * dbg_mlc.c (GC_smashed): Refine documentation. + * mark.c (GC_push_selected): Change dirty_fn return type to + GC_bool. + * os_dep.c (GC_page_was_ever_dirty): Make GC_INNER. + * reclaim.c (GC_reclaim_small_nonempty_block): Remove "kind" + local variable. + * reclaim.c (GC_reclaim_block): Pass true constant to + GC_reclaim_small_nonempty_block (instead of report_if_found). + * doc/README.autoconf: Update; fix a typo. + * include/private/gcconfig.h (GC_WORD_C): New macro. + 2011-05-03 Ivan Maidanski * dbg_mlc.c (GC_store_debug_info_inner): Cast "linenum". diff --git a/dbg_mlc.c b/dbg_mlc.c index 72b5f177..b2671c1c 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -25,7 +25,7 @@ GC_INNER void GC_default_print_heap_obj_proc(ptr_t p); #ifndef SHORT_DBG_HDRS - /* Check whether object with base pointer p has debugging info */ + /* Check whether object with base pointer p has debugging info. */ /* p is assumed to point to a legitimate object in our part */ /* of the heap. */ /* This excludes the check as to whether the back pointer is */ @@ -745,6 +745,14 @@ GC_API void * GC_CALL GC_debug_malloc_uncollectable(size_t lb, } #endif /* ATOMIC_UNCOLLECTABLE */ +#ifndef GC_FREED_MEM_MARKER +# if CPP_WORDSZ == 32 +# define GC_FREED_MEM_MARKER 0xdeadbeef +# else +# define GC_FREED_MEM_MARKER GC_WORD_C(0xEFBEADDEdeadbeef) +# endif +#endif + GC_API void GC_CALL GC_debug_free(void * p) { ptr_t base; @@ -787,7 +795,8 @@ GC_API void GC_CALL GC_debug_free(void * p) size_t i; size_t obj_sz = BYTES_TO_WORDS(hhdr -> hb_sz - sizeof(oh)); - for (i = 0; i < obj_sz; ++i) ((word *)p)[i] = 0xdeadbeef; + for (i = 0; i < obj_sz; ++i) + ((word *)p)[i] = GC_FREED_MEM_MARKER; GC_ASSERT((word *)p + i == (word *)(base + hhdr -> hb_sz)); } } /* !GC_find_leak */ @@ -870,10 +879,10 @@ GC_API void * GC_CALL GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS) #ifndef SHORT_DBG_HDRS -/* List of smashed objects. We defer printing these, since we can't */ -/* always print them nicely with the allocation lock held. */ -/* We put them here instead of in GC_arrays, since it may be useful to */ -/* be able to look at them with the debugger. */ +/* List of smashed (clobbered) locations. We defer printing these, */ +/* since we can't always print them nicely with the allocation lock */ +/* held. We put them here instead of in GC_arrays, since it may be */ +/* useful to be able to look at them with the debugger. */ #ifndef MAX_SMASHED # define MAX_SMASHED 20 #endif diff --git a/doc/README.autoconf b/doc/README.autoconf index f8640bec..94833f65 100644 --- a/doc/README.autoconf +++ b/doc/README.autoconf @@ -1,4 +1,4 @@ -As of GC6.0alpha8, we attempt to support GNU-style builds based on automake, +Starting from GC v6.0, we support GNU-style builds based on automake, autoconf and libtool. This is based almost entirely on Tom Tromey's work with gcj. @@ -36,7 +36,7 @@ as well as the sources needed to regenerate the derived files. (If I missed some, please let me know.) Note that the distribution comes with a "Makefile" which will be overwritten -by "configure" with one that is not at all equiavelent to the original. The +by "configure" with one that is not at all equivalent to the original. The distribution contains a copy of the original "Makefile" in "Makefile.direct". Important options to configure: @@ -48,7 +48,7 @@ Important options to configure: --enable-threads=TYPE choose threading package --enable-parallel-mark parallelize marking and free list construction --enable-gc-debug (--enable-full-debug before about 7.0) - include full support for pointer backtracing etc. + include full support for pointer back-tracing etc. Unless --prefix is set (or --exec-prefix or one of the more obscure options), diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index f541d7a7..301b200e 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2536,7 +2536,17 @@ /* strtoul() fits since sizeof(long) >= sizeof(word). */ # define STRTOULL strtoul # endif -#endif +#endif /* !STRTOULL */ + +#ifndef GC_WORD_C +# if defined(_WIN64) && !defined(__GNUC__) +# define GC_WORD_C(val) val##ui64 +# elif defined(_LLP64) || defined(__LLP64__) || defined(_WIN64) +# define GC_WORD_C(val) val##ULL +# else +# define GC_WORD_C(val) ((word)val##UL) +# endif +#endif /* !GC_WORD_C */ #if defined(SPARC) # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */ diff --git a/mark.c b/mark.c index 8a3610dc..5fd37aef 100644 --- a/mark.c +++ b/mark.c @@ -1292,7 +1292,7 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top) * in the event of a stack overflow.) */ STATIC void GC_push_selected(ptr_t bottom, ptr_t top, - int (*dirty_fn)(struct hblk *), + GC_bool (*dirty_fn)(struct hblk *), void (*push_fn)(ptr_t, ptr_t)) { struct hblk * h; diff --git a/os_dep.c b/os_dep.c index 39ca4384..1192ebd5 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2894,7 +2894,7 @@ STATIC void GC_default_push_other_roots(void) # ifdef CHECKSUMS /* Could any valid GC heap pointer ever have been written to this page? */ /*ARGSUSED*/ - GC_bool GC_page_was_ever_dirty(struct hblk *h) + GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk *h) { /* FIXME - implement me. */ return(TRUE); diff --git a/reclaim.c b/reclaim.c index 6a204f71..f9bfd851 100644 --- a/reclaim.c +++ b/reclaim.c @@ -254,8 +254,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp, { hdr *hhdr = HDR(hbp); size_t sz = hhdr -> hb_sz; - int kind = hhdr -> hb_obj_kind; - struct obj_kind * ok = &GC_obj_kinds[kind]; + struct obj_kind * ok = &GC_obj_kinds[hhdr -> hb_obj_kind]; void **flh = &(ok -> ok_freelist[BYTES_TO_GRANULES(sz)]); hhdr -> hb_last_reclaimed = (unsigned short) GC_gc_no; @@ -263,8 +262,7 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp, if (report_if_found) { GC_reclaim_check(hbp, hhdr, sz); } else { - *flh = GC_reclaim_generic(hbp, hhdr, sz, - ok -> ok_init, + *flh = GC_reclaim_generic(hbp, hhdr, sz, ok -> ok_init, *flh, &GC_bytes_found); } } @@ -322,7 +320,7 @@ STATIC void GC_reclaim_block(struct hblk *hbp, word report_if_found) GC_atomic_in_use += sz * hhdr -> hb_n_marks; } if (report_if_found) { - GC_reclaim_small_nonempty_block(hbp, (GC_bool)report_if_found); + GC_reclaim_small_nonempty_block(hbp, TRUE /* report_if_found */); } else if (empty) { GC_bytes_found += HBLKSIZE; GC_freehblk(hbp); -- 2.40.0