src/share/vm/classfile/classLoaderData.cpp

Print this page
rev 9227 : [mq] cds


  65 #include "runtime/safepoint.hpp"
  66 #include "runtime/synchronizer.hpp"
  67 #include "utilities/growableArray.hpp"
  68 #include "utilities/macros.hpp"
  69 #include "utilities/ostream.hpp"
  70 #if INCLUDE_TRACE
  71 #include "trace/tracing.hpp"
  72 #endif
  73 
  74 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
  75 
  76 ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies) :
  77   _class_loader(h_class_loader()),
  78   _is_anonymous(is_anonymous),
  79   // An anonymous class loader data doesn't have anything to keep
  80   // it from being unloaded during parsing of the anonymous class.
  81   // The null-class-loader should always be kept alive.
  82   _keep_alive(is_anonymous || h_class_loader.is_null()),
  83   _metaspace(NULL), _unloading(false), _klasses(NULL),
  84   _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
  85   _next(NULL), _dependencies(dependencies),
  86   _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true,
  87                             Monitor::_safepoint_check_never)) {
  88     // empty
  89 }
  90 
  91 void ClassLoaderData::init_dependencies(TRAPS) {
  92   assert(!Universe::is_fully_initialized(), "should only be called when initializing");
  93   assert(is_the_null_class_loader_data(), "should only call this for the null class loader");
  94   _dependencies.init(CHECK);
  95 }
  96 
  97 void ClassLoaderData::Dependencies::init(TRAPS) {
  98   // Create empty dependencies array to add to. CMS requires this to be
  99   // an oop so that it can track additions via card marks.  We think.
 100   _list_head = oopFactory::new_objectArray(2, CHECK);
 101 }
 102 
 103 bool ClassLoaderData::claim() {
 104   if (_claimed == 1) {
 105     return false;




  65 #include "runtime/safepoint.hpp"
  66 #include "runtime/synchronizer.hpp"
  67 #include "utilities/growableArray.hpp"
  68 #include "utilities/macros.hpp"
  69 #include "utilities/ostream.hpp"
  70 #if INCLUDE_TRACE
  71 #include "trace/tracing.hpp"
  72 #endif
  73 
  74 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
  75 
  76 ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies) :
  77   _class_loader(h_class_loader()),
  78   _is_anonymous(is_anonymous),
  79   // An anonymous class loader data doesn't have anything to keep
  80   // it from being unloaded during parsing of the anonymous class.
  81   // The null-class-loader should always be kept alive.
  82   _keep_alive(is_anonymous || h_class_loader.is_null()),
  83   _metaspace(NULL), _unloading(false), _klasses(NULL),
  84   _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
  85   _next(NULL), _dependencies(dependencies), _shared_class_loader_id(-1),
  86   _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true,
  87                             Monitor::_safepoint_check_never)) {
  88     // empty
  89 }
  90 
  91 void ClassLoaderData::init_dependencies(TRAPS) {
  92   assert(!Universe::is_fully_initialized(), "should only be called when initializing");
  93   assert(is_the_null_class_loader_data(), "should only call this for the null class loader");
  94   _dependencies.init(CHECK);
  95 }
  96 
  97 void ClassLoaderData::Dependencies::init(TRAPS) {
  98   // Create empty dependencies array to add to. CMS requires this to be
  99   // an oop so that it can track additions via card marks.  We think.
 100   _list_head = oopFactory::new_objectArray(2, CHECK);
 101 }
 102 
 103 bool ClassLoaderData::claim() {
 104   if (_claimed == 1) {
 105     return false;