< prev index next >

src/share/vm/gc/shared/genCollectedHeap.cpp

Print this page
rev 10188 : [mq]: scavenge_nmethods_auto_prune


 544   return gen_policy()->satisfy_failed_allocation(size, is_tlab);
 545 }
 546 
 547 #ifdef ASSERT
 548 class AssertNonScavengableClosure: public OopClosure {
 549 public:
 550   virtual void do_oop(oop* p) {
 551     assert(!GenCollectedHeap::heap()->is_in_partial_collection(*p),
 552       "Referent should not be scavengable.");  }
 553   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
 554 };
 555 static AssertNonScavengableClosure assert_is_non_scavengable_closure;
 556 #endif
 557 
 558 void GenCollectedHeap::process_roots(StrongRootsScope* scope,
 559                                      ScanningOption so,
 560                                      OopClosure* strong_roots,
 561                                      OopClosure* weak_roots,
 562                                      CLDClosure* strong_cld_closure,
 563                                      CLDClosure* weak_cld_closure,
 564                                      CodeBlobClosure* code_roots) {
 565   // General roots.
 566   assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
 567   assert(code_roots != NULL, "code root closure should always be set");
 568   // _n_termination for _process_strong_tasks should be set up stream
 569   // in a method not running in a GC worker.  Otherwise the GC worker
 570   // could be trying to change the termination condition while the task
 571   // is executing in another GC worker.
 572 
 573   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) {
 574     ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
 575   }
 576 
 577   // Some CLDs contained in the thread frames should be considered strong.
 578   // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
 579   CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
 580   // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
 581   CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
 582 
 583   bool is_par = scope->n_threads() > 1;
 584   Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_clds_p, roots_from_code_p);
 585 
 586   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) {
 587     Universe::oops_do(strong_roots);
 588   }
 589   // Global (strong) JNI handles
 590   if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) {
 591     JNIHandles::oops_do(strong_roots);
 592   }
 593 
 594   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
 595     ObjectSynchronizer::oops_do(strong_roots);
 596   }
 597   if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) {
 598     FlatProfiler::oops_do(strong_roots);
 599   }
 600   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
 601     Management::oops_do(strong_roots);




 544   return gen_policy()->satisfy_failed_allocation(size, is_tlab);
 545 }
 546 
 547 #ifdef ASSERT
 548 class AssertNonScavengableClosure: public OopClosure {
 549 public:
 550   virtual void do_oop(oop* p) {
 551     assert(!GenCollectedHeap::heap()->is_in_partial_collection(*p),
 552       "Referent should not be scavengable.");  }
 553   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
 554 };
 555 static AssertNonScavengableClosure assert_is_non_scavengable_closure;
 556 #endif
 557 
 558 void GenCollectedHeap::process_roots(StrongRootsScope* scope,
 559                                      ScanningOption so,
 560                                      OopClosure* strong_roots,
 561                                      OopClosure* weak_roots,
 562                                      CLDClosure* strong_cld_closure,
 563                                      CLDClosure* weak_cld_closure,
 564                                      CodeBlobToOopClosure* code_roots) {
 565   // General roots.
 566   assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
 567   assert(code_roots != NULL, "code root closure should always be set");
 568   // _n_termination for _process_strong_tasks should be set up stream
 569   // in a method not running in a GC worker.  Otherwise the GC worker
 570   // could be trying to change the termination condition while the task
 571   // is executing in another GC worker.
 572 
 573   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) {
 574     ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
 575   }
 576 
 577   // Some CLDs contained in the thread frames should be considered strong.
 578   // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
 579   CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
 580   // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
 581   CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
 582 
 583   bool is_par = scope->n_threads() > 1;
 584   Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_clds_p, roots_from_code_p);
 585 
 586   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) {
 587     Universe::oops_do(strong_roots);
 588   }
 589   // Global (strong) JNI handles
 590   if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) {
 591     JNIHandles::oops_do(strong_roots);
 592   }
 593 
 594   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
 595     ObjectSynchronizer::oops_do(strong_roots);
 596   }
 597   if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) {
 598     FlatProfiler::oops_do(strong_roots);
 599   }
 600   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
 601     Management::oops_do(strong_roots);


< prev index next >