22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/symbolTable.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/icBuffer.hpp"
31 #include "gc_implementation/shared/collectorCounters.hpp"
32 #include "gc_implementation/shared/gcTrace.hpp"
33 #include "gc_implementation/shared/gcTraceTime.hpp"
34 #include "gc_implementation/shared/vmGCOperations.hpp"
35 #include "gc_interface/collectedHeap.inline.hpp"
36 #include "memory/filemap.hpp"
37 #include "memory/gcLocker.inline.hpp"
38 #include "memory/genCollectedHeap.hpp"
39 #include "memory/genOopClosures.inline.hpp"
40 #include "memory/generationSpec.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "memory/sharedHeap.hpp"
43 #include "memory/space.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "runtime/biasedLocking.hpp"
46 #include "runtime/fprofiler.hpp"
47 #include "runtime/handles.hpp"
48 #include "runtime/handles.inline.hpp"
49 #include "runtime/java.hpp"
50 #include "runtime/vmThread.hpp"
51 #include "services/management.hpp"
52 #include "services/memoryService.hpp"
53 #include "utilities/vmError.hpp"
54 #include "utilities/workgroup.hpp"
55 #include "utilities/macros.hpp"
56 #if INCLUDE_ALL_GCS
57 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
58 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
59 #endif // INCLUDE_ALL_GCS
60
61 GenCollectedHeap* GenCollectedHeap::_gch;
62 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
579 }
580
581 #ifdef ASSERT
582 class AssertNonScavengableClosure: public OopClosure {
583 public:
584 virtual void do_oop(oop* p) {
585 assert(!GenCollectedHeap::heap()->is_in_partial_collection(*p),
586 "Referent should not be scavengable."); }
587 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
588 };
589 static AssertNonScavengableClosure assert_is_non_scavengable_closure;
590 #endif
591
592 void GenCollectedHeap::process_roots(bool activate_scope,
593 ScanningOption so,
594 OopClosure* strong_roots,
595 OopClosure* weak_roots,
596 CLDClosure* strong_cld_closure,
597 CLDClosure* weak_cld_closure,
598 CodeBlobClosure* code_roots) {
599 StrongRootsScope srs(this, activate_scope);
600
601 // General roots.
602 assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
603 assert(code_roots != NULL, "code root closure should always be set");
604 // _n_termination for _process_strong_tasks should be set up stream
605 // in a method not running in a GC worker. Otherwise the GC worker
606 // could be trying to change the termination condition while the task
607 // is executing in another GC worker.
608
609 if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) {
610 ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
611 }
612
613 // Some CLDs contained in the thread frames should be considered strong.
614 // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
615 CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
616 // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
617 CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
618
619 bool is_par = n_par_threads() > 0;
|
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/symbolTable.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "classfile/vmSymbols.hpp"
29 #include "code/codeCache.hpp"
30 #include "code/icBuffer.hpp"
31 #include "gc_implementation/shared/collectorCounters.hpp"
32 #include "gc_implementation/shared/gcTrace.hpp"
33 #include "gc_implementation/shared/gcTraceTime.hpp"
34 #include "gc_implementation/shared/vmGCOperations.hpp"
35 #include "gc_interface/collectedHeap.inline.hpp"
36 #include "memory/filemap.hpp"
37 #include "memory/gcLocker.inline.hpp"
38 #include "memory/genCollectedHeap.hpp"
39 #include "memory/genOopClosures.inline.hpp"
40 #include "memory/generationSpec.hpp"
41 #include "memory/resourceArea.hpp"
42 #include "memory/strongRootsScope.hpp"
43 #include "memory/space.hpp"
44 #include "oops/oop.inline.hpp"
45 #include "runtime/biasedLocking.hpp"
46 #include "runtime/fprofiler.hpp"
47 #include "runtime/handles.hpp"
48 #include "runtime/handles.inline.hpp"
49 #include "runtime/java.hpp"
50 #include "runtime/vmThread.hpp"
51 #include "services/management.hpp"
52 #include "services/memoryService.hpp"
53 #include "utilities/vmError.hpp"
54 #include "utilities/workgroup.hpp"
55 #include "utilities/macros.hpp"
56 #if INCLUDE_ALL_GCS
57 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
58 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
59 #endif // INCLUDE_ALL_GCS
60
61 GenCollectedHeap* GenCollectedHeap::_gch;
62 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
579 }
580
581 #ifdef ASSERT
582 class AssertNonScavengableClosure: public OopClosure {
583 public:
584 virtual void do_oop(oop* p) {
585 assert(!GenCollectedHeap::heap()->is_in_partial_collection(*p),
586 "Referent should not be scavengable."); }
587 virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
588 };
589 static AssertNonScavengableClosure assert_is_non_scavengable_closure;
590 #endif
591
592 void GenCollectedHeap::process_roots(bool activate_scope,
593 ScanningOption so,
594 OopClosure* strong_roots,
595 OopClosure* weak_roots,
596 CLDClosure* strong_cld_closure,
597 CLDClosure* weak_cld_closure,
598 CodeBlobClosure* code_roots) {
599 StrongRootsScope srs(activate_scope);
600
601 // General roots.
602 assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
603 assert(code_roots != NULL, "code root closure should always be set");
604 // _n_termination for _process_strong_tasks should be set up stream
605 // in a method not running in a GC worker. Otherwise the GC worker
606 // could be trying to change the termination condition while the task
607 // is executing in another GC worker.
608
609 if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) {
610 ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
611 }
612
613 // Some CLDs contained in the thread frames should be considered strong.
614 // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
615 CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
616 // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
617 CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
618
619 bool is_par = n_par_threads() > 0;
|