}
static void
-enqueue_scan_from_roots_jobs (char *heap_start, char *heap_end, SgenObjectOperations *ops)
+enqueue_scan_from_roots_jobs (char *heap_start, char *heap_end, SgenObjectOperations *ops, gboolean enqueue)
{
ScanFromRegisteredRootsJob *scrrj;
ScanThreadDataJob *stdj;
scrrj->heap_start = heap_start;
scrrj->heap_end = heap_end;
scrrj->root_type = ROOT_TYPE_NORMAL;
- sgen_workers_enqueue_job (&scrrj->job);
+ sgen_workers_enqueue_job (&scrrj->job, enqueue);
scrrj = (ScanFromRegisteredRootsJob*)sgen_thread_pool_job_alloc ("scan from registered roots wbarrier", job_scan_from_registered_roots, sizeof (ScanFromRegisteredRootsJob));
scrrj->ops = ops;
scrrj->heap_start = heap_start;
scrrj->heap_end = heap_end;
scrrj->root_type = ROOT_TYPE_WBARRIER;
- sgen_workers_enqueue_job (&scrrj->job);
+ sgen_workers_enqueue_job (&scrrj->job, enqueue);
/* Threads */
stdj = (ScanThreadDataJob*)sgen_thread_pool_job_alloc ("scan thread data", job_scan_thread_data, sizeof (ScanThreadDataJob));
stdj->heap_start = heap_start;
stdj->heap_end = heap_end;
- sgen_workers_enqueue_job (&stdj->job);
+ sgen_workers_enqueue_job (&stdj->job, enqueue);
/* Scan the list of objects ready for finalization. */
sfej = (ScanFinalizerEntriesJob*)sgen_thread_pool_job_alloc ("scan finalizer entries", job_scan_finalizer_entries, sizeof (ScanFinalizerEntriesJob));
sfej->queue = &fin_ready_queue;
sfej->ops = ops;
- sgen_workers_enqueue_job (&sfej->job);
+ sgen_workers_enqueue_job (&sfej->job, enqueue);
sfej = (ScanFinalizerEntriesJob*)sgen_thread_pool_job_alloc ("scan critical finalizer entries", job_scan_finalizer_entries, sizeof (ScanFinalizerEntriesJob));
sfej->queue = &critical_fin_queue;
sfej->ops = ops;
- sgen_workers_enqueue_job (&sfej->job);
+ sgen_workers_enqueue_job (&sfej->job, enqueue);
}
/*
*/
sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan remset", job_remembered_set_scan, sizeof (ScanJob));
sj->ops = object_ops;
- sgen_workers_enqueue_job (&sj->job);
+ sgen_workers_enqueue_job (&sj->job, FALSE);
/* we don't have complete write barrier yet, so we scan all the old generation sections */
TV_GETTIME (btv);
TV_GETTIME (atv);
time_minor_scan_pinned += TV_ELAPSED (btv, atv);
- enqueue_scan_from_roots_jobs (sgen_get_nursery_start (), nursery_next, object_ops);
+ enqueue_scan_from_roots_jobs (sgen_get_nursery_start (), nursery_next, object_ops, FALSE);
TV_GETTIME (btv);
time_minor_scan_roots += TV_ELAPSED (atv, btv);
* FIXME: is this the right context? It doesn't seem to contain a copy function
* unless we're concurrent.
*/
- enqueue_scan_from_roots_jobs (heap_start, heap_end, object_ops);
+ enqueue_scan_from_roots_jobs (heap_start, heap_end, object_ops, concurrent);
TV_GETTIME (btv);
time_major_scan_roots += TV_ELAPSED (atv, btv);
/* Mod union card table */
sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan mod union cardtable", job_scan_major_mod_union_card_table, sizeof (ScanJob));
sj->ops = object_ops;
- sgen_workers_enqueue_job (&sj->job);
+ sgen_workers_enqueue_job (&sj->job, TRUE);
sj = (ScanJob*)sgen_thread_pool_job_alloc ("scan LOS mod union cardtable", job_scan_los_mod_union_card_table, sizeof (ScanJob));
sj->ops = object_ops;
- sgen_workers_enqueue_job (&sj->job);
+ sgen_workers_enqueue_job (&sj->job, TRUE);
TV_GETTIME (atv);
time_major_scan_mod_union += TV_ELAPSED (btv, atv);
} while (!set_state (old_state, STATE_NOT_WORKING));
}
-static gboolean
-collection_needs_workers (void)
-{
- return sgen_collection_is_concurrent ();
-}
-
void
-sgen_workers_enqueue_job (SgenThreadPoolJob *job)
+sgen_workers_enqueue_job (SgenThreadPoolJob *job, gboolean enqueue)
{
- if (!collection_needs_workers ()) {
+ if (!enqueue) {
job->func (NULL, job);
sgen_thread_pool_job_free (job);
return;
void
sgen_workers_init_distribute_gray_queue (void)
{
- SGEN_ASSERT (0, sgen_get_major_collector ()->is_concurrent && collection_needs_workers (),
+ SGEN_ASSERT (0, sgen_get_major_collector ()->is_concurrent,
"Why should we init the distribute gray queue if we don't need it?");
init_distribute_gray_queue ();
}
void
sgen_workers_start_all_workers (SgenObjectOperations *object_ops)
{
- if (!collection_needs_workers ())
- return;
-
idle_func_object_ops = object_ops;
mono_memory_write_barrier ();
{
int i;
- if (!collection_needs_workers ())
- return;
-
sgen_thread_pool_wait_for_all_jobs ();
sgen_thread_pool_idle_wait ();
SGEN_ASSERT (0, workers_state == STATE_NOT_WORKING, "Can only signal enqueue work when in no work state");