diff --git a/ChangeLog b/ChangeLog index 0e70cdeaa..4752da69a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2009-12-08 Ivan Maidanski + + * allchblk.c (GC_allochblk_nth): Don't call GC_remove_protection() + if GC_DISABLE_INCREMENTAL. + * reclaim.c (GC_reclaim_generic): Ditto. + * checksums.c (GC_page_was_ever_dirty): Add prototype. + * include/private/gc_locks.h (GC_mark_lock_holder): Don't declare + unless PARALLEL_MARK. + * include/private/gc_priv.h (GC_dirty_maintained, + GC_page_was_dirty, GC_remove_protection, GC_dirty_init): Don't + declare if GC_DISABLE_INCREMENTAL. + * include/private/gc_priv.h (GC_print_finalization_stats): Don't + declare if SMALL_CONFIG. + * include/private/gcconfig.h (CHECKSUMS): Explicitly undefine if + GC_DISABLE_INCREMENTAL (since nothing to check). + * include/private/gcconfig.h (DEFAULT_VDB): Don't define if + GC_DISABLE_INCREMENTAL. + * os_dep.c (GC_dirty_maintained): Ditto. + * mark.c (GC_initiate_gc): Don't call GC_read_dirty() if + GC_DISABLE_INCREMENTAL. + * os_dep.c (GC_gww_page_was_ever_dirty, GC_page_was_ever_dirty): + Uncomment; define only if CHECKSUMS. + 2009-12-08 Ivan Maidanski * darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call diff --git a/allchblk.c b/allchblk.c index d6a143715..6f78d4afe 100644 --- a/allchblk.c +++ b/allchblk.c @@ -794,15 +794,16 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, GC_remove_counts(hbp, (word)size_needed); return(0); /* ditto */ } - - /* Notify virtual dirty bit implementation that we are about to write. */ - /* Ensure that pointerfree objects are not protected if it's avoidable. */ - /* This also ensures that newly allocated blocks are treated as dirty. */ - /* Necessary since we don't protect free blocks. */ +# ifndef GC_DISABLE_INCREMENTAL + /* Notify virtual dirty bit implementation that we are about to */ + /* write. Ensure that pointerfree objects are not protected if */ + /* it's avoidable. This also ensures that newly allocated */ + /* blocks are treated as dirty. Necessary since we don't */ + /* protect free blocks. */ GC_ASSERT((size_needed & (HBLKSIZE-1)) == 0); GC_remove_protection(hbp, divHBLKSZ(size_needed), (hhdr -> hb_descr == 0) /* pointer-free */); - +# endif /* We just successfully allocated a block. Restart count of */ /* consecutive failures. */ GC_fail_count = 0; diff --git a/checksums.c b/checksums.c index b8135af79..e2e5a69f5 100644 --- a/checksums.c +++ b/checksums.c @@ -97,6 +97,8 @@ int GC_n_changed_errors = 0; int GC_n_clean = 0; int GC_n_dirty = 0; +GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk * h); + STATIC void GC_update_check_page(struct hblk *h, int index) { page_entry *pe = GC_sums + index; diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 0a8162c32..fd43a443a 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -176,7 +176,7 @@ # define EXIT_GC() GC_collecting = 0; GC_INNER void GC_lock(void); GC_EXTERN unsigned long GC_lock_holder; -# ifdef GC_ASSERTIONS +# if defined(GC_ASSERTIONS) && defined(PARALLEL_MARK) GC_EXTERN unsigned long GC_mark_lock_holder; # endif # endif /* GC_PTHREADS with linux_threads.c implementation */ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 339a931fc..2a5604f9f 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1316,11 +1316,6 @@ GC_EXTERN word GC_black_list_spacing; /* True incremental, not just generational, mode */ #endif /* !GC_DISABLE_INCREMENTAL */ -GC_EXTERN GC_bool GC_dirty_maintained; - /* Dirty bits are being maintained, */ - /* either for incremental collection, */ - /* or to limit the root set. */ - GC_EXTERN word GC_root_size; /* Total size of registered root sections. */ GC_EXTERN GC_bool GC_debugging_started; @@ -1901,19 +1896,26 @@ GC_EXTERN GC_bool GC_print_back_height; size_t bytes2); #endif -/* Virtual dirty bit implementation: */ -/* Each implementation exports the following: */ -GC_INNER void GC_read_dirty(void); +#ifndef GC_DISABLE_INCREMENTAL + GC_EXTERN GC_bool GC_dirty_maintained; + /* Dirty bits are being maintained, */ + /* either for incremental collection, */ + /* or to limit the root set. */ + + /* Virtual dirty bit implementation: */ + /* Each implementation exports the following: */ + GC_INNER void GC_read_dirty(void); /* Retrieve dirty bits. */ -GC_INNER GC_bool GC_page_was_dirty(struct hblk *h); + GC_INNER GC_bool GC_page_was_dirty(struct hblk *h); /* Read retrieved dirty bits. */ -GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, + GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, GC_bool pointerfree); /* h is about to be written or allocated. Ensure */ /* that it's not write protected by the virtual */ /* dirty bit implementation. */ -GC_INNER void GC_dirty_init(void); + GC_INNER void GC_dirty_init(void); +#endif /* !GC_DISABLE_INCREMENTAL */ /* Slow/general mark bit manipulation: */ GC_API_PRIV GC_bool GC_is_marked(ptr_t p); @@ -1933,7 +1935,9 @@ void GC_print_block_list(void); void GC_print_hblkfreelist(void); void GC_print_heap_sects(void); void GC_print_static_roots(void); -GC_INNER void GC_print_finalization_stats(void); +#ifndef SMALL_CONFIG + GC_INNER void GC_print_finalization_stats(void); +#endif /* void GC_dump(void); - declared in gc.h */ #ifdef KEEP_BACK_PTRS @@ -2104,7 +2108,7 @@ GC_EXTERN signed_word GC_bytes_found; # if defined(GC_PTHREADS) /* We define the thread suspension signal here, so that we can refer */ /* to it in the dirty bit implementation, if necessary. Ideally we */ - /* would allocate a (real-time ?) signal using the standard mechanism.*/ + /* would allocate a (real-time?) signal using the standard mechanism. */ /* unfortunately, there is no standard mechanism. (There is one */ /* in Linux glibc, but it's not exported.) Thus we continue to use */ /* the same hard-coded signals we've always used. */ diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index ace5472df..a1b5a15c8 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2278,6 +2278,7 @@ # undef MPROTECT_VDB # undef PCR_VDB # undef PROC_VDB +# undef CHECKSUMS # endif # ifdef USE_GLOBAL_ALLOC @@ -2303,7 +2304,7 @@ # endif # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \ - && !defined(GWW_VDB) + && !defined(GWW_VDB) && !defined(GC_DISABLE_INCREMENTAL) # define DEFAULT_VDB # endif diff --git a/mark.c b/mark.c index 072d6215d..264f91c61 100644 --- a/mark.c +++ b/mark.c @@ -259,7 +259,9 @@ GC_INNER void GC_clear_marks(void) /* mark state is invalid. */ GC_INNER void GC_initiate_gc(void) { - if (GC_dirty_maintained) GC_read_dirty(); +# ifndef GC_DISABLE_INCREMENTAL + if (GC_dirty_maintained) GC_read_dirty(); +# endif # ifdef STUBBORN_ALLOC GC_read_changed(); # endif diff --git a/os_dep.c b/os_dep.c index 62e13f178..094991da8 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2449,7 +2449,9 @@ STATIC void GC_default_push_other_roots(void) * are running on Windows 95, Windows 2000 or earlier), * MPROTECT_VDB may be defined as a fallback strategy. */ -GC_INNER GC_bool GC_dirty_maintained = FALSE; +#ifndef GC_DISABLE_INCREMENTAL + GC_INNER GC_bool GC_dirty_maintained = FALSE; +#endif #if defined(PROC_VDB) || defined(GWW_VDB) @@ -2572,7 +2574,7 @@ STATIC void GC_or_pages(page_hash_table pht1, page_hash_table pht2) get_pht_entry_from_index(GC_grungy_pages, PHT_HASH(h)); } -#if 0 +#ifdef CHECKSUMS /* Used only if PROC_VDB. */ # ifdef MPROTECT_VDB STATIC GC_bool GC_gww_page_was_ever_dirty(struct hblk * h) @@ -2583,7 +2585,7 @@ STATIC void GC_or_pages(page_hash_table pht1, page_hash_table pht2) return HDR(h) == 0 || get_pht_entry_from_index(GC_written_pages, PHT_HASH(h)); } -#endif +#endif /* CHECKSUMS */ # ifndef MPROTECT_VDB /*ARGSUSED*/ @@ -2629,14 +2631,14 @@ GC_INNER GC_bool GC_page_was_dirty(struct hblk *h) * versions are adequate. */ -#if 0 -/* Could any valid GC heap pointer ever have been written to this page? */ -/*ARGSUSED*/ -GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk *h) -{ +#ifdef CHECKSUMS + /* Could any valid GC heap pointer ever have been written to this page? */ + /*ARGSUSED*/ + GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk *h) + { return(TRUE); -} -#endif + } +#endif /* CHECKSUMS */ /* A call that: */ /* I) hints that [h, h+nblocks) is about to be written. */ @@ -2695,6 +2697,16 @@ void GC_dirty(ptr_t p) GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) {} +#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) + { + /* FIXME - implement me. */ + return(TRUE); + } +#endif /* CHECKSUMS */ + # endif /* MANUAL_VDB */ @@ -2863,8 +2875,7 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, #endif /* !THREADS */ #ifdef CHECKSUMS - void GC_record_fault(struct hblk * h); - /* From checksums.c */ + void GC_record_fault(struct hblk * h); /* from checksums.c */ #endif #if !defined(DARWIN) @@ -2927,7 +2938,7 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, GC_bool in_allocd_block; # ifdef CHECKSUMS GC_record_fault(h); -# endif /* CHECKSUMS */ +# endif # ifdef SUNOS5SIGS /* Address is only within the correct physical page. */ @@ -3375,17 +3386,19 @@ ssize_t read(int fd, void *buf, size_t nbyte) /* actually calls. */ #endif -/*ARGSUSED*/ -GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk *h) -{ +#endif /* 0 */ + +#ifdef CHECKSUMS + /*ARGSUSED*/ + GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk *h) + { # if defined(GWW_VDB) if (GC_GWW_AVAILABLE()) return GC_gww_page_was_ever_dirty(h); # endif return(TRUE); -} - -#endif /* 0 */ + } +#endif /* CHECKSUMS */ # endif /* MPROTECT_VDB */ diff --git a/reclaim.c b/reclaim.c index 3c52d1fd2..f73ee58fb 100644 --- a/reclaim.c +++ b/reclaim.c @@ -212,7 +212,9 @@ GC_INNER ptr_t GC_reclaim_generic(struct hblk * hbp, hdr *hhdr, size_t sz, ptr_t result; GC_ASSERT(GC_find_header((ptr_t)hbp) == hhdr); - GC_remove_protection(hbp, 1, (hhdr)->hb_descr == 0 /* Pointer-free? */); +# ifndef GC_DISABLE_INCREMENTAL + GC_remove_protection(hbp, 1, (hhdr)->hb_descr == 0 /* Pointer-free? */); +# endif if (init || GC_debugging_started) { result = GC_reclaim_clear(hbp, hhdr, sz, list, count); } else {