src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page
rev 6670 : 8049426: Minor cleanups after G1 class unloading
Reviewed-by: stefank


5293 class G1ParallelCleaningTask : public AbstractGangTask {
5294 private:
5295   G1StringSymbolTableUnlinkTask _string_symbol_task;
5296   G1CodeCacheUnloadingTask      _code_cache_task;
5297   G1KlassCleaningTask           _klass_cleaning_task;
5298 
5299 public:
5300   // The constructor is run in the VMThread.
5301   G1ParallelCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, uint num_workers, bool unloading_occurred) :
5302       AbstractGangTask("Parallel Cleaning"),
5303       _string_symbol_task(is_alive, process_strings, process_symbols),
5304       _code_cache_task(num_workers, is_alive, unloading_occurred),
5305       _klass_cleaning_task(is_alive) {
5306   }
5307 
5308   // The parallel work done by all worker threads.
5309   void work(uint worker_id) {
5310     // Do first pass of code cache cleaning.
5311     _code_cache_task.work_first_pass(worker_id);
5312 
5313     // Let the threads, mark that the first pass is done.
5314     _code_cache_task.barrier_mark(worker_id);
5315 
5316     // Clean the Strings and Symbols.
5317     _string_symbol_task.work(worker_id);
5318 
5319     // Wait for all workers to finish the first code cache cleaning pass.
5320     _code_cache_task.barrier_wait(worker_id);
5321 
5322     // Do the second code cache cleaning work, which realize on
5323     // the liveness information gathered during the first pass.
5324     _code_cache_task.work_second_pass(worker_id);
5325 
5326     // Clean all klasses that were not unloaded.
5327     _klass_cleaning_task.work();
5328   }
5329 };
5330 
5331 
5332 void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive,
5333                                         bool process_strings,




5293 class G1ParallelCleaningTask : public AbstractGangTask {
5294 private:
5295   G1StringSymbolTableUnlinkTask _string_symbol_task;
5296   G1CodeCacheUnloadingTask      _code_cache_task;
5297   G1KlassCleaningTask           _klass_cleaning_task;
5298 
5299 public:
5300   // The constructor is run in the VMThread.
5301   G1ParallelCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, uint num_workers, bool unloading_occurred) :
5302       AbstractGangTask("Parallel Cleaning"),
5303       _string_symbol_task(is_alive, process_strings, process_symbols),
5304       _code_cache_task(num_workers, is_alive, unloading_occurred),
5305       _klass_cleaning_task(is_alive) {
5306   }
5307 
5308   // The parallel work done by all worker threads.
5309   void work(uint worker_id) {
5310     // Do first pass of code cache cleaning.
5311     _code_cache_task.work_first_pass(worker_id);
5312 
5313     // Let the threads mark that the first pass is done.
5314     _code_cache_task.barrier_mark(worker_id);
5315 
5316     // Clean the Strings and Symbols.
5317     _string_symbol_task.work(worker_id);
5318 
5319     // Wait for all workers to finish the first code cache cleaning pass.
5320     _code_cache_task.barrier_wait(worker_id);
5321 
5322     // Do the second code cache cleaning work, which realize on
5323     // the liveness information gathered during the first pass.
5324     _code_cache_task.work_second_pass(worker_id);
5325 
5326     // Clean all klasses that were not unloaded.
5327     _klass_cleaning_task.work();
5328   }
5329 };
5330 
5331 
5332 void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive,
5333                                         bool process_strings,