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