896
897 return next;
898 }
899
900 Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
901 Klass* head = _next_klass;
902
903 while (head != NULL) {
904 Klass* next = next_klass_in_cldg(head);
905
906 Klass* old_head = (Klass*)Atomic::cmpxchg_ptr(next, &_next_klass, head);
907
908 if (old_head == head) {
909 return head; // Won the CAS.
910 }
911
912 head = old_head;
913 }
914
915 // Nothing more for the iterator to hand out.
916 assert(head == NULL, err_msg("head is " PTR_FORMAT ", expected not null:", p2i(head)));
917 return NULL;
918 }
919
920 ClassLoaderDataGraphMetaspaceIterator::ClassLoaderDataGraphMetaspaceIterator() {
921 _data = ClassLoaderDataGraph::_head;
922 }
923
924 ClassLoaderDataGraphMetaspaceIterator::~ClassLoaderDataGraphMetaspaceIterator() {}
925
926 #ifndef PRODUCT
927 // callable from debugger
928 extern "C" int print_loader_data_graph() {
929 ClassLoaderDataGraph::dump_on(tty);
930 return 0;
931 }
932
933 void ClassLoaderDataGraph::verify() {
934 for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
935 data->verify();
936 }
|
896
897 return next;
898 }
899
900 Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
901 Klass* head = _next_klass;
902
903 while (head != NULL) {
904 Klass* next = next_klass_in_cldg(head);
905
906 Klass* old_head = (Klass*)Atomic::cmpxchg_ptr(next, &_next_klass, head);
907
908 if (old_head == head) {
909 return head; // Won the CAS.
910 }
911
912 head = old_head;
913 }
914
915 // Nothing more for the iterator to hand out.
916 assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head));
917 return NULL;
918 }
919
920 ClassLoaderDataGraphMetaspaceIterator::ClassLoaderDataGraphMetaspaceIterator() {
921 _data = ClassLoaderDataGraph::_head;
922 }
923
924 ClassLoaderDataGraphMetaspaceIterator::~ClassLoaderDataGraphMetaspaceIterator() {}
925
926 #ifndef PRODUCT
927 // callable from debugger
928 extern "C" int print_loader_data_graph() {
929 ClassLoaderDataGraph::dump_on(tty);
930 return 0;
931 }
932
933 void ClassLoaderDataGraph::verify() {
934 for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
935 data->verify();
936 }
|