hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
changeset 3696 9e5d9b5e1049
parent 1623 a0dd9009e992
child 3795 6227ff014cfe
equal deleted inserted replaced
3695:421cfcc8843c 3696:9e5d9b5e1049
    59   // Note that _revisit_klass_stack is allocated out of the
    59   // Note that _revisit_klass_stack is allocated out of the
    60   // C heap (as opposed to out of ResourceArena).
    60   // C heap (as opposed to out of ResourceArena).
    61   int size =
    61   int size =
    62     (SystemDictionary::number_of_classes() * 2) * 2 / ParallelGCThreads;
    62     (SystemDictionary::number_of_classes() * 2) * 2 / ParallelGCThreads;
    63   _revisit_klass_stack = new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true);
    63   _revisit_klass_stack = new (ResourceObj::C_HEAP) GrowableArray<Klass*>(size, true);
       
    64   // From some experiments (#klass/k)^2 for k = 10 seems a better fit, but this will
       
    65   // have to do for now until we are able to investigate a more optimal setting.
       
    66   _revisit_mdo_stack = new (ResourceObj::C_HEAP) GrowableArray<DataLayout*>(size*2, true);
    64 
    67 
    65 }
    68 }
    66 
    69 
    67 ParCompactionManager::~ParCompactionManager() {
    70 ParCompactionManager::~ParCompactionManager() {
    68   delete _overflow_stack;
    71   delete _overflow_stack;
    69   delete _revisit_klass_stack;
    72   delete _revisit_klass_stack;
       
    73   delete _revisit_mdo_stack;
    70   // _manager_array and _stack_array are statics
    74   // _manager_array and _stack_array are statics
    71   // shared with all instances of ParCompactionManager
    75   // shared with all instances of ParCompactionManager
    72   // should not be deallocated.
    76   // should not be deallocated.
    73 }
    77 }
    74 
    78 
   193 }
   197 }
   194 
   198 
   195 void ParCompactionManager::reset() {
   199 void ParCompactionManager::reset() {
   196   for(uint i=0; i<ParallelGCThreads+1; i++) {
   200   for(uint i=0; i<ParallelGCThreads+1; i++) {
   197     manager_array(i)->revisit_klass_stack()->clear();
   201     manager_array(i)->revisit_klass_stack()->clear();
       
   202     manager_array(i)->revisit_mdo_stack()->clear();
   198   }
   203   }
   199 }
   204 }
   200 
   205 
   201 void ParCompactionManager::drain_marking_stacks(OopClosure* blk) {
   206 void ParCompactionManager::drain_marking_stacks(OopClosure* blk) {
   202 #ifdef ASSERT
   207 #ifdef ASSERT
   294 #endif
   299 #endif
   295 }
   300 }
   296 
   301 
   297 #ifdef ASSERT
   302 #ifdef ASSERT
   298 bool ParCompactionManager::stacks_have_been_allocated() {
   303 bool ParCompactionManager::stacks_have_been_allocated() {
   299   return (revisit_klass_stack()->data_addr() != NULL);
   304   return (revisit_klass_stack()->data_addr() != NULL &&
   300 }
   305           revisit_mdo_stack()->data_addr() != NULL);
   301 #endif
   306 }
       
   307 #endif