diff options
-rw-r--r-- | include/gc_mark.h | 7 | ||||
-rw-r--r-- | include/private/gc_priv.h | 17 | ||||
-rw-r--r-- | mark.c | 20 | ||||
-rw-r--r-- | mark_rts.c | 9 |
4 files changed, 33 insertions, 20 deletions
diff --git a/include/gc_mark.h b/include/gc_mark.h index 57bfc653..8b9b8c33 100644 --- a/include/gc_mark.h +++ b/include/gc_mark.h @@ -236,6 +236,13 @@ GC_API int GC_CALL GC_is_marked(const void *) GC_ATTR_NONNULL(1); GC_API void GC_CALL GC_clear_mark_bit(const void *) GC_ATTR_NONNULL(1); GC_API void GC_CALL GC_set_mark_bit(const void *) GC_ATTR_NONNULL(1); +/* Push everything in the given range onto the mark stack. */ +/* (GC_push_conditional pushes either all or only dirty pages depending */ +/* on the third argument.) */ +GC_API void GC_CALL GC_push_all(char * /* bottom */, char * /* top */); +GC_API void GC_CALL GC_push_conditional(char * /* bottom */, char * /* top */, + int /* bool all */); + #ifdef __cplusplus } /* end of extern "C" */ #endif diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 2ce574ba..827091a6 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -1509,19 +1509,18 @@ GC_INNER void GC_initiate_gc(void); GC_INNER GC_bool GC_collection_in_progress(void); /* Collection is in progress, or was abandoned. */ -GC_API_PRIV void GC_push_all(ptr_t bottom, ptr_t top); - /* Push everything in a range */ - /* onto mark stack. */ #ifndef GC_DISABLE_INCREMENTAL - GC_API_PRIV void GC_push_conditional(ptr_t b, ptr_t t, GC_bool all); +# define GC_PUSH_CONDITIONAL(b, t, all) \ + GC_push_conditional((ptr_t)(b), (ptr_t)(t), all) + /* Do either of GC_push_all or GC_push_selected */ + /* depending on the third arg. */ #else -# define GC_push_conditional(b, t, all) GC_push_all(b, t) +# define GC_PUSH_CONDITIONAL(b, t, all) GC_push_all((ptr_t)(b), (ptr_t)(t)) #endif - /* Do either of the above, depending */ - /* on the third arg. */ + GC_INNER void GC_push_all_stack(ptr_t b, ptr_t t); - /* As above, but consider */ - /* interior pointers as valid */ + /* As GC_push_all but consider */ + /* interior pointers as valid. */ GC_INNER void GC_push_all_eager(ptr_t b, ptr_t t); /* Same as GC_push_all_stack, but */ /* ensures that stack is scanned */ @@ -1261,12 +1261,12 @@ GC_INNER void GC_mark_init(void) * Should only be used if there is no possibility of mark stack * overflow. */ -void GC_push_all(ptr_t bottom, ptr_t top) +GC_API void GC_CALL GC_push_all(char *bottom, char *top) { register word length; - bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); - top = (ptr_t)(((word) top) & ~(ALIGNMENT-1)); + bottom = (char *)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1)); + top = (char *)(((word) top) & ~(ALIGNMENT-1)); if ((word)bottom >= (word)top) return; GC_mark_stack_top++; @@ -1334,15 +1334,15 @@ void GC_push_all(ptr_t bottom, ptr_t top) } } - void GC_push_conditional(ptr_t bottom, ptr_t top, GC_bool all) + GC_API void GC_CALL GC_push_conditional(char *bottom, char *top, int all) { if (!all) { - GC_push_selected(bottom, top, GC_page_was_dirty); + GC_push_selected((ptr_t)bottom, (ptr_t)top, GC_page_was_dirty); } else { # ifdef PROC_VDB if (GC_dirty_maintained) { /* Pages that were never dirtied cannot contain pointers. */ - GC_push_selected(bottom, top, GC_page_was_ever_dirty); + GC_push_selected((ptr_t)bottom, (ptr_t)top, GC_page_was_ever_dirty); } else # endif /* else */ { @@ -1350,7 +1350,13 @@ void GC_push_all(ptr_t bottom, ptr_t top) } } } -#endif /* !GC_DISABLE_INCREMENTAL */ +#else + GC_API void GC_CALL GC_push_conditional(char *bottom, char *top, + int all GC_ATTR_UNUSED) + { + GC_push_all(bottom, top); + } +#endif /* GC_DISABLE_INCREMENTAL */ #if defined(MSWIN32) || defined(MSWINCE) void __cdecl GC_push_one(word p) @@ -496,11 +496,11 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top, while ((word)bottom < (word)top) { next = GC_next_exclusion(bottom); if (0 == next || (word)(excl_start = next -> e_start) >= (word)top) { - GC_push_conditional(bottom, top, all); + GC_PUSH_CONDITIONAL(bottom, top, all); return; } if ((word)excl_start > (word)bottom) - GC_push_conditional(bottom, excl_start, all); + GC_PUSH_CONDITIONAL(bottom, excl_start, all); bottom = next -> e_end; } } @@ -741,8 +741,9 @@ STATIC void GC_push_regs_and_stack(ptr_t cold_gc_frame) } /* - * Call the mark routines (GC_tl_push for a single pointer, GC_push_conditional - * on groups of pointers) on every top level accessible pointer. + * Call the mark routines (GC_tl_push for a single pointer, + * GC_push_conditional on groups of pointers) on every top level + * accessible pointer. * If all is FALSE, arrange to push only possibly altered values. * Cold_gc_frame is an address inside a GC frame that * remains valid until all marking is complete. |