From d6836651e8424278d3112499ca7dd0bf4c808079 Mon Sep 17 00:00:00 2001 From: Petter Urkedal Date: Sun, 8 Jan 2012 17:30:42 +0800 Subject: [PATCH] Export mark-bit manipulation functions. * include/private/gc_priv.h, include/gc_mark.h: Move GC_is_marked, GC_clear_mark_bit and GC_set_mark_bit to a public header and adjust prototypes and comment. * mark.c: Adjust prototypes accordingly. --- include/gc_mark.h | 6 ++++++ include/private/gc_priv.h | 5 ----- mark.c | 12 ++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/gc_mark.h b/include/gc_mark.h index 34fedb5..17dbf71 100644 --- a/include/gc_mark.h +++ b/include/gc_mark.h @@ -219,6 +219,12 @@ typedef void (GC_CALLBACK * GC_start_callback_proc)(void); GC_API void GC_CALL GC_set_start_callback(GC_start_callback_proc); GC_API GC_start_callback_proc GC_CALL GC_get_start_callback(void); +/* Slow/general mark bit manipulation. The caller must hold the */ +/* allocation lock. */ +GC_API int GC_CALL GC_is_marked(void *); +GC_API void GC_CALL GC_clear_mark_bit(void *); +GC_API void GC_CALL GC_set_mark_bit(void *); + #ifdef __cplusplus } /* end of extern "C" */ #endif diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index d28d807..4952d04 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1932,11 +1932,6 @@ GC_EXTERN GC_bool GC_print_back_height; 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); -GC_INNER void GC_clear_mark_bit(ptr_t p); -GC_INNER void GC_set_mark_bit(ptr_t p); - /* Stubborn objects: */ void GC_read_changed(void); /* Analogous to GC_read_dirty */ GC_bool GC_page_was_changed(struct hblk * h); diff --git a/mark.c b/mark.c index 2ea24b9..467c13e 100644 --- a/mark.c +++ b/mark.c @@ -190,11 +190,11 @@ static void clear_marks_for_block(struct hblk *h, word dummy GC_ATTR_UNUSED) } /* Slow but general routines for setting/clearing/asking about mark bits */ -GC_INNER void GC_set_mark_bit(ptr_t p) +GC_API void GC_CALL GC_set_mark_bit(void *p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); - word bit_no = MARK_BIT_NO(p - (ptr_t)h, hhdr -> hb_sz); + word bit_no = MARK_BIT_NO((ptr_t)p - (ptr_t)h, hhdr -> hb_sz); if (!mark_bit_from_hdr(hhdr, bit_no)) { set_mark_bit_from_hdr(hhdr, bit_no); @@ -202,11 +202,11 @@ GC_INNER void GC_set_mark_bit(ptr_t p) } } -GC_INNER void GC_clear_mark_bit(ptr_t p) +GC_API void GC_CALL GC_clear_mark_bit(void *p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); - word bit_no = MARK_BIT_NO(p - (ptr_t)h, hhdr -> hb_sz); + word bit_no = MARK_BIT_NO((ptr_t)p - (ptr_t)h, hhdr -> hb_sz); if (mark_bit_from_hdr(hhdr, bit_no)) { size_t n_marks; @@ -224,11 +224,11 @@ GC_INNER void GC_clear_mark_bit(ptr_t p) } } -GC_bool GC_is_marked(ptr_t p) +GC_API int GC_CALL GC_is_marked(void *p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); - word bit_no = MARK_BIT_NO(p - (ptr_t)h, hhdr -> hb_sz); + word bit_no = MARK_BIT_NO((ptr_t)p - (ptr_t)h, hhdr -> hb_sz); return((GC_bool)mark_bit_from_hdr(hhdr, bit_no)); } -- 2.7.4