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/oopStorageParState.inline.hpp"
48 #include "gc/shared/oopStorageSetParState.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"
186 : _promotion_manager(pm), _terminator(terminator), _worker_id(worker_id) {}
187
188 virtual void do_void() {
189 assert(_promotion_manager != nullptr, "Sanity");
190 _promotion_manager->drain_stacks(true);
191 guarantee(_promotion_manager->stacks_empty(),
192 "stacks should be empty at this point");
193
194 if (_terminator != nullptr) {
195 steal_work(*_terminator, _worker_id);
196 }
197 }
198 };
199
200 class ParallelScavengeRefProcProxyTask : public RefProcProxyTask {
201 TaskTerminator _terminator;
202
203 public:
204 ParallelScavengeRefProcProxyTask(uint max_workers)
205 : RefProcProxyTask("ParallelScavengeRefProcProxyTask", max_workers),
206 _terminator(max_workers, ParCompactionManager::marking_stacks()) {}
207
208 void work(uint worker_id) override {
209 assert(worker_id < _max_workers, "sanity");
210 PSPromotionManager* promotion_manager = (_tm == RefProcThreadModel::Single) ? PSPromotionManager::vm_thread_promotion_manager() : PSPromotionManager::gc_thread_promotion_manager(worker_id);
211 PSIsAliveClosure is_alive;
212 PSKeepAliveClosure keep_alive(promotion_manager);
213 BarrierEnqueueDiscoveredFieldClosure enqueue;
214 PSEvacuateFollowersClosure complete_gc(promotion_manager, (_marks_oops_alive && _tm == RefProcThreadModel::Multi) ? &_terminator : nullptr, worker_id);;
215 _rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
216 }
217
218 void prepare_run_task_hook() override {
219 _terminator.reset_for_reuse(_queue_count);
220 }
221 };
222
223 class PSThreadRootsTaskClosure : public ThreadClosure {
224 uint _worker_id;
225 public:
226 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/oopStorageParState.inline.hpp"
49 #include "gc/shared/oopStorageSetParState.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"
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, UseCompactObjectHeaders ? ParCompactionManagerNew::marking_stacks() : 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) { }
|