< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Print this page
rev 56944 : imported patch 8233702-function-to-clamp-value-to-range


1594     // JNI references during parallel reference processing.
1595     //
1596     // These closures do not need to synchronize with the worker
1597     // threads involved in parallel reference processing as these
1598     // instances are executed serially by the current thread (e.g.
1599     // reference processing is not multi-threaded and is thus
1600     // performed by the current thread instead of a gang worker).
1601     //
1602     // The gang tasks involved in parallel reference processing create
1603     // their own instances of these closures, which do their own
1604     // synchronization among themselves.
1605     G1CMKeepAliveAndDrainClosure g1_keep_alive(this, task(0), true /* is_serial */);
1606     G1CMDrainMarkingStackClosure g1_drain_mark_stack(this, task(0), true /* is_serial */);
1607 
1608     // We need at least one active thread. If reference processing
1609     // is not multi-threaded we use the current (VMThread) thread,
1610     // otherwise we use the work gang from the G1CollectedHeap and
1611     // we utilize all the worker threads we can.
1612     bool processing_is_mt = rp->processing_is_mt();
1613     uint active_workers = (processing_is_mt ? _g1h->workers()->active_workers() : 1U);
1614     active_workers = MAX2(MIN2(active_workers, _max_num_tasks), 1U);
1615 
1616     // Parallel processing task executor.
1617     G1CMRefProcTaskExecutor par_task_executor(_g1h, this,
1618                                               _g1h->workers(), active_workers);
1619     AbstractRefProcTaskExecutor* executor = (processing_is_mt ? &par_task_executor : NULL);
1620 
1621     // Set the concurrency level. The phase was already set prior to
1622     // executing the remark task.
1623     set_concurrency(active_workers);
1624 
1625     // Set the degree of MT processing here.  If the discovery was done MT,
1626     // the number of threads involved during discovery could differ from
1627     // the number of active workers.  This is OK as long as the discovered
1628     // Reference lists are balanced (see balance_all_queues() and balance_queues()).
1629     rp->set_active_mt_degree(active_workers);
1630 
1631     ReferenceProcessorPhaseTimes pt(_gc_timer_cm, rp->max_num_queues());
1632 
1633     // Process the weak references.
1634     const ReferenceProcessorStats& stats =




1594     // JNI references during parallel reference processing.
1595     //
1596     // These closures do not need to synchronize with the worker
1597     // threads involved in parallel reference processing as these
1598     // instances are executed serially by the current thread (e.g.
1599     // reference processing is not multi-threaded and is thus
1600     // performed by the current thread instead of a gang worker).
1601     //
1602     // The gang tasks involved in parallel reference processing create
1603     // their own instances of these closures, which do their own
1604     // synchronization among themselves.
1605     G1CMKeepAliveAndDrainClosure g1_keep_alive(this, task(0), true /* is_serial */);
1606     G1CMDrainMarkingStackClosure g1_drain_mark_stack(this, task(0), true /* is_serial */);
1607 
1608     // We need at least one active thread. If reference processing
1609     // is not multi-threaded we use the current (VMThread) thread,
1610     // otherwise we use the work gang from the G1CollectedHeap and
1611     // we utilize all the worker threads we can.
1612     bool processing_is_mt = rp->processing_is_mt();
1613     uint active_workers = (processing_is_mt ? _g1h->workers()->active_workers() : 1U);
1614     active_workers = clamp(active_workers, 1u, _max_num_tasks);
1615 
1616     // Parallel processing task executor.
1617     G1CMRefProcTaskExecutor par_task_executor(_g1h, this,
1618                                               _g1h->workers(), active_workers);
1619     AbstractRefProcTaskExecutor* executor = (processing_is_mt ? &par_task_executor : NULL);
1620 
1621     // Set the concurrency level. The phase was already set prior to
1622     // executing the remark task.
1623     set_concurrency(active_workers);
1624 
1625     // Set the degree of MT processing here.  If the discovery was done MT,
1626     // the number of threads involved during discovery could differ from
1627     // the number of active workers.  This is OK as long as the discovered
1628     // Reference lists are balanced (see balance_all_queues() and balance_queues()).
1629     rp->set_active_mt_degree(active_workers);
1630 
1631     ReferenceProcessorPhaseTimes pt(_gc_timer_cm, rp->max_num_queues());
1632 
1633     // Process the weak references.
1634     const ReferenceProcessorStats& stats =


< prev index next >