< prev index next >

src/hotspot/share/jvmci/metadataHandleBlock.cpp

Print this page




 124       // traverse heap pointers only, not deleted handles or free list
 125       // pointers
 126       if (value != NULL && ((intptr_t) value & ptr_tag) == 0) {
 127         Klass* klass = NULL;
 128         if (value->is_klass()) {
 129           klass = (Klass*)value;
 130         } else if (value->is_method()) {
 131           Method* m = (Method*)value;
 132           klass = m->method_holder();
 133         } else if (value->is_constantPool()) {
 134           ConstantPool* cp = (ConstantPool*)value;
 135           klass = cp->pool_holder();
 136         } else {
 137           ShouldNotReachHere();
 138         }
 139         if (klass->class_loader_data()->is_unloading()) {
 140           // This needs to be marked so that it's no longer scanned
 141           // but can't be put on the free list yet. The
 142           // HandleCleaner will set this to NULL and
 143           // put it on the free list.
 144           jlong old_value = Atomic::cmpxchg((jlong) (ptr_tag), (jlong*)handle, (jlong) value);
 145           if (old_value == (jlong) value) {
 146             // Success
 147           } else {
 148             guarantee(old_value == 0, "only other possible value");
 149           }
 150         }
 151       }
 152     }
 153     // the next handle block is valid only if current block is full
 154     if (current->_top < block_size_in_handles) {
 155       break;
 156     }
 157   }
 158 }


 124       // traverse heap pointers only, not deleted handles or free list
 125       // pointers
 126       if (value != NULL && ((intptr_t) value & ptr_tag) == 0) {
 127         Klass* klass = NULL;
 128         if (value->is_klass()) {
 129           klass = (Klass*)value;
 130         } else if (value->is_method()) {
 131           Method* m = (Method*)value;
 132           klass = m->method_holder();
 133         } else if (value->is_constantPool()) {
 134           ConstantPool* cp = (ConstantPool*)value;
 135           klass = cp->pool_holder();
 136         } else {
 137           ShouldNotReachHere();
 138         }
 139         if (klass->class_loader_data()->is_unloading()) {
 140           // This needs to be marked so that it's no longer scanned
 141           // but can't be put on the free list yet. The
 142           // HandleCleaner will set this to NULL and
 143           // put it on the free list.
 144           jlong old_value = Atomic::cmpxchg((jlong*)handle, (jlong) value, (jlong) (ptr_tag));
 145           if (old_value == (jlong) value) {
 146             // Success
 147           } else {
 148             guarantee(old_value == 0, "only other possible value");
 149           }
 150         }
 151       }
 152     }
 153     // the next handle block is valid only if current block is full
 154     if (current->_top < block_size_in_handles) {
 155       break;
 156     }
 157   }
 158 }
< prev index next >