Skip to content

Commit

Permalink
2009-12-08 Ivan Maidanski <[email protected]>
Browse files Browse the repository at this point in the history
	* 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.
  • Loading branch information
ivmai authored and ivmai committed Jul 26, 2011
1 parent 197742f commit 61d0de0
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 42 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2009-12-08 Ivan Maidanski <[email protected]>

* 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 <[email protected]>

* darwin_stop_world.c (GC_push_all_stacks): Fix a bug (call
Expand Down
13 changes: 7 additions & 6 deletions allchblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions checksums.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/private/gc_locks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
30 changes: 17 additions & 13 deletions include/private/gc_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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. */
Expand Down
3 changes: 2 additions & 1 deletion include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -2278,6 +2278,7 @@
# undef MPROTECT_VDB
# undef PCR_VDB
# undef PROC_VDB
# undef CHECKSUMS
# endif

# ifdef USE_GLOBAL_ALLOC
Expand All @@ -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

Expand Down
4 changes: 3 additions & 1 deletion mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 32 additions & 19 deletions os_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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*/
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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 */


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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 */

Expand Down
4 changes: 3 additions & 1 deletion reclaim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 61d0de0

Please sign in to comment.