From: Ivan Maidanski Date: Wed, 1 Feb 2012 17:12:07 +0000 (+0400) Subject: Add assertion to GC_incremental_protection_needs, refine documentation X-Git-Tag: gc7_3alpha2~148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3b2bf9d373863eb85b6b2c4b48243ddfde7e8d9;p=gc Add assertion to GC_incremental_protection_needs, refine documentation * include/gc.h (GC_incremental_protection_needs): Improve comment. * os_dep.c (GC_incremental_protection_needs): Add assertion on GC is initialized. --- diff --git a/include/gc.h b/include/gc.h index c76e1ba4..212d175c 100644 --- a/include/gc.h +++ b/include/gc.h @@ -613,6 +613,7 @@ GC_API void GC_CALL GC_enable_incremental(void); #define GC_PROTECTS_STACK 8 /* Probably impractical. */ #define GC_PROTECTS_NONE 0 +/* The collector is assumed to be initialized before this call. */ GC_API int GC_CALL GC_incremental_protection_needs(void); /* Perform some garbage collection work, if appropriate. */ diff --git a/os_dep.c b/os_dep.c index 7cdd3bb5..c4058416 100644 --- a/os_dep.c +++ b/os_dep.c @@ -3364,6 +3364,8 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks, GC_API int GC_CALL GC_incremental_protection_needs(void) { + GC_ASSERT(GC_is_initialized); + if (GC_page_size == HBLKSIZE) { return GC_PROTECTS_POINTER_HEAP; } else {