< prev index next >

src/hotspot/share/classfile/classLoaderDataGraph.cpp

Print this page
rev 60538 : imported patch jep387-misc.patch


 631 Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
 632   Klass* head = _next_klass;
 633 
 634   while (head != NULL) {
 635     Klass* next = next_klass_in_cldg(head);
 636 
 637     Klass* old_head = Atomic::cmpxchg(&_next_klass, head, next);
 638 
 639     if (old_head == head) {
 640       return head; // Won the CAS.
 641     }
 642 
 643     head = old_head;
 644   }
 645 
 646   // Nothing more for the iterator to hand out.
 647   assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head));
 648   return NULL;
 649 }
 650 
 651 ClassLoaderDataGraphMetaspaceIterator::ClassLoaderDataGraphMetaspaceIterator() {
 652   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
 653   _data = ClassLoaderDataGraph::_head;
 654 }
 655 
 656 ClassLoaderDataGraphMetaspaceIterator::~ClassLoaderDataGraphMetaspaceIterator() {}
 657 
 658 ClassLoaderMetaspace* ClassLoaderDataGraphMetaspaceIterator::get_next() {
 659   assert(_data != NULL, "Should not be NULL in call to the iterator");
 660   ClassLoaderMetaspace* result = _data->metaspace_or_null();
 661   _data = _data->next();
 662   // This result might be NULL for class loaders without metaspace
 663   // yet.  It would be nice to return only non-null results but
 664   // there is no guarantee that there will be a non-null result
 665   // down the list so the caller is going to have to check.
 666   return result;
 667 }
 668 
 669 void ClassLoaderDataGraph::verify() {
 670   ClassLoaderDataGraphIterator iter;
 671   while (ClassLoaderData* cld = iter.get_next()) {
 672     cld->verify();
 673   }
 674 }
 675 
 676 #ifndef PRODUCT
 677 // callable from debugger
 678 extern "C" int print_loader_data_graph() {
 679   ResourceMark rm;
 680   ClassLoaderDataGraph::print_on(tty);
 681   return 0;
 682 }
 683 
 684 void ClassLoaderDataGraph::print_on(outputStream * const out) {
 685   ClassLoaderDataGraphIterator iter;
 686   while (ClassLoaderData* cld = iter.get_next()) {
 687     cld->print_on(out);
 688   }


 631 Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
 632   Klass* head = _next_klass;
 633 
 634   while (head != NULL) {
 635     Klass* next = next_klass_in_cldg(head);
 636 
 637     Klass* old_head = Atomic::cmpxchg(&_next_klass, head, next);
 638 
 639     if (old_head == head) {
 640       return head; // Won the CAS.
 641     }
 642 
 643     head = old_head;
 644   }
 645 
 646   // Nothing more for the iterator to hand out.
 647   assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head));
 648   return NULL;
 649 }
 650 


















 651 void ClassLoaderDataGraph::verify() {
 652   ClassLoaderDataGraphIterator iter;
 653   while (ClassLoaderData* cld = iter.get_next()) {
 654     cld->verify();
 655   }
 656 }
 657 
 658 #ifndef PRODUCT
 659 // callable from debugger
 660 extern "C" int print_loader_data_graph() {
 661   ResourceMark rm;
 662   ClassLoaderDataGraph::print_on(tty);
 663   return 0;
 664 }
 665 
 666 void ClassLoaderDataGraph::print_on(outputStream * const out) {
 667   ClassLoaderDataGraphIterator iter;
 668   while (ClassLoaderData* cld = iter.get_next()) {
 669     cld->print_on(out);
 670   }
< prev index next >