src/share/vm/gc_implementation/parNew/parNewGeneration.cpp

Print this page




 597 }
 598 
 599 void ParNewGenTask::work(uint worker_id) {
 600   GenCollectedHeap* gch = GenCollectedHeap::heap();
 601   // Since this is being done in a separate thread, need new resource
 602   // and handle marks.
 603   ResourceMark rm;
 604   HandleMark hm;
 605   // We would need multiple old-gen queues otherwise.
 606   assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen.");
 607 
 608   Generation* old_gen = gch->next_gen(_gen);
 609 
 610   ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id);
 611   assert(_state_set->is_valid(worker_id), "Should not have been called");
 612 
 613   par_scan_state.set_young_old_boundary(_young_old_boundary);
 614 
 615   KlassScanClosure klass_scan_closure(&par_scan_state.to_space_root_closure(),
 616                                       gch->rem_set()->klass_rem_set());
 617 
 618   int so = SharedHeap::SO_AllClasses | SharedHeap::SO_Strings | SharedHeap::SO_ScavengeCodeCache;

 619 
 620   par_scan_state.start_strong_roots();
 621   gch->gen_process_strong_roots(_gen->level(),
 622                                 true,  // Process younger gens, if any,
 623                                        // as strong roots.
 624                                 false, // no scope; this is parallel code
 625                                 SharedHeap::ScanningOption(so),

 626                                 &par_scan_state.to_space_root_closure(),
 627                                 &par_scan_state.older_gen_closure(),
 628                                 &klass_scan_closure);

 629   par_scan_state.end_strong_roots();
 630 
 631   // "evacuate followers".
 632   par_scan_state.evacuate_followers_closure().do_void();
 633 }
 634 
 635 #ifdef _MSC_VER
 636 #pragma warning( push )
 637 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
 638 #endif
 639 ParNewGeneration::
 640 ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level)
 641   : DefNewGeneration(rs, initial_byte_size, level, "PCopy"),
 642   _overflow_list(NULL),
 643   _is_alive_closure(this),
 644   _plab_stats(YoungPLABSize, PLABWeight)
 645 {
 646   NOT_PRODUCT(_overflow_counter = ParGCWorkQueueOverflowInterval;)
 647   NOT_PRODUCT(_num_par_pushes = 0;)
 648   _task_queues = new ObjToScanQueueSet(ParallelGCThreads);




 597 }
 598 
 599 void ParNewGenTask::work(uint worker_id) {
 600   GenCollectedHeap* gch = GenCollectedHeap::heap();
 601   // Since this is being done in a separate thread, need new resource
 602   // and handle marks.
 603   ResourceMark rm;
 604   HandleMark hm;
 605   // We would need multiple old-gen queues otherwise.
 606   assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen.");
 607 
 608   Generation* old_gen = gch->next_gen(_gen);
 609 
 610   ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id);
 611   assert(_state_set->is_valid(worker_id), "Should not have been called");
 612 
 613   par_scan_state.set_young_old_boundary(_young_old_boundary);
 614 
 615   KlassScanClosure klass_scan_closure(&par_scan_state.to_space_root_closure(),
 616                                       gch->rem_set()->klass_rem_set());
 617   CLDToKlassAndOopClosure cld_scan_closure(&klass_scan_closure,
 618                                            &par_scan_state.to_space_root_closure(),
 619                                            false);
 620 
 621   par_scan_state.start_strong_roots();
 622   gch->gen_process_roots(_gen->level(),
 623                          true,  // Process younger gens, if any,
 624                                 // as strong roots.
 625                          false, // no scope; this is parallel code
 626                          SharedHeap::SO_ScavengeCodeCache,
 627                          GenCollectedHeap::StrongAndWeakRoots,
 628                          &par_scan_state.to_space_root_closure(),
 629                          &par_scan_state.older_gen_closure(),
 630                          &cld_scan_closure);
 631 
 632   par_scan_state.end_strong_roots();
 633 
 634   // "evacuate followers".
 635   par_scan_state.evacuate_followers_closure().do_void();
 636 }
 637 
 638 #ifdef _MSC_VER
 639 #pragma warning( push )
 640 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
 641 #endif
 642 ParNewGeneration::
 643 ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level)
 644   : DefNewGeneration(rs, initial_byte_size, level, "PCopy"),
 645   _overflow_list(NULL),
 646   _is_alive_closure(this),
 647   _plab_stats(YoungPLABSize, PLABWeight)
 648 {
 649   NOT_PRODUCT(_overflow_counter = ParGCWorkQueueOverflowInterval;)
 650   NOT_PRODUCT(_num_par_pushes = 0;)
 651   _task_queues = new ObjToScanQueueSet(ParallelGCThreads);