< prev index next >

src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp

Print this page
rev 7858 : 8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp


  49   _old_gen = heap->old_gen();
  50   _young_space = heap->young_gen()->to_space();
  51 
  52   // To prevent false sharing, we pad the PSPromotionManagers
  53   // and make sure that the first instance starts at a cache line.
  54   assert(_manager_array == NULL, "Attempt to initialize twice");
  55   _manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(ParallelGCThreads + 1);
  56   guarantee(_manager_array != NULL, "Could not initialize promotion manager");
  57 
  58   _stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads);
  59   guarantee(_stack_array_depth != NULL, "Could not initialize promotion manager");
  60 
  61   // Create and register the PSPromotionManager(s) for the worker threads.
  62   for(uint i=0; i<ParallelGCThreads; i++) {
  63     stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth());
  64   }
  65   // The VMThread gets its own PSPromotionManager, which is not available
  66   // for work stealing.
  67 }
  68 









  69 PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
  70   assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
  71   assert(_manager_array != NULL, "Sanity");
  72   return &_manager_array[index];
  73 }
  74 
  75 PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() {
  76   assert(_manager_array != NULL, "Sanity");
  77   return &_manager_array[ParallelGCThreads];
  78 }
  79 
  80 void PSPromotionManager::pre_scavenge() {
  81   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
  82   assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
  83 
  84   _young_space = heap->young_gen()->to_space();
  85 
  86   for(uint i=0; i<ParallelGCThreads+1; i++) {
  87     manager_array(i)->reset();
  88   }




  49   _old_gen = heap->old_gen();
  50   _young_space = heap->young_gen()->to_space();
  51 
  52   // To prevent false sharing, we pad the PSPromotionManagers
  53   // and make sure that the first instance starts at a cache line.
  54   assert(_manager_array == NULL, "Attempt to initialize twice");
  55   _manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(ParallelGCThreads + 1);
  56   guarantee(_manager_array != NULL, "Could not initialize promotion manager");
  57 
  58   _stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads);
  59   guarantee(_stack_array_depth != NULL, "Could not initialize promotion manager");
  60 
  61   // Create and register the PSPromotionManager(s) for the worker threads.
  62   for(uint i=0; i<ParallelGCThreads; i++) {
  63     stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth());
  64   }
  65   // The VMThread gets its own PSPromotionManager, which is not available
  66   // for work stealing.
  67 }
  68 
  69 // Helper functions to get around the circular dependency between
  70 // psScavenge.inline.hpp and psPromotionManager.inline.hpp.
  71 bool PSPromotionManager::should_scavenge(oop* p, bool check_to_space) {
  72   return PSScavenge::should_scavenge(p, check_to_space);
  73 }
  74 bool PSPromotionManager::should_scavenge(narrowOop* p, bool check_to_space) {
  75   return PSScavenge::should_scavenge(p, check_to_space);
  76 }
  77 
  78 PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
  79   assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
  80   assert(_manager_array != NULL, "Sanity");
  81   return &_manager_array[index];
  82 }
  83 
  84 PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() {
  85   assert(_manager_array != NULL, "Sanity");
  86   return &_manager_array[ParallelGCThreads];
  87 }
  88 
  89 void PSPromotionManager::pre_scavenge() {
  90   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
  91   assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
  92 
  93   _young_space = heap->young_gen()->to_space();
  94 
  95   for(uint i=0; i<ParallelGCThreads+1; i++) {
  96     manager_array(i)->reset();
  97   }


< prev index next >