src/share/vm/classfile/classLoaderData.cpp

changeset 6742
e4a6e7f1b90b
parent 6680
78bbf4d43a14
child 6876
710a3c8b516e
child 6974
556a06aec3fa
equal deleted inserted replaced
6741:ae92351815b6 6742:e4a6e7f1b90b
529 529
530 530
531 // GC root of class loader data created. 531 // GC root of class loader data created.
532 ClassLoaderData* ClassLoaderDataGraph::_head = NULL; 532 ClassLoaderData* ClassLoaderDataGraph::_head = NULL;
533 ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL; 533 ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
534 ClassLoaderData* ClassLoaderDataGraph::_saved_unloading = NULL;
534 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL; 535 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
535 536
536 bool ClassLoaderDataGraph::_should_purge = false; 537 bool ClassLoaderDataGraph::_should_purge = false;
537 538
538 // Add a new class loader data node to the list. Assign the newly created 539 // Add a new class loader data node to the list. Assign the newly created
626 } 627 }
627 } 628 }
628 629
629 void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) { 630 void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
630 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!"); 631 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
631 for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) { 632 // Only walk the head until any clds not purged from prior unloading
633 // (CMS doesn't purge right away).
634 for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
632 cld->classes_do(f); 635 cld->classes_do(f);
633 } 636 }
634 } 637 }
635 638
636 GrowableArray<ClassLoaderData*>* ClassLoaderDataGraph::new_clds() { 639 GrowableArray<ClassLoaderData*>* ClassLoaderDataGraph::new_clds() {
674 // and deallocation later. 677 // and deallocation later.
675 bool ClassLoaderDataGraph::do_unloading(BoolObjectClosure* is_alive_closure) { 678 bool ClassLoaderDataGraph::do_unloading(BoolObjectClosure* is_alive_closure) {
676 ClassLoaderData* data = _head; 679 ClassLoaderData* data = _head;
677 ClassLoaderData* prev = NULL; 680 ClassLoaderData* prev = NULL;
678 bool seen_dead_loader = false; 681 bool seen_dead_loader = false;
682
683 // Save previous _unloading pointer for CMS which may add to unloading list before
684 // purging and we don't want to rewalk the previously unloaded class loader data.
685 _saved_unloading = _unloading;
686
679 // mark metadata seen on the stack and code cache so we can delete 687 // mark metadata seen on the stack and code cache so we can delete
680 // unneeded entries. 688 // unneeded entries.
681 bool has_redefined_a_class = JvmtiExport::has_redefined_a_class(); 689 bool has_redefined_a_class = JvmtiExport::has_redefined_a_class();
682 MetadataOnStackMark md_on_stack; 690 MetadataOnStackMark md_on_stack;
683 while (data != NULL) { 691 while (data != NULL) {

mercurial