29 #include "classfile/vmSymbols.hpp" 30 #include "code/codeCache.hpp" 31 #include "code/icBuffer.hpp" 32 #include "gc/shared/collectedHeap.inline.hpp" 33 #include "gc/shared/collectorCounters.hpp" 34 #include "gc/shared/gcId.hpp" 35 #include "gc/shared/gcLocker.inline.hpp" 36 #include "gc/shared/gcTrace.hpp" 37 #include "gc/shared/gcTraceTime.inline.hpp" 38 #include "gc/shared/genCollectedHeap.hpp" 39 #include "gc/shared/genOopClosures.inline.hpp" 40 #include "gc/shared/generationSpec.hpp" 41 #include "gc/shared/space.hpp" 42 #include "gc/shared/strongRootsScope.hpp" 43 #include "gc/shared/vmGCOperations.hpp" 44 #include "gc/shared/workgroup.hpp" 45 #include "memory/filemap.hpp" 46 #include "memory/resourceArea.hpp" 47 #include "oops/oop.inline.hpp" 48 #include "runtime/biasedLocking.hpp" 49 #include "runtime/fprofiler.hpp" 50 #include "runtime/handles.hpp" 51 #include "runtime/handles.inline.hpp" 52 #include "runtime/java.hpp" 53 #include "runtime/vmThread.hpp" 54 #include "services/management.hpp" 55 #include "services/memoryService.hpp" 56 #include "utilities/debug.hpp" 57 #include "utilities/formatBuffer.hpp" 58 #include "utilities/macros.hpp" 59 #include "utilities/stack.inline.hpp" 60 #include "utilities/vmError.hpp" 61 #if INCLUDE_ALL_GCS 62 #include "gc/cms/concurrentMarkSweepThread.hpp" 63 #include "gc/cms/vmCMSOperations.hpp" 64 #endif // INCLUDE_ALL_GCS 65 66 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;) 67 68 // The set of potentially parallel tasks in root scanning. 69 enum GCH_strong_roots_tasks { 70 GCH_PS_Universe_oops_do, 71 GCH_PS_JNIHandles_oops_do, 72 GCH_PS_ObjectSynchronizer_oops_do, 73 GCH_PS_FlatProfiler_oops_do, 74 GCH_PS_Management_oops_do, 75 GCH_PS_SystemDictionary_oops_do, 76 GCH_PS_ClassLoaderDataGraph_oops_do, 77 GCH_PS_jvmti_oops_do, 78 GCH_PS_CodeCache_oops_do, 79 GCH_PS_aot_oops_do, 80 GCH_PS_younger_gens, 81 // Leave this one last. 82 GCH_PS_NumElements 83 }; 84 85 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) : 86 CollectedHeap(), 87 _rem_set(NULL), 88 _gen_policy(policy), 89 _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)), 90 _full_collections_completed(0) 91 { 92 assert(policy != NULL, "Sanity check"); 93 if (UseConcMarkSweepGC) { 586 ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure); 587 } 588 589 // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway 590 CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots; 591 592 bool is_par = scope->n_threads() > 1; 593 Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_code_p); 594 595 if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) { 596 Universe::oops_do(strong_roots); 597 } 598 // Global (strong) JNI handles 599 if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) { 600 JNIHandles::oops_do(strong_roots); 601 } 602 603 if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) { 604 ObjectSynchronizer::oops_do(strong_roots); 605 } 606 if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) { 607 FlatProfiler::oops_do(strong_roots); 608 } 609 if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) { 610 Management::oops_do(strong_roots); 611 } 612 if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) { 613 JvmtiExport::oops_do(strong_roots); 614 } 615 if (UseAOT && !_process_strong_tasks->is_task_claimed(GCH_PS_aot_oops_do)) { 616 AOTLoader::oops_do(strong_roots); 617 } 618 619 if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) { 620 SystemDictionary::roots_oops_do(strong_roots, weak_roots); 621 } 622 623 if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) { 624 if (so & SO_ScavengeCodeCache) { 625 assert(code_roots != NULL, "must supply closure for code cache"); 626 627 // We only visit parts of the CodeCache when scavenging. 628 CodeCache::scavenge_root_nmethods_do(code_roots); | 29 #include "classfile/vmSymbols.hpp" 30 #include "code/codeCache.hpp" 31 #include "code/icBuffer.hpp" 32 #include "gc/shared/collectedHeap.inline.hpp" 33 #include "gc/shared/collectorCounters.hpp" 34 #include "gc/shared/gcId.hpp" 35 #include "gc/shared/gcLocker.inline.hpp" 36 #include "gc/shared/gcTrace.hpp" 37 #include "gc/shared/gcTraceTime.inline.hpp" 38 #include "gc/shared/genCollectedHeap.hpp" 39 #include "gc/shared/genOopClosures.inline.hpp" 40 #include "gc/shared/generationSpec.hpp" 41 #include "gc/shared/space.hpp" 42 #include "gc/shared/strongRootsScope.hpp" 43 #include "gc/shared/vmGCOperations.hpp" 44 #include "gc/shared/workgroup.hpp" 45 #include "memory/filemap.hpp" 46 #include "memory/resourceArea.hpp" 47 #include "oops/oop.inline.hpp" 48 #include "runtime/biasedLocking.hpp" 49 #include "runtime/handles.hpp" 50 #include "runtime/handles.inline.hpp" 51 #include "runtime/java.hpp" 52 #include "runtime/vmThread.hpp" 53 #include "services/management.hpp" 54 #include "services/memoryService.hpp" 55 #include "utilities/debug.hpp" 56 #include "utilities/formatBuffer.hpp" 57 #include "utilities/macros.hpp" 58 #include "utilities/stack.inline.hpp" 59 #include "utilities/vmError.hpp" 60 #if INCLUDE_ALL_GCS 61 #include "gc/cms/concurrentMarkSweepThread.hpp" 62 #include "gc/cms/vmCMSOperations.hpp" 63 #endif // INCLUDE_ALL_GCS 64 65 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;) 66 67 // The set of potentially parallel tasks in root scanning. 68 enum GCH_strong_roots_tasks { 69 GCH_PS_Universe_oops_do, 70 GCH_PS_JNIHandles_oops_do, 71 GCH_PS_ObjectSynchronizer_oops_do, 72 GCH_PS_Management_oops_do, 73 GCH_PS_SystemDictionary_oops_do, 74 GCH_PS_ClassLoaderDataGraph_oops_do, 75 GCH_PS_jvmti_oops_do, 76 GCH_PS_CodeCache_oops_do, 77 GCH_PS_aot_oops_do, 78 GCH_PS_younger_gens, 79 // Leave this one last. 80 GCH_PS_NumElements 81 }; 82 83 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) : 84 CollectedHeap(), 85 _rem_set(NULL), 86 _gen_policy(policy), 87 _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)), 88 _full_collections_completed(0) 89 { 90 assert(policy != NULL, "Sanity check"); 91 if (UseConcMarkSweepGC) { 584 ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure); 585 } 586 587 // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway 588 CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots; 589 590 bool is_par = scope->n_threads() > 1; 591 Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_code_p); 592 593 if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) { 594 Universe::oops_do(strong_roots); 595 } 596 // Global (strong) JNI handles 597 if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) { 598 JNIHandles::oops_do(strong_roots); 599 } 600 601 if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) { 602 ObjectSynchronizer::oops_do(strong_roots); 603 } 604 if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) { 605 Management::oops_do(strong_roots); 606 } 607 if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) { 608 JvmtiExport::oops_do(strong_roots); 609 } 610 if (UseAOT && !_process_strong_tasks->is_task_claimed(GCH_PS_aot_oops_do)) { 611 AOTLoader::oops_do(strong_roots); 612 } 613 614 if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) { 615 SystemDictionary::roots_oops_do(strong_roots, weak_roots); 616 } 617 618 if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) { 619 if (so & SO_ScavengeCodeCache) { 620 assert(code_roots != NULL, "must supply closure for code cache"); 621 622 // We only visit parts of the CodeCache when scavenging. 623 CodeCache::scavenge_root_nmethods_do(code_roots); |