Skip to content

Commit

Permalink
Do not call GC_push_conditional unless PROC_VDB
Browse files Browse the repository at this point in the history
As of now, only PROC_VDB can determine whether a static root page
is dirty.  Thus, GC_push_all could be used (instead of
GC_push_conditional) in mark_rts.c for other VDB implementations.

* include/private/gcconfig.h [!PROC_VDB] (NO_VDB_FOR_STATIC_ROOTS): New
macro; add comment.
* mark_rts.c (GC_PUSH_CONDITIONAL_STATIC): New internal macro; move
comment from GC_PUSH_CONDITIONAL; mark "all" argument as used.
* mark_rts.c (GC_PUSH_CONDITIONAL): Use GC_PUSH_CONDITIONAL_STATIC();
do not test GC_DISABLE_INCREMENTAL directly.
* mark_rts.c (GC_push_conditional_with_exclusions): Remove
GC_ATTR_UNUSED for "all" argument.
  • Loading branch information
ivmai committed Aug 25, 2021
1 parent 96b3820 commit 2bae6c8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -3256,6 +3256,11 @@ EXTERN_C_BEGIN
# define DEFAULT_VDB
#endif

#if !defined(PROC_VDB) && !defined(NO_VDB_FOR_STATIC_ROOTS)
/* Cannot determine whether a static root page is dirty? */
# define NO_VDB_FOR_STATIC_ROOTS
#endif

#if ((defined(UNIX_LIKE) && (defined(DARWIN) || defined(HAIKU) \
|| defined(HURD) || defined(OPENBSD) \
|| defined(ARM32) \
Expand Down
19 changes: 12 additions & 7 deletions mark_rts.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,22 +615,27 @@ GC_API void GC_CALL GC_exclude_static_roots(void *b, void *e)
UNLOCK();
}

#ifdef NO_VDB_FOR_STATIC_ROOTS
# define GC_PUSH_CONDITIONAL_STATIC(b, t, all) \
((void)(all), GC_push_all(b, t))
#else
# define GC_PUSH_CONDITIONAL_STATIC(b, t, all) GC_push_conditional(b, t, all)
/* Do either of GC_push_all or GC_push_selected */
/* depending on the third arg. */
#endif

#if defined(WRAP_MARK_SOME) && defined(PARALLEL_MARK)
# define GC_PUSH_CONDITIONAL(b, t, all) \
(GC_parallel \
? GC_push_conditional_eager(b, t, all) \
: GC_push_conditional(b, t, all))
#elif defined(GC_DISABLE_INCREMENTAL)
# define GC_PUSH_CONDITIONAL(b, t, all) GC_push_all(b, t)
: GC_PUSH_CONDITIONAL_STATIC(b, t, all))
#else
# define GC_PUSH_CONDITIONAL(b, t, all) GC_push_conditional(b, t, all)
/* Do either of GC_push_all or GC_push_selected */
/* depending on the third arg. */
# define GC_PUSH_CONDITIONAL(b, t, all) GC_PUSH_CONDITIONAL_STATIC(b, t, all)
#endif

/* Invoke push_conditional on ranges that are not excluded. */
STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
GC_bool all GC_ATTR_UNUSED)
GC_bool all)
{
while ((word)bottom < (word)top) {
struct exclusion *next = GC_next_exclusion(bottom);
Expand Down

0 comments on commit 2bae6c8

Please sign in to comment.