comparison src/share/vm/classfile/classLoaderData.hpp @ 7409:30866cd626b0

8004883: NPG: clean up anonymous class fix Summary: Add klass_holder() to return either mirror or class_loader depending on if the class is anonymous or not. Reviewed-by: stefank, jrose
author coleenp
date Wed, 12 Dec 2012 11:39:29 -0500
parents 90273fc0a981
children e94068d4ff52
comparison
equal deleted inserted replaced
7396:4a2ed49abd51 7409:30866cd626b0
107 Metaspace * _metaspace; // Meta-space where meta-data defined by the 107 Metaspace * _metaspace; // Meta-space where meta-data defined by the
108 // classes in the class loader are allocated. 108 // classes in the class loader are allocated.
109 Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. 109 Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup.
110 bool _unloading; // true if this class loader goes away 110 bool _unloading; // true if this class loader goes away
111 bool _keep_alive; // if this CLD can be unloaded for anonymous loaders 111 bool _keep_alive; // if this CLD can be unloaded for anonymous loaders
112 bool _is_anonymous; // if this CLD is for an anonymous class
112 volatile int _claimed; // true if claimed, for example during GC traces. 113 volatile int _claimed; // true if claimed, for example during GC traces.
113 // To avoid applying oop closure more than once. 114 // To avoid applying oop closure more than once.
114 // Has to be an int because we cas it. 115 // Has to be an int because we cas it.
115 Klass* _klasses; // The classes defined by the class loader. 116 Klass* _klasses; // The classes defined by the class loader.
116 117
137 void locked_add_dependency(objArrayHandle last, objArrayHandle new_dependency); 138 void locked_add_dependency(objArrayHandle last, objArrayHandle new_dependency);
138 139
139 void set_next(ClassLoaderData* next) { _next = next; } 140 void set_next(ClassLoaderData* next) { _next = next; }
140 ClassLoaderData* next() const { return _next; } 141 ClassLoaderData* next() const { return _next; }
141 142
142 ClassLoaderData(Handle h_class_loader); 143 ClassLoaderData(Handle h_class_loader, bool is_anonymous);
143 ~ClassLoaderData(); 144 ~ClassLoaderData();
144 145
145 void set_metaspace(Metaspace* m) { _metaspace = m; } 146 void set_metaspace(Metaspace* m) { _metaspace = m; }
146 147
147 JNIHandleBlock* handles() const; 148 JNIHandleBlock* handles() const;
172 173
173 static ClassLoaderData* the_null_class_loader_data() { 174 static ClassLoaderData* the_null_class_loader_data() {
174 return _the_null_class_loader_data; 175 return _the_null_class_loader_data;
175 } 176 }
176 177
177 bool is_anonymous() const; 178 bool is_anonymous() const { return _is_anonymous; }
178 179
179 static void init_null_class_loader_data() { 180 static void init_null_class_loader_data() {
180 assert(_the_null_class_loader_data == NULL, "cannot initialize twice"); 181 assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
181 assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice"); 182 assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
182 _the_null_class_loader_data = new ClassLoaderData((oop)NULL); 183 _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false);
183 ClassLoaderDataGraph::_head = _the_null_class_loader_data; 184 ClassLoaderDataGraph::_head = _the_null_class_loader_data;
184 assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be"); 185 assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be");
185 if (DumpSharedSpaces) { 186 if (DumpSharedSpaces) {
186 _the_null_class_loader_data->initialize_shared_metaspaces(); 187 _the_null_class_loader_data->initialize_shared_metaspaces();
187 } 188 }