< prev index next >

src/share/vm/memory/genCollectedHeap.cpp

Print this page




  42 #include "memory/resourceArea.hpp"
  43 #include "memory/sharedHeap.hpp"
  44 #include "memory/space.hpp"
  45 #include "oops/oop.inline.hpp"
  46 #include "oops/oop.inline2.hpp"
  47 #include "runtime/biasedLocking.hpp"
  48 #include "runtime/fprofiler.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/vmError.hpp"
  56 #include "utilities/workgroup.hpp"
  57 #include "utilities/macros.hpp"
  58 #if INCLUDE_ALL_GCS
  59 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  60 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
  61 #endif // INCLUDE_ALL_GCS



  62 
  63 GenCollectedHeap* GenCollectedHeap::_gch;
  64 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
  65 
  66 // The set of potentially parallel tasks in root scanning.
  67 enum GCH_strong_roots_tasks {
  68   GCH_PS_Universe_oops_do,
  69   GCH_PS_JNIHandles_oops_do,
  70   GCH_PS_ObjectSynchronizer_oops_do,
  71   GCH_PS_FlatProfiler_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_younger_gens,
  78   // Leave this one last.
  79   GCH_PS_NumElements
  80 };
  81 


 730         not_older_gens->set_generation(_gens[i]);
 731         _gens[i]->oop_iterate(not_older_gens);
 732       }
 733       not_older_gens->reset_generation();
 734     }
 735   }
 736   // When collection is parallel, all threads get to cooperate to do
 737   // older-gen scanning.
 738   for (int i = level+1; i < _n_gens; i++) {
 739     older_gens->set_generation(_gens[i]);
 740     rem_set()->younger_refs_iterate(_gens[i], older_gens);
 741     older_gens->reset_generation();
 742   }
 743 
 744   _process_strong_tasks->all_tasks_completed();
 745 }
 746 
 747 
 748 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
 749   JNIHandles::weak_oops_do(root_closure);

 750   for (int i = 0; i < _n_gens; i++) {
 751     _gens[i]->ref_processor()->weak_oops_do(root_closure);
 752   }
 753 }
 754 
 755 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)    \
 756 void GenCollectedHeap::                                                 \
 757 oop_since_save_marks_iterate(int level,                                 \
 758                              OopClosureType* cur,                       \
 759                              OopClosureType* older) {                   \
 760   _gens[level]->oop_since_save_marks_iterate##nv_suffix(cur);           \
 761   for (int i = level+1; i < n_gens(); i++) {                            \
 762     _gens[i]->oop_since_save_marks_iterate##nv_suffix(older);           \
 763   }                                                                     \
 764 }
 765 
 766 ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DEFN)
 767 
 768 #undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN
 769 




  42 #include "memory/resourceArea.hpp"
  43 #include "memory/sharedHeap.hpp"
  44 #include "memory/space.hpp"
  45 #include "oops/oop.inline.hpp"
  46 #include "oops/oop.inline2.hpp"
  47 #include "runtime/biasedLocking.hpp"
  48 #include "runtime/fprofiler.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/vmError.hpp"
  56 #include "utilities/workgroup.hpp"
  57 #include "utilities/macros.hpp"
  58 #if INCLUDE_ALL_GCS
  59 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  60 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
  61 #endif // INCLUDE_ALL_GCS
  62 #if INCLUDE_JFR
  63 #include "jfr/jfr.hpp"
  64 #endif // INCLUDE_JFR
  65 
  66 GenCollectedHeap* GenCollectedHeap::_gch;
  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,
  73   GCH_PS_ObjectSynchronizer_oops_do,
  74   GCH_PS_FlatProfiler_oops_do,
  75   GCH_PS_Management_oops_do,
  76   GCH_PS_SystemDictionary_oops_do,
  77   GCH_PS_ClassLoaderDataGraph_oops_do,
  78   GCH_PS_jvmti_oops_do,
  79   GCH_PS_CodeCache_oops_do,
  80   GCH_PS_younger_gens,
  81   // Leave this one last.
  82   GCH_PS_NumElements
  83 };
  84 


 733         not_older_gens->set_generation(_gens[i]);
 734         _gens[i]->oop_iterate(not_older_gens);
 735       }
 736       not_older_gens->reset_generation();
 737     }
 738   }
 739   // When collection is parallel, all threads get to cooperate to do
 740   // older-gen scanning.
 741   for (int i = level+1; i < _n_gens; i++) {
 742     older_gens->set_generation(_gens[i]);
 743     rem_set()->younger_refs_iterate(_gens[i], older_gens);
 744     older_gens->reset_generation();
 745   }
 746 
 747   _process_strong_tasks->all_tasks_completed();
 748 }
 749 
 750 
 751 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
 752   JNIHandles::weak_oops_do(root_closure);
 753   JFR_ONLY(Jfr::weak_oops_do(root_closure));
 754   for (int i = 0; i < _n_gens; i++) {
 755     _gens[i]->ref_processor()->weak_oops_do(root_closure);
 756   }
 757 }
 758 
 759 #define GCH_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)    \
 760 void GenCollectedHeap::                                                 \
 761 oop_since_save_marks_iterate(int level,                                 \
 762                              OopClosureType* cur,                       \
 763                              OopClosureType* older) {                   \
 764   _gens[level]->oop_since_save_marks_iterate##nv_suffix(cur);           \
 765   for (int i = level+1; i < n_gens(); i++) {                            \
 766     _gens[i]->oop_since_save_marks_iterate##nv_suffix(older);           \
 767   }                                                                     \
 768 }
 769 
 770 ALL_SINCE_SAVE_MARKS_CLOSURES(GCH_SINCE_SAVE_MARKS_ITERATE_DEFN)
 771 
 772 #undef GCH_SINCE_SAVE_MARKS_ITERATE_DEFN
 773 


< prev index next >