]> granicus.if.org Git - gc/commitdiff
Export mark-bit manipulation functions.
authorPetter Urkedal <paurkedal@gmail.com>
Sun, 8 Jan 2012 09:30:42 +0000 (17:30 +0800)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 13 Jan 2012 16:00:08 +0000 (00:00 +0800)
* 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
include/private/gc_priv.h
mark.c

index 34fedb54a30c5892016ae65b9f3b9fc0555e68f5..17dbf71bbb89861d5a4cf69a83e4dc20106417f2 100644 (file)
@@ -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
index d28d8078e25a2fd2e09e640f87c4c3736e7d5fab..4952d04e8f83953a4c43d57589c3fbb534ce3f9d 100644 (file)
@@ -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 2ea24b9a223ad21d9b1dc1c1f8d0b00c8b251167..467c13e78f7f0ab2d85b85b6b44ea03ace88751f 100644 (file)
--- 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));
 }