summaryrefslogtreecommitdiff
path: root/mark.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 /mark.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 'mark.c')
-rw-r--r--mark.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/mark.c b/mark.c
index 8dd257f3..29104656 100644
--- a/mark.c
+++ b/mark.c
@@ -82,19 +82,8 @@ GC_INNER struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
/* 0 | */ GC_DS_LENGTH, FALSE /* add length to descr */, FALSE
/*, */ OK_DISCLAIM_INITZ },
# endif
-# ifdef STUBBORN_ALLOC
- { (void **)&GC_sobjfreelist[0], 0,
- /* 0 | */ GC_DS_LENGTH, TRUE /* add length to descr */, TRUE
- /*, */ OK_DISCLAIM_INITZ },
-# endif
};
-# ifdef STUBBORN_ALLOC
-# define GC_N_KINDS_INITIAL_VALUE (STUBBORN+1)
-# else
-# define GC_N_KINDS_INITIAL_VALUE STUBBORN
-# endif
-
GC_INNER unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE;
# ifndef INITIAL_MARK_STACK_SIZE
@@ -107,7 +96,7 @@ GC_INNER unsigned GC_n_kinds = GC_N_KINDS_INITIAL_VALUE;
/* let it grow dynamically. */
# endif
-#if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC)
+#if !defined(GC_DISABLE_INCREMENTAL)
STATIC word GC_n_rescuing_pages = 0;
/* Number of dirty pages we marked from */
/* excludes ptrfree pages, etc. */
@@ -269,13 +258,10 @@ GC_INNER void GC_initiate_gc(void)
# endif
}
# endif
-# ifdef STUBBORN_ALLOC
- GC_read_changed();
-# endif
# ifdef CHECKSUMS
if (GC_incremental) GC_check_dirty();
# endif
-# if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC)
+# if !defined(GC_DISABLE_INCREMENTAL)
GC_n_rescuing_pages = 0;
# endif
if (GC_mark_state == MS_NONE) {
@@ -340,8 +326,7 @@ static void alloc_mark_stack(size_t);
} else {
scan_ptr = GC_push_next_marked_dirty(scan_ptr);
if (scan_ptr == 0) {
-# if !defined(GC_DISABLE_INCREMENTAL) \
- || defined(STUBBORN_ALLOC)
+# if !defined(GC_DISABLE_INCREMENTAL)
GC_COND_LOG_PRINTF("Marked from %lu dirty pages\n",
(unsigned long)GC_n_rescuing_pages);
# endif
@@ -1870,7 +1855,7 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr)
/* Some quick shortcuts: */
if ((/* 0 | */ GC_DS_LENGTH) == descr) return;
if (GC_block_empty(hhdr)/* nothing marked */) return;
-# if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC)
+# if !defined(GC_DISABLE_INCREMENTAL)
GC_n_rescuing_pages++;
# endif
GC_objects_are_marked = TRUE;
@@ -1931,7 +1916,7 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr)
if ((/* 0 | */ GC_DS_LENGTH) == descr)
return;
-# if !defined(GC_DISABLE_INCREMENTAL) || defined(STUBBORN_ALLOC)
+# if !defined(GC_DISABLE_INCREMENTAL)
GC_n_rescuing_pages++;
# endif
GC_objects_are_marked = TRUE;
@@ -2004,15 +1989,8 @@ STATIC struct hblk * GC_push_next_marked(struct hblk *h)
if (NULL == h) ABORT("Bad HDR() definition");
# endif
}
-# ifdef STUBBORN_ALLOC
- if (hhdr -> hb_obj_kind == STUBBORN) {
- if (GC_page_was_changed(h) && GC_block_was_dirty(h, hhdr))
- break;
- } else
-# endif
- /* else */ {
- if (GC_block_was_dirty(h, hhdr)) break;
- }
+ if (GC_block_was_dirty(h, hhdr))
+ break;
h += OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz);
hhdr = HDR(h);
}