hotspot/src/share/vm/classfile/classLoaderData.cpp
changeset 46746 ea379ebb9447
parent 46742 24ec8a039c90
child 46961 c9094b1e5f87
equal deleted inserted replaced
46745:f7b9bb98bb72 46746:ea379ebb9447
   724           SystemDictionary::is_system_class_loader(class_loader()) ||
   724           SystemDictionary::is_system_class_loader(class_loader()) ||
   725           SystemDictionary::is_platform_class_loader(class_loader()));
   725           SystemDictionary::is_platform_class_loader(class_loader()));
   726 }
   726 }
   727 
   727 
   728 Metaspace* ClassLoaderData::metaspace_non_null() {
   728 Metaspace* ClassLoaderData::metaspace_non_null() {
   729   assert(!DumpSharedSpaces, "wrong metaspace!");
       
   730   // If the metaspace has not been allocated, create a new one.  Might want
   729   // If the metaspace has not been allocated, create a new one.  Might want
   731   // to create smaller arena for Reflection class loaders also.
   730   // to create smaller arena for Reflection class loaders also.
   732   // The reason for the delayed allocation is because some class loaders are
   731   // The reason for the delayed allocation is because some class loaders are
   733   // simply for delegating with no metadata of their own.
   732   // simply for delegating with no metadata of their own.
   734   // Lock-free access requires load_ptr_acquire.
   733   // Lock-free access requires load_ptr_acquire.
  1313     Tracing::on_unloading_classes();
  1312     Tracing::on_unloading_classes();
  1314   }
  1313   }
  1315 #endif
  1314 #endif
  1316 }
  1315 }
  1317 
  1316 
  1318 // CDS support
       
  1319 
       
  1320 // Global metaspaces for writing information to the shared archive.  When
       
  1321 // application CDS is supported, we may need one per metaspace, so this
       
  1322 // sort of looks like it.
       
  1323 Metaspace* ClassLoaderData::_ro_metaspace = NULL;
       
  1324 Metaspace* ClassLoaderData::_rw_metaspace = NULL;
       
  1325 static bool _shared_metaspaces_initialized = false;
       
  1326 
       
  1327 // Initialize shared metaspaces (change to call from somewhere not lazily)
       
  1328 void ClassLoaderData::initialize_shared_metaspaces() {
       
  1329   assert(DumpSharedSpaces, "only use this for dumping shared spaces");
       
  1330   assert(this == ClassLoaderData::the_null_class_loader_data(),
       
  1331          "only supported for null loader data for now");
       
  1332   assert (!_shared_metaspaces_initialized, "only initialize once");
       
  1333   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
       
  1334   _ro_metaspace = new Metaspace(_metaspace_lock, Metaspace::ROMetaspaceType);
       
  1335   _rw_metaspace = new Metaspace(_metaspace_lock, Metaspace::ReadWriteMetaspaceType);
       
  1336   _shared_metaspaces_initialized = true;
       
  1337 }
       
  1338 
       
  1339 Metaspace* ClassLoaderData::ro_metaspace() {
       
  1340   assert(_ro_metaspace != NULL, "should already be initialized");
       
  1341   return _ro_metaspace;
       
  1342 }
       
  1343 
       
  1344 Metaspace* ClassLoaderData::rw_metaspace() {
       
  1345   assert(_rw_metaspace != NULL, "should already be initialized");
       
  1346   return _rw_metaspace;
       
  1347 }
       
  1348 
       
  1349 ClassLoaderDataGraphKlassIteratorAtomic::ClassLoaderDataGraphKlassIteratorAtomic()
  1317 ClassLoaderDataGraphKlassIteratorAtomic::ClassLoaderDataGraphKlassIteratorAtomic()
  1350     : _next_klass(NULL) {
  1318     : _next_klass(NULL) {
  1351   ClassLoaderData* cld = ClassLoaderDataGraph::_head;
  1319   ClassLoaderData* cld = ClassLoaderDataGraph::_head;
  1352   Klass* klass = NULL;
  1320   Klass* klass = NULL;
  1353 
  1321