44 #include "gc/shared/cardGeneration.inline.hpp"
45 #include "gc/shared/cardTableRS.hpp"
46 #include "gc/shared/collectedHeap.inline.hpp"
47 #include "gc/shared/collectorCounters.hpp"
48 #include "gc/shared/collectorPolicy.hpp"
49 #include "gc/shared/gcLocker.hpp"
50 #include "gc/shared/gcPolicyCounters.hpp"
51 #include "gc/shared/gcTimer.hpp"
52 #include "gc/shared/gcTrace.hpp"
53 #include "gc/shared/gcTraceTime.inline.hpp"
54 #include "gc/shared/genCollectedHeap.hpp"
55 #include "gc/shared/genOopClosures.inline.hpp"
56 #include "gc/shared/isGCActiveMark.hpp"
57 #include "gc/shared/oopStorageParState.hpp"
58 #include "gc/shared/referencePolicy.hpp"
59 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
60 #include "gc/shared/space.inline.hpp"
61 #include "gc/shared/strongRootsScope.hpp"
62 #include "gc/shared/taskqueue.inline.hpp"
63 #include "gc/shared/weakProcessor.hpp"
64 #include "logging/log.hpp"
65 #include "logging/logStream.hpp"
66 #include "memory/allocation.hpp"
67 #include "memory/binaryTreeDictionary.inline.hpp"
68 #include "memory/iterator.inline.hpp"
69 #include "memory/padded.hpp"
70 #include "memory/resourceArea.hpp"
71 #include "oops/access.inline.hpp"
72 #include "oops/oop.inline.hpp"
73 #include "prims/jvmtiExport.hpp"
74 #include "runtime/atomic.hpp"
75 #include "runtime/flags/flagSetting.hpp"
76 #include "runtime/globals_extension.hpp"
77 #include "runtime/handles.inline.hpp"
78 #include "runtime/java.hpp"
79 #include "runtime/orderAccess.hpp"
80 #include "runtime/timer.hpp"
81 #include "runtime/vmThread.hpp"
82 #include "services/memoryService.hpp"
83 #include "services/runtimeService.hpp"
3471 // should really use wait/notify, which is the recommended
3472 // way of doing this type of interaction. Additionally, we should
3473 // consolidate the eight methods that do the yield operation and they
3474 // are almost identical into one for better maintainability and
3475 // readability. See 6445193.
3476 //
3477 // Tony 2006.06.29
3478 for (unsigned i = 0; i < CMSCoordinatorYieldSleepCount &&
3479 ConcurrentMarkSweepThread::should_yield() &&
3480 !CMSCollector::foregroundGCIsActive(); ++i) {
3481 os::sleep(Thread::current(), 1, false);
3482 }
3483
3484 ConcurrentMarkSweepThread::synchronize(true);
3485 _bit_map_lock->lock_without_safepoint_check();
3486 _collector->startTimer();
3487 }
3488
3489 bool CMSCollector::do_marking_mt() {
3490 assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition");
3491 uint num_workers = AdaptiveSizePolicy::calc_active_conc_workers(conc_workers()->total_workers(),
3492 conc_workers()->active_workers(),
3493 Threads::number_of_non_daemon_threads());
3494 num_workers = conc_workers()->update_active_workers(num_workers);
3495 log_info(gc,task)("Using %u workers of %u for marking", num_workers, conc_workers()->total_workers());
3496
3497 CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
3498
3499 CMSConcMarkingTask tsk(this,
3500 cms_space,
3501 conc_workers(),
3502 task_queues());
3503
3504 // Since the actual number of workers we get may be different
3505 // from the number we requested above, do we need to do anything different
3506 // below? In particular, may be we need to subclass the SequantialSubTasksDone
3507 // class?? XXX
3508 cms_space ->initialize_sequential_subtasks_for_marking(num_workers);
3509
3510 // Refs discovery is already non-atomic.
3511 assert(!ref_processor()->discovery_is_atomic(), "Should be non-atomic");
|
44 #include "gc/shared/cardGeneration.inline.hpp"
45 #include "gc/shared/cardTableRS.hpp"
46 #include "gc/shared/collectedHeap.inline.hpp"
47 #include "gc/shared/collectorCounters.hpp"
48 #include "gc/shared/collectorPolicy.hpp"
49 #include "gc/shared/gcLocker.hpp"
50 #include "gc/shared/gcPolicyCounters.hpp"
51 #include "gc/shared/gcTimer.hpp"
52 #include "gc/shared/gcTrace.hpp"
53 #include "gc/shared/gcTraceTime.inline.hpp"
54 #include "gc/shared/genCollectedHeap.hpp"
55 #include "gc/shared/genOopClosures.inline.hpp"
56 #include "gc/shared/isGCActiveMark.hpp"
57 #include "gc/shared/oopStorageParState.hpp"
58 #include "gc/shared/referencePolicy.hpp"
59 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
60 #include "gc/shared/space.inline.hpp"
61 #include "gc/shared/strongRootsScope.hpp"
62 #include "gc/shared/taskqueue.inline.hpp"
63 #include "gc/shared/weakProcessor.hpp"
64 #include "gc/shared/workerPolicy.hpp"
65 #include "logging/log.hpp"
66 #include "logging/logStream.hpp"
67 #include "memory/allocation.hpp"
68 #include "memory/binaryTreeDictionary.inline.hpp"
69 #include "memory/iterator.inline.hpp"
70 #include "memory/padded.hpp"
71 #include "memory/resourceArea.hpp"
72 #include "oops/access.inline.hpp"
73 #include "oops/oop.inline.hpp"
74 #include "prims/jvmtiExport.hpp"
75 #include "runtime/atomic.hpp"
76 #include "runtime/flags/flagSetting.hpp"
77 #include "runtime/globals_extension.hpp"
78 #include "runtime/handles.inline.hpp"
79 #include "runtime/java.hpp"
80 #include "runtime/orderAccess.hpp"
81 #include "runtime/timer.hpp"
82 #include "runtime/vmThread.hpp"
83 #include "services/memoryService.hpp"
84 #include "services/runtimeService.hpp"
3472 // should really use wait/notify, which is the recommended
3473 // way of doing this type of interaction. Additionally, we should
3474 // consolidate the eight methods that do the yield operation and they
3475 // are almost identical into one for better maintainability and
3476 // readability. See 6445193.
3477 //
3478 // Tony 2006.06.29
3479 for (unsigned i = 0; i < CMSCoordinatorYieldSleepCount &&
3480 ConcurrentMarkSweepThread::should_yield() &&
3481 !CMSCollector::foregroundGCIsActive(); ++i) {
3482 os::sleep(Thread::current(), 1, false);
3483 }
3484
3485 ConcurrentMarkSweepThread::synchronize(true);
3486 _bit_map_lock->lock_without_safepoint_check();
3487 _collector->startTimer();
3488 }
3489
3490 bool CMSCollector::do_marking_mt() {
3491 assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition");
3492 uint num_workers = WorkerPolicy::calc_active_conc_workers(conc_workers()->total_workers(),
3493 conc_workers()->active_workers(),
3494 Threads::number_of_non_daemon_threads());
3495 num_workers = conc_workers()->update_active_workers(num_workers);
3496 log_info(gc,task)("Using %u workers of %u for marking", num_workers, conc_workers()->total_workers());
3497
3498 CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
3499
3500 CMSConcMarkingTask tsk(this,
3501 cms_space,
3502 conc_workers(),
3503 task_queues());
3504
3505 // Since the actual number of workers we get may be different
3506 // from the number we requested above, do we need to do anything different
3507 // below? In particular, may be we need to subclass the SequantialSubTasksDone
3508 // class?? XXX
3509 cms_space ->initialize_sequential_subtasks_for_marking(num_workers);
3510
3511 // Refs discovery is already non-atomic.
3512 assert(!ref_processor()->discovery_is_atomic(), "Should be non-atomic");
|