4907 |
4907 |
4908 for (int i = 0; i < num_claimed_nmethods; i++) { |
4908 for (int i = 0; i < num_claimed_nmethods; i++) { |
4909 clean_nmethod(claimed_nmethods[i]); |
4909 clean_nmethod(claimed_nmethods[i]); |
4910 } |
4910 } |
4911 } |
4911 } |
4912 |
|
4913 // The nmethod cleaning helps out and does the CodeCache part of MetadataOnStackMark. |
|
4914 // Need to retire the buffers now that this thread has stopped cleaning nmethods. |
|
4915 MetadataOnStackMark::retire_buffer_for_thread(Thread::current()); |
|
4916 } |
4912 } |
4917 |
4913 |
4918 void work_second_pass(uint worker_id) { |
4914 void work_second_pass(uint worker_id) { |
4919 nmethod* nm; |
4915 nmethod* nm; |
4920 // Take care of postponed nmethods. |
4916 // Take care of postponed nmethods. |
4963 ik->clean_method_data(_is_alive); |
4959 ik->clean_method_data(_is_alive); |
4964 |
4960 |
4965 // G1 specific cleanup work that has |
4961 // G1 specific cleanup work that has |
4966 // been moved here to be done in parallel. |
4962 // been moved here to be done in parallel. |
4967 ik->clean_dependent_nmethods(); |
4963 ik->clean_dependent_nmethods(); |
4968 if (JvmtiExport::has_redefined_a_class()) { |
|
4969 InstanceKlass::purge_previous_versions(ik); |
|
4970 } |
|
4971 } |
4964 } |
4972 |
4965 |
4973 void work() { |
4966 void work() { |
4974 ResourceMark rm; |
4967 ResourceMark rm; |
4975 |
4968 |
5000 _string_symbol_task(is_alive, process_strings, process_symbols), |
4993 _string_symbol_task(is_alive, process_strings, process_symbols), |
5001 _code_cache_task(num_workers, is_alive, unloading_occurred), |
4994 _code_cache_task(num_workers, is_alive, unloading_occurred), |
5002 _klass_cleaning_task(is_alive) { |
4995 _klass_cleaning_task(is_alive) { |
5003 } |
4996 } |
5004 |
4997 |
5005 void pre_work_verification() { |
|
5006 assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty"); |
|
5007 } |
|
5008 |
|
5009 void post_work_verification() { |
|
5010 assert(!MetadataOnStackMark::has_buffer_for_thread(Thread::current()), "Should be empty"); |
|
5011 } |
|
5012 |
|
5013 // The parallel work done by all worker threads. |
4998 // The parallel work done by all worker threads. |
5014 void work(uint worker_id) { |
4999 void work(uint worker_id) { |
5015 pre_work_verification(); |
|
5016 |
|
5017 // Do first pass of code cache cleaning. |
5000 // Do first pass of code cache cleaning. |
5018 _code_cache_task.work_first_pass(worker_id); |
5001 _code_cache_task.work_first_pass(worker_id); |
5019 |
5002 |
5020 // Let the threads mark that the first pass is done. |
5003 // Let the threads mark that the first pass is done. |
5021 _code_cache_task.barrier_mark(worker_id); |
5004 _code_cache_task.barrier_mark(worker_id); |
5030 // the liveness information gathered during the first pass. |
5013 // the liveness information gathered during the first pass. |
5031 _code_cache_task.work_second_pass(worker_id); |
5014 _code_cache_task.work_second_pass(worker_id); |
5032 |
5015 |
5033 // Clean all klasses that were not unloaded. |
5016 // Clean all klasses that were not unloaded. |
5034 _klass_cleaning_task.work(); |
5017 _klass_cleaning_task.work(); |
5035 |
|
5036 post_work_verification(); |
|
5037 } |
5018 } |
5038 }; |
5019 }; |
5039 |
5020 |
5040 |
5021 |
5041 void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive, |
5022 void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive, |