summaryrefslogtreecommitdiff
path: root/checksums.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-05-15 10:35:59 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-05-15 11:23:33 +0300
commit30613f4eb38d6aeed4f9f5ade274909c3cf838e2 (patch)
tree81eb2283dc8296db22014dcdae97dc6337f6bba5 /checksums.c
parentb52c140d37cb212f93c6247a7a06e523ce420279 (diff)
downloadbdwgc-30613f4eb38d6aeed4f9f5ade274909c3cf838e2.tar.gz
Remove stubborn objects allocation code completely
(code refactoring) * README.md (Incremental/Generational Collection): Remove information about stubborn objects; add information about GC_end_stubborn_change usage. * alloc.c [STUBBORN_ALLOC] (GC_finish_collection): Do not call GC_clean_changing_list. * checksums.c (NSUMS, GC_check_dirty): Remove comment related to stubborn objects. * checksums.c [STUBBORN_ALLOC] (GC_on_free_list): Remove. * doc/README.macros (STUBBORN_ALLOC): Likewise. * include/private/gc_priv.h [STUBBORN_ALLOC] (GC_sobjfreelist, GC_arrays._sobjfreelist, GC_changed_pages, GC_arrays._changed_pages, GC_prev_changed_pages, GC_arrays._prev_changed_pages): Likewise. * include/private/gc_priv.h (GC_read_changed, GC_page_was_changed, GC_clean_changing_list, GC_stubborn_init): Likewise. * tests/test.c (stubborn_count): Likewise. * checksums.c (GC_n_changed_errors): Likewise. * checksums.c [STUBBORN_ALLOC] (GC_update_check_page, GC_check_dirty): Do not update GC_n_changed_errors value. * checksums.c (GC_check_dirty): Do not check/print GC_n_changed_errors value. * configure.ac (checksums): Update help message (remove information about stubborn objects). * dbg_mlc.c (GC_print_obj, GC_debug_end_stubborn_change, GC_debug_realloc, GC_debug_generic_or_special_malloc): Do not handle STUBBORN object kind specially. * mallocx.c (GC_generic_or_special_malloc, GC_realloc): Likewise. * mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_next_marked_dirty): Likewise. * dbg_mlc.c [STUBBORN_ALLOC] (GC_debug_malloc_stubborn): Redirect to GC_debug_malloc; remove GC_ATTR_MALLOC. * dbg_mlc.c [STUBBORN_ALLOC] (GC_debug_change_stubborn): Change to no-op. * doc/README.amiga (WHATS NEW): Do not reference GC_malloc_stubborn. * doc/README.macros (CHECKSUMS): Update (remove information about stubborn objects). * doc/gcdescr.md (Allocation, Generational Collection and Dirty Bits): Likewise. * doc/gcinterface.md (C/C++ Interface): Likewise. * doc/leak.md (Using the Garbage Collector as Leak Detector): Likewise. * doc/gcdescr.md (Generational Collection and Dirty Bits): Add information about MANUAL_VDB. * include/gc.h (GC_malloc, GC_free, GC_realloc): Update comment (remove information about stubborn objects). * malloc.c (GC_generic_malloc_inner): Likewise. * tests/test.c (reverse_test_inner): Likewise. * include/gc.h (GC_malloc_stubborn, GC_debug_malloc_stubborn): Add GC_ATTR_DEPRECATED; remove GC_ATTR_MALLOC and GC_ATTR_ALLOC_SIZE. * include/gc.h (GC_MALLOC_STUBBORN, GC_NEW_STUBBORN): Redirect to normal GC_MALLOC/NEW; add comment that stubborn objects allocation is deprecated. * include/gc.h [GC_DEBUG] (GC_CHANGE_STUBBORN): Redirect to GC_change_stubborn (not GC_debug_change_stubborn). * include/gc.h (GC_change_stubborn): Add GC_ATTR_DEPRECATED. * include/gc.h [!CPPCHECK] (GC_debug_change_stubborn): Likewise. * include/gc.h (GC_change_stubborn, GC_debug_change_stubborn): Remove GC_ATTR_NONNULL. * include/gc.h (GC_end_stubborn_change): Add comment related to usage when the library is built with MANUAL_VDB defined. * include/gc.h [_AMIGA && !GC_AMIGA_MAKINGLIB] (GC_malloc_stubborn): Remove macro. * include/private/gc_priv.h (STUBBORN_ALLOC): Remove comment. * include/private/gc_priv.h (STUBBORN): Replace with GC_N_KINDS_INITIAL_VALUE definition. * mark.c (GC_obj_kinds): Remove initialization for STUBBORN_ALLOC element. * mark.c (GC_N_KINDS_INITIAL_VALUE): Move to gc_priv.h. * mark.c (GC_n_rescuing_pages): Define only if GC_DISABLE_INCREMENTAL. * mark.c [STUBBORN_ALLOC] (GC_initiate_gc): Do not call GC_read_changed. * misc.c [STUBBORN_ALLOC] (GC_init): Do not call GC_stubborn_init. * stubborn.c (GC_malloc_stubborn): Remove GC_ATTR_MALLOC. * tests/test.c [!VERY_SMALL_CONFIG] (cons): Replace GC_MALLOC_STUBBORN with GC_MALLOC call; update collectable_count instead of stubborn_count. * tests/test.c (check_heap_stats): Do not print stubborn_count value.
Diffstat (limited to 'checksums.c')
-rw-r--r--checksums.c43
1 files changed, 1 insertions, 42 deletions
diff --git a/checksums.c b/checksums.c
index 3af11a19..3fd7d878 100644
--- a/checksums.c
+++ b/checksums.c
@@ -17,9 +17,6 @@
/* This is debugging code intended to verify the results of dirty bit */
/* computations. Works only in a single threaded environment. */
-/* We assume that stubborn objects are changed only when they are */
-/* enabled for writing. (Certain kinds of writing are actually */
-/* safe under other conditions.) */
#define NSUMS 10000
#define OFFSET 0x10000
@@ -73,26 +70,8 @@ STATIC word GC_checksum(struct hblk *h)
return(result | 0x80000000 /* doesn't look like pointer */);
}
-#ifdef STUBBORN_ALLOC
- /* Check whether a stubborn object from the given block appears on */
- /* the appropriate free list. */
- STATIC GC_bool GC_on_free_list(struct hblk *h)
- {
- hdr * hhdr = HDR(h);
- word sz = BYTES_TO_WORDS(hhdr -> hb_sz);
- ptr_t p;
-
- if (sz > MAXOBJWORDS) return(FALSE);
- for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) {
- if (HBLKPTR(p) == h) return(TRUE);
- }
- return(FALSE);
- }
-#endif
-
int GC_n_dirty_errors = 0;
int GC_n_faulted_dirty_errors = 0;
-int GC_n_changed_errors = 0;
unsigned long GC_n_clean = 0;
unsigned long GC_n_dirty = 0;
@@ -128,16 +107,6 @@ STATIC void GC_update_check_page(struct hblk *h, int index)
/* Set breakpoint here */GC_n_dirty_errors++;
if (was_faulted) GC_n_faulted_dirty_errors++;
}
-# ifdef STUBBORN_ALLOC
- if (!HBLK_IS_FREE(hhdr)
- && hhdr -> hb_obj_kind == STUBBORN
- && !GC_page_was_changed(h)
- && !GC_on_free_list(h)) {
- /* if GC_on_free_list(h) then reclaim may have touched it */
- /* without any allocations taking place. */
- /* Set breakpoint here */GC_n_changed_errors++;
- }
-# endif
}
pe -> new_valid = TRUE;
pe -> block = h + OFFSET;
@@ -168,7 +137,7 @@ STATIC void GC_check_blocks(void)
}
}
-/* Should be called immediately after GC_read_dirty and GC_read_changed. */
+/* Should be called immediately after GC_read_dirty. */
void GC_check_dirty(void)
{
int index;
@@ -180,7 +149,6 @@ void GC_check_dirty(void)
GC_n_dirty_errors = 0;
GC_n_faulted_dirty_errors = 0;
- GC_n_changed_errors = 0;
GC_n_clean = 0;
GC_n_dirty = 0;
@@ -201,15 +169,6 @@ out:
GC_err_printf("Found %d dirty bit errors (%d were faulted)\n",
GC_n_dirty_errors, GC_n_faulted_dirty_errors);
}
- if (GC_n_changed_errors > 0) {
- GC_err_printf("Found %d changed bit errors\n", GC_n_changed_errors);
- GC_err_printf(
- "These may be benign (provoked by nonpointer changes)\n");
-# ifdef THREADS
- GC_err_printf(
- "Also expect 1 per thread currently allocating a stubborn obj\n");
-# endif
- }
for (i = 0; i < GC_n_faulted; ++i) {
GC_faulted[i] = 0; /* Don't expose block pointers to GC */
}