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,
707 bool only_strong_roots,
708 OopsInGenClosure* root_closure,
709 CLDClosure* cld_closure) {
710 MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
711 OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
712 CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
713
714 process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
715 if (is_adjust_phase) {
716 // We never treat the string table as roots during marking
717 // for the full gc, so we only need to process it during
718 // the adjust phase.
719 process_string_table_roots(scope, root_closure);
720 }
721
722 _process_strong_tasks->all_tasks_completed(scope->n_threads());
723 }
724
725 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
726 JNIHandles::weak_oops_do(root_closure);
727 _young_gen->ref_processor()->weak_oops_do(root_closure);
728 _old_gen->ref_processor()->weak_oops_do(root_closure);
729 }
730
731 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
732 void GenCollectedHeap:: \
733 oop_since_save_marks_iterate(GenerationType gen, \
734 OopClosureType* cur, \
735 OopClosureType* older) { \
736 if (gen == YoungGen) { \
737 _young_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
738 _old_gen->oop_since_save_marks_iterate##nv_suffix(older); \
739 } else { \
740 _old_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
741 } \
742 }
743
744 ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DEFN)
745
746 #undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN
|
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/heapMonitoring.hpp"
53 #include "runtime/java.hpp"
54 #include "runtime/vmThread.hpp"
55 #include "services/management.hpp"
56 #include "services/memoryService.hpp"
57 #include "utilities/debug.hpp"
58 #include "utilities/formatBuffer.hpp"
59 #include "utilities/macros.hpp"
60 #include "utilities/stack.inline.hpp"
61 #include "utilities/vmError.hpp"
62 #if INCLUDE_ALL_GCS
63 #include "gc/cms/concurrentMarkSweepThread.hpp"
64 #include "gc/cms/vmCMSOperations.hpp"
65 #endif // INCLUDE_ALL_GCS
66
67 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
68
69 // The set of potentially parallel tasks in root scanning.
70 enum GCH_strong_roots_tasks {
71 GCH_PS_Universe_oops_do,
72 GCH_PS_JNIHandles_oops_do,
708 bool only_strong_roots,
709 OopsInGenClosure* root_closure,
710 CLDClosure* cld_closure) {
711 MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
712 OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
713 CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
714
715 process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
716 if (is_adjust_phase) {
717 // We never treat the string table as roots during marking
718 // for the full gc, so we only need to process it during
719 // the adjust phase.
720 process_string_table_roots(scope, root_closure);
721 }
722
723 _process_strong_tasks->all_tasks_completed(scope->n_threads());
724 }
725
726 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
727 JNIHandles::weak_oops_do(root_closure);
728 HeapMonitoring::weak_oops_do(root_closure);
729 _young_gen->ref_processor()->weak_oops_do(root_closure);
730 _old_gen->ref_processor()->weak_oops_do(root_closure);
731 }
732
733 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix) \
734 void GenCollectedHeap:: \
735 oop_since_save_marks_iterate(GenerationType gen, \
736 OopClosureType* cur, \
737 OopClosureType* older) { \
738 if (gen == YoungGen) { \
739 _young_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
740 _old_gen->oop_since_save_marks_iterate##nv_suffix(older); \
741 } else { \
742 _old_gen->oop_since_save_marks_iterate##nv_suffix(cur); \
743 } \
744 }
745
746 ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DEFN)
747
748 #undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN
|