5211 }
5212 };
5213
5214 // To minimize the remark pause times, the tasks below are done in parallel.
5215 class G1ParallelCleaningTask : public AbstractGangTask {
5216 private:
5217 G1StringSymbolTableUnlinkTask _string_symbol_task;
5218 G1CodeCacheUnloadingTask _code_cache_task;
5219 G1KlassCleaningTask _klass_cleaning_task;
5220
5221 public:
5222 // The constructor is run in the VMThread.
5223 G1ParallelCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, uint num_workers, bool unloading_occurred) :
5224 AbstractGangTask("Parallel Cleaning"),
5225 _string_symbol_task(is_alive, process_strings, process_symbols),
5226 _code_cache_task(num_workers, is_alive, unloading_occurred),
5227 _klass_cleaning_task(is_alive) {
5228 }
5229
5230 void pre_work_verification() {
5231 assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty");
5232 }
5233
5234 void post_work_verification() {
5235 assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty");
5236 }
5237
5238 // The parallel work done by all worker threads.
5239 void work(uint worker_id) {
5240 pre_work_verification();
5241
5242 // Do first pass of code cache cleaning.
5243 _code_cache_task.work_first_pass(worker_id);
5244
5245 // Let the threads mark that the first pass is done.
5246 _code_cache_task.barrier_mark(worker_id);
5247
5248 // Clean the Strings and Symbols.
5249 _string_symbol_task.work(worker_id);
5250
5251 // Wait for all workers to finish the first code cache cleaning pass.
|
5211 }
5212 };
5213
5214 // To minimize the remark pause times, the tasks below are done in parallel.
5215 class G1ParallelCleaningTask : public AbstractGangTask {
5216 private:
5217 G1StringSymbolTableUnlinkTask _string_symbol_task;
5218 G1CodeCacheUnloadingTask _code_cache_task;
5219 G1KlassCleaningTask _klass_cleaning_task;
5220
5221 public:
5222 // The constructor is run in the VMThread.
5223 G1ParallelCleaningTask(BoolObjectClosure* is_alive, bool process_strings, bool process_symbols, uint num_workers, bool unloading_occurred) :
5224 AbstractGangTask("Parallel Cleaning"),
5225 _string_symbol_task(is_alive, process_strings, process_symbols),
5226 _code_cache_task(num_workers, is_alive, unloading_occurred),
5227 _klass_cleaning_task(is_alive) {
5228 }
5229
5230 void pre_work_verification() {
5231 // The VM Thread will have registered Metadata during the single-threaded phase of MetadataStackOnMark.
5232 assert(Thread::current()->is_VM_thread()
5233 || !MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty");
5234 }
5235
5236 void post_work_verification() {
5237 assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty");
5238 }
5239
5240 // The parallel work done by all worker threads.
5241 void work(uint worker_id) {
5242 pre_work_verification();
5243
5244 // Do first pass of code cache cleaning.
5245 _code_cache_task.work_first_pass(worker_id);
5246
5247 // Let the threads mark that the first pass is done.
5248 _code_cache_task.barrier_mark(worker_id);
5249
5250 // Clean the Strings and Symbols.
5251 _string_symbol_task.work(worker_id);
5252
5253 // Wait for all workers to finish the first code cache cleaning pass.
|