< prev index next >

src/hotspot/share/classfile/classLoaderData.cpp

Print this page
rev 50534 : [mq]: rename_RootAccess


 798       // Ensure _metaspace is stable, since it is examined without a lock
 799       OrderAccess::release_store(&_metaspace, metaspace);
 800     }
 801   }
 802   return metaspace;
 803 }
 804 
 805 OopHandle ClassLoaderData::add_handle(Handle h) {
 806   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
 807   record_modified_oops();
 808   return OopHandle(_handles.add(h()));
 809 }
 810 
 811 void ClassLoaderData::remove_handle(OopHandle h) {
 812   assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
 813   oop* ptr = h.ptr_raw();
 814   if (ptr != NULL) {
 815     assert(_handles.owner_of(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
 816     // This root is not walked in safepoints, and hence requires an appropriate
 817     // decorator that e.g. maintains the SATB invariant in SATB collectors.
 818     RootAccess<IN_CONCURRENT_ROOT>::oop_store(ptr, oop(NULL));
 819   }
 820 }
 821 
 822 void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
 823   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
 824   if (dest.resolve() != NULL) {
 825     return;
 826   } else {
 827     dest = _handles.add(h());
 828   }
 829 }
 830 
 831 // Add this metadata pointer to be freed when it's safe.  This is only during
 832 // class unloading because Handles might point to this metadata field.
 833 void ClassLoaderData::add_to_deallocate_list(Metadata* m) {
 834   // Metadata in shared region isn't deleted.
 835   if (!m->is_shared()) {
 836     MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
 837     if (_deallocate_list == NULL) {
 838       _deallocate_list = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(100, true);




 798       // Ensure _metaspace is stable, since it is examined without a lock
 799       OrderAccess::release_store(&_metaspace, metaspace);
 800     }
 801   }
 802   return metaspace;
 803 }
 804 
 805 OopHandle ClassLoaderData::add_handle(Handle h) {
 806   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
 807   record_modified_oops();
 808   return OopHandle(_handles.add(h()));
 809 }
 810 
 811 void ClassLoaderData::remove_handle(OopHandle h) {
 812   assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
 813   oop* ptr = h.ptr_raw();
 814   if (ptr != NULL) {
 815     assert(_handles.owner_of(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
 816     // This root is not walked in safepoints, and hence requires an appropriate
 817     // decorator that e.g. maintains the SATB invariant in SATB collectors.
 818     NativeAccess<IN_CONCURRENT_ROOT>::oop_store(ptr, oop(NULL));
 819   }
 820 }
 821 
 822 void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
 823   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
 824   if (dest.resolve() != NULL) {
 825     return;
 826   } else {
 827     dest = _handles.add(h());
 828   }
 829 }
 830 
 831 // Add this metadata pointer to be freed when it's safe.  This is only during
 832 // class unloading because Handles might point to this metadata field.
 833 void ClassLoaderData::add_to_deallocate_list(Metadata* m) {
 834   // Metadata in shared region isn't deleted.
 835   if (!m->is_shared()) {
 836     MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
 837     if (_deallocate_list == NULL) {
 838       _deallocate_list = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(100, true);


< prev index next >