From d3b2bf9d373863eb85b6b2c4b48243ddfde7e8d9 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 1 Feb 2012 21:12:07 +0400 Subject: [PATCH] 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. --- include/gc.h | 1 + os_dep.c | 2 ++ 2 files changed, 3 insertions(+) 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 { -- 2.40.0