13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "classfile/classLoaderDataGraph.hpp"
26 #include "classfile/stringTable.hpp"
27 #include "code/codeCache.hpp"
28 #include "compiler/oopMap.hpp"
29 #include "gc/parallel/parallelScavengeHeap.hpp"
30 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
31 #include "gc/parallel/psClosure.inline.hpp"
32 #include "gc/parallel/psCompactionManager.hpp"
33 #include "gc/parallel/psParallelCompact.inline.hpp"
34 #include "gc/parallel/psPromotionManager.inline.hpp"
35 #include "gc/parallel/psRootType.hpp"
36 #include "gc/parallel/psScavenge.inline.hpp"
37 #include "gc/shared/gcCause.hpp"
38 #include "gc/shared/gcHeapSummary.hpp"
39 #include "gc/shared/gcId.hpp"
40 #include "gc/shared/gcLocker.hpp"
41 #include "gc/shared/gcTimer.hpp"
42 #include "gc/shared/gcTrace.hpp"
43 #include "gc/shared/gcTraceTime.inline.hpp"
44 #include "gc/shared/gcVMOperations.hpp"
45 #include "gc/shared/isGCActiveMark.hpp"
46 #include "gc/shared/oopStorage.inline.hpp"
47 #include "gc/shared/oopStorageSetParState.inline.hpp"
48 #include "gc/shared/oopStorageParState.inline.hpp"
49 #include "gc/shared/referencePolicy.hpp"
50 #include "gc/shared/referenceProcessor.hpp"
51 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
52 #include "gc/shared/scavengableNMethods.hpp"
187 : _promotion_manager(pm), _terminator(terminator), _worker_id(worker_id) {}
188
189 virtual void do_void() {
190 assert(_promotion_manager != nullptr, "Sanity");
191 _promotion_manager->drain_stacks(true);
192 guarantee(_promotion_manager->stacks_empty(),
193 "stacks should be empty at this point");
194
195 if (_terminator != nullptr) {
196 steal_work(*_terminator, _worker_id);
197 }
198 }
199 };
200
201 class ParallelScavengeRefProcProxyTask : public RefProcProxyTask {
202 TaskTerminator _terminator;
203
204 public:
205 ParallelScavengeRefProcProxyTask(uint max_workers)
206 : RefProcProxyTask("ParallelScavengeRefProcProxyTask", max_workers),
207 _terminator(max_workers, ParCompactionManager::marking_stacks()) {}
208
209 void work(uint worker_id) override {
210 assert(worker_id < _max_workers, "sanity");
211 PSPromotionManager* promotion_manager = (_tm == RefProcThreadModel::Single) ? PSPromotionManager::vm_thread_promotion_manager() : PSPromotionManager::gc_thread_promotion_manager(worker_id);
212 PSIsAliveClosure is_alive;
213 PSKeepAliveClosure keep_alive(promotion_manager);
214 BarrierEnqueueDiscoveredFieldClosure enqueue;
215 PSEvacuateFollowersClosure complete_gc(promotion_manager, (_marks_oops_alive && _tm == RefProcThreadModel::Multi) ? &_terminator : nullptr, worker_id);;
216 _rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
217 }
218
219 void prepare_run_task_hook() override {
220 _terminator.reset_for_reuse(_queue_count);
221 }
222 };
223
224 class PSThreadRootsTaskClosure : public ThreadClosure {
225 uint _worker_id;
226 public:
227 PSThreadRootsTaskClosure(uint worker_id) : _worker_id(worker_id) { }
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "classfile/classLoaderDataGraph.hpp"
26 #include "classfile/stringTable.hpp"
27 #include "code/codeCache.hpp"
28 #include "compiler/oopMap.hpp"
29 #include "gc/parallel/parallelScavengeHeap.hpp"
30 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
31 #include "gc/parallel/psClosure.inline.hpp"
32 #include "gc/parallel/psCompactionManager.hpp"
33 #include "gc/parallel/psCompactionManagerNew.hpp"
34 #include "gc/parallel/psParallelCompact.inline.hpp"
35 #include "gc/parallel/psPromotionManager.inline.hpp"
36 #include "gc/parallel/psRootType.hpp"
37 #include "gc/parallel/psScavenge.inline.hpp"
38 #include "gc/shared/gcCause.hpp"
39 #include "gc/shared/gcHeapSummary.hpp"
40 #include "gc/shared/gcId.hpp"
41 #include "gc/shared/gcLocker.hpp"
42 #include "gc/shared/gcTimer.hpp"
43 #include "gc/shared/gcTrace.hpp"
44 #include "gc/shared/gcTraceTime.inline.hpp"
45 #include "gc/shared/gcVMOperations.hpp"
46 #include "gc/shared/isGCActiveMark.hpp"
47 #include "gc/shared/oopStorage.inline.hpp"
48 #include "gc/shared/oopStorageSetParState.inline.hpp"
49 #include "gc/shared/oopStorageParState.inline.hpp"
50 #include "gc/shared/referencePolicy.hpp"
51 #include "gc/shared/referenceProcessor.hpp"
52 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
53 #include "gc/shared/scavengableNMethods.hpp"
188 : _promotion_manager(pm), _terminator(terminator), _worker_id(worker_id) {}
189
190 virtual void do_void() {
191 assert(_promotion_manager != nullptr, "Sanity");
192 _promotion_manager->drain_stacks(true);
193 guarantee(_promotion_manager->stacks_empty(),
194 "stacks should be empty at this point");
195
196 if (_terminator != nullptr) {
197 steal_work(*_terminator, _worker_id);
198 }
199 }
200 };
201
202 class ParallelScavengeRefProcProxyTask : public RefProcProxyTask {
203 TaskTerminator _terminator;
204
205 public:
206 ParallelScavengeRefProcProxyTask(uint max_workers)
207 : RefProcProxyTask("ParallelScavengeRefProcProxyTask", max_workers),
208 _terminator(max_workers, UseCompactObjectHeaders ? ParCompactionManagerNew::marking_stacks() : ParCompactionManager::marking_stacks()) {}
209
210 void work(uint worker_id) override {
211 assert(worker_id < _max_workers, "sanity");
212 PSPromotionManager* promotion_manager = (_tm == RefProcThreadModel::Single) ? PSPromotionManager::vm_thread_promotion_manager() : PSPromotionManager::gc_thread_promotion_manager(worker_id);
213 PSIsAliveClosure is_alive;
214 PSKeepAliveClosure keep_alive(promotion_manager);
215 BarrierEnqueueDiscoveredFieldClosure enqueue;
216 PSEvacuateFollowersClosure complete_gc(promotion_manager, (_marks_oops_alive && _tm == RefProcThreadModel::Multi) ? &_terminator : nullptr, worker_id);;
217 _rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
218 }
219
220 void prepare_run_task_hook() override {
221 _terminator.reset_for_reuse(_queue_count);
222 }
223 };
224
225 class PSThreadRootsTaskClosure : public ThreadClosure {
226 uint _worker_id;
227 public:
228 PSThreadRootsTaskClosure(uint worker_id) : _worker_id(worker_id) { }
|