comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 20619:b12a2a9b05ca

8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse Reviewed-by: mgerdin, coleenp, bdelsart
author stefank
date Thu, 02 Oct 2014 10:55:36 +0200
parents 1d6eb209432a
children 706dce84c9df 02c7eebe5f52
comparison
equal deleted inserted replaced
20618:7024b693c8f9 20619:b12a2a9b05ca
25 #if !defined(__clang_major__) && defined(__GNUC__) 25 #if !defined(__clang_major__) && defined(__GNUC__)
26 #define ATTRIBUTE_PRINTF(x,y) // FIXME, formats are a mess. 26 #define ATTRIBUTE_PRINTF(x,y) // FIXME, formats are a mess.
27 #endif 27 #endif
28 28
29 #include "precompiled.hpp" 29 #include "precompiled.hpp"
30 #include "classfile/metadataOnStackMark.hpp"
30 #include "code/codeCache.hpp" 31 #include "code/codeCache.hpp"
31 #include "code/icBuffer.hpp" 32 #include "code/icBuffer.hpp"
32 #include "gc_implementation/g1/bufferingOopClosure.hpp" 33 #include "gc_implementation/g1/bufferingOopClosure.hpp"
33 #include "gc_implementation/g1/concurrentG1Refine.hpp" 34 #include "gc_implementation/g1/concurrentG1Refine.hpp"
34 #include "gc_implementation/g1/concurrentG1RefineThread.hpp" 35 #include "gc_implementation/g1/concurrentG1RefineThread.hpp"
5131 5132
5132 for (int i = 0; i < num_claimed_nmethods; i++) { 5133 for (int i = 0; i < num_claimed_nmethods; i++) {
5133 clean_nmethod(claimed_nmethods[i]); 5134 clean_nmethod(claimed_nmethods[i]);
5134 } 5135 }
5135 } 5136 }
5137
5138 // The nmethod cleaning helps out and does the CodeCache part of MetadataOnStackMark.
5139 // Need to retire the buffers now that this thread has stopped cleaning nmethods.
5140 MetadataOnStackMark::retire_buffer_for_thread(Thread::current());
5136 } 5141 }
5137 5142
5138 void work_second_pass(uint worker_id) { 5143 void work_second_pass(uint worker_id) {
5139 nmethod* nm; 5144 nmethod* nm;
5140 // Take care of postponed nmethods. 5145 // Take care of postponed nmethods.
5183 ik->clean_method_data(_is_alive); 5188 ik->clean_method_data(_is_alive);
5184 5189
5185 // G1 specific cleanup work that has 5190 // G1 specific cleanup work that has
5186 // been moved here to be done in parallel. 5191 // been moved here to be done in parallel.
5187 ik->clean_dependent_nmethods(); 5192 ik->clean_dependent_nmethods();
5193 if (JvmtiExport::has_redefined_a_class()) {
5194 InstanceKlass::purge_previous_versions(ik);
5195 }
5188 } 5196 }
5189 5197
5190 void work() { 5198 void work() {
5191 ResourceMark rm; 5199 ResourceMark rm;
5192 5200
5217 _string_symbol_task(is_alive, process_strings, process_symbols), 5225 _string_symbol_task(is_alive, process_strings, process_symbols),
5218 _code_cache_task(num_workers, is_alive, unloading_occurred), 5226 _code_cache_task(num_workers, is_alive, unloading_occurred),
5219 _klass_cleaning_task(is_alive) { 5227 _klass_cleaning_task(is_alive) {
5220 } 5228 }
5221 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
5222 // The parallel work done by all worker threads. 5238 // The parallel work done by all worker threads.
5223 void work(uint worker_id) { 5239 void work(uint worker_id) {
5240 pre_work_verification();
5241
5224 // Do first pass of code cache cleaning. 5242 // Do first pass of code cache cleaning.
5225 _code_cache_task.work_first_pass(worker_id); 5243 _code_cache_task.work_first_pass(worker_id);
5226 5244
5227 // Let the threads mark that the first pass is done. 5245 // Let the threads mark that the first pass is done.
5228 _code_cache_task.barrier_mark(worker_id); 5246 _code_cache_task.barrier_mark(worker_id);
5237 // the liveness information gathered during the first pass. 5255 // the liveness information gathered during the first pass.
5238 _code_cache_task.work_second_pass(worker_id); 5256 _code_cache_task.work_second_pass(worker_id);
5239 5257
5240 // Clean all klasses that were not unloaded. 5258 // Clean all klasses that were not unloaded.
5241 _klass_cleaning_task.work(); 5259 _klass_cleaning_task.work();
5260
5261 post_work_verification();
5242 } 5262 }
5243 }; 5263 };
5244 5264
5245 5265
5246 void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive, 5266 void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive,