* include/gc.h (GC_parallel, GC_enable_incremental): Update comment.
* include/private/gc_priv.h (GC_markers_m1): Define as a synonym
(macro) to GC_parallel instead of declaring a global variable (only
if PARALLEL_MARKER); update the comment.
* mark.c (GC_markers_m1): Remove global variable.
* pthread_support.c (start_mark_threads): Remove unnecessary
GC_parallel zeroing (after setting GC_markers_m1 to 0).
* win32_threads.c (start_mark_threads): Likewise.
* pthread_support.c (GC_fork_child_proc, GC_thr_init): Remove
unnecessary GC_markers_m1 zeroing (after setting GC_parallel to FALSE).
* win32_threads.c (GC_thr_init): Likewise.
* pthread_support.c (GC_thr_init): Set GC_parallel to FALSE instead of
zeroing GC_markers_m1; remove GC_parallel assignment to TRUE (since
GC_markers_m1 is set to non-zero value); add the comment.
* pthread_support.c (GC_thr_init): Set GC_parallel to FALSE instead of
zeroing GC_markers_m1; add the comment.
* pthread_support.c (GC_thr_init): Remove GC_parallel assignment to
TRUE (since GC_markers_m1 is set to non-zero value).
* win32_threads.c (GC_thr_init): Likewise.
/* PARALLEL_MARK defined and if either: */
/* Env variable GC_NPROC is set to > 1, or */
/* GC_NPROC is not set and this is an MP. */
- /* If GC_parallel is set, incremental */
+ /* If GC_parallel is on (non-zero), incremental */
/* collection is only partially functional, */
- /* and may not be desirable. This getter does */
+ /* and may not be desirable. The getter does */
/* not use or need synchronization (i.e. */
- /* acquiring the GC lock). */
+ /* acquiring the GC lock). Starting from */
+ /* GC v7.3, GC_parallel value is equal to the */
+ /* number of marker threads minus one (i.e. */
+ /* number of existing parallel marker threads */
+ /* excluding the initiating one). */
GC_API int GC_CALL GC_get_parallel(void);
#endif
/* dirty bits are available or most heap objects are pointer-free */
/* (atomic) or immutable. Don't use in leak finding mode. Ignored if */
/* GC_dont_gc is non-zero. Only the generational piece of this is */
-/* functional if GC_parallel is TRUE or if GC_time_limit is */
+/* functional if GC_parallel is non-zero or if GC_time_limit is */
/* GC_TIME_UNLIMITED. Causes thread-local variant of GC_gcj_malloc() */
/* to revert to locked allocation. Must be called before any such */
/* GC_gcj_malloc() calls. For best performance, should be called as */
/* than the main garbage collector lock; standard pthreads-based */
/* implementations should be sufficient. */
- GC_EXTERN int GC_markers_m1; /* Number of mark threads we would like */
- /* to have excluding the initiating */
- /* thread. Defined in mark.c. */
+# define GC_markers_m1 GC_parallel
+ /* Number of mark threads we would like to have */
+ /* excluding the initiating thread. */
/* The mark lock and condition variable. If the GC lock is also */
/* acquired, the GC lock must be acquired first. The mark lock is */
#define ENTRIES_TO_GET 5
-GC_INNER int GC_markers_m1 = 1; /* Normally changed by thread-library- */
- /* -specific code. */
-
/* Mark using the local mark stack until the global mark stack is empty */
/* and there are no active workers. Update GC_first_nonempty to reflect */
/* progress. */
errno);
/* Don't try to create other marker threads. */
GC_markers_m1 = i;
- if (i == 0) GC_parallel = FALSE;
break;
}
}
# ifdef PARALLEL_MARK
/* Turn off parallel marking in the child, since we are probably */
/* just going to exec, and we would have to restart mark threads. */
- GC_markers_m1 = 0;
GC_parallel = FALSE;
# endif /* PARALLEL_MARK */
RESTORE_CANCEL(fork_cancel_state);
WARN("GC_get_nprocs() returned %" WARN_PRIdPTR "\n", GC_nprocs);
GC_nprocs = 2; /* assume dual-core */
# ifdef PARALLEL_MARK
- GC_markers_m1 = 0; /* but use only one marker */
+ GC_parallel = FALSE; /* but use only one marker */
# endif
} else {
# ifdef PARALLEL_MARK
GC_nprocs, GC_markers_m1 + 1);
}
if (GC_markers_m1 <= 0) {
+ /* Disable parallel marking. */
GC_parallel = FALSE;
if (GC_print_stats) {
GC_log_printf("Single marker thread, turning off parallel marking\n");
}
} else {
- GC_parallel = TRUE;
/* Disable true incremental collection, but generational is OK. */
GC_time_limit = GC_TIME_UNLIMITED;
}
WARN("Marker thread creation failed.\n", 0);
/* Don't try to create other marker threads. */
GC_markers_m1 = i;
- if (i == 0) GC_parallel = FALSE;
break;
}
}
GC_markers_m1 = i;
# endif
if (i == 0) {
- GC_parallel = FALSE;
CloseHandle(mark_cv);
CloseHandle(builder_cv);
CloseHandle(mark_mutex_event);
}
}
- /* Set GC_parallel. */
+ /* Check whether parallel mode could be enabled. */
{
# if !defined(GC_PTHREADS_PARAMARK) && !defined(MSWINCE) \
&& !defined(DONT_USE_SIGNALANDWAIT)
) {
/* Disable parallel marking. */
GC_parallel = FALSE;
- GC_markers_m1 = 0;
} else {
# ifndef GC_PTHREADS_PARAMARK
/* Initialize Win32 event objects for parallel marking. */
|| mark_cv == (HANDLE)0)
ABORT("CreateEvent() failed");
# endif
- GC_parallel = TRUE;
/* Disable true incremental collection, but generational is OK. */
GC_time_limit = GC_TIME_UNLIMITED;
}