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