14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/metaspace.hpp"
31 #include "memory/metaspaceCounters.hpp"
32 #include "runtime/mutex.hpp"
33 #include "utilities/growableArray.hpp"
34
35 #if INCLUDE_TRACE
36 # include "trace/traceTime.hpp"
37 #endif
38
39 //
40 // A class loader represents a linkset. Conceptually, a linkset identifies
41 // the complete transitive closure of resolved links that a dynamic linker can
42 // produce.
43 //
44 // A ClassLoaderData also encapsulates the allocation space, called a metaspace,
45 // used by the dynamic linker to allocate the runtime representation of all
46 // the types it defines.
47 //
48 // ClassLoaderData are stored in the runtime representation of classes and the
49 // system dictionary, are roots of garbage collection, and provides iterators
50 // for root tracing and other GC operations.
51
52 class ClassLoaderData;
53 class JNIMethodBlock;
54 class JNIHandleBlock;
55 class Metadebug;
56
81 static void loaded_classes_do(KlassClosure* klass_closure);
82 static void classes_unloading_do(void f(Klass* const));
83 static bool do_unloading(BoolObjectClosure* is_alive);
84
85 // CMS support.
86 static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
87 static GrowableArray<ClassLoaderData*>* new_clds();
88
89 static void dump_on(outputStream * const out) PRODUCT_RETURN;
90 static void dump() { dump_on(tty); }
91 static void verify();
92
93 #ifndef PRODUCT
94 // expensive test for pointer in metaspace for debugging
95 static bool contains(address x);
96 static bool contains_loader_data(ClassLoaderData* loader_data);
97 #endif
98
99 #if INCLUDE_TRACE
100 private:
101 static TracingTime _class_unload_time;
102 static void class_unload_event(Klass* const k);
103 #endif
104 };
105
106 // ClassLoaderData class
107
108 class ClassLoaderData : public CHeapObj<mtClass> {
109 friend class VMStructs;
110 private:
111 class Dependencies VALUE_OBJ_CLASS_SPEC {
112 objArrayOop _list_head;
113 void locked_add(objArrayHandle last,
114 objArrayHandle new_dependency,
115 Thread* THREAD);
116 public:
117 Dependencies() : _list_head(NULL) {}
118 Dependencies(TRAPS) : _list_head(NULL) {
119 init(CHECK);
120 }
121 void add(Handle dependency, TRAPS);
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/metaspace.hpp"
31 #include "memory/metaspaceCounters.hpp"
32 #include "runtime/mutex.hpp"
33 #include "utilities/growableArray.hpp"
34 #if INCLUDE_TRACE
35 # include "utilities/ticks.hpp"
36 #endif
37
38 //
39 // A class loader represents a linkset. Conceptually, a linkset identifies
40 // the complete transitive closure of resolved links that a dynamic linker can
41 // produce.
42 //
43 // A ClassLoaderData also encapsulates the allocation space, called a metaspace,
44 // used by the dynamic linker to allocate the runtime representation of all
45 // the types it defines.
46 //
47 // ClassLoaderData are stored in the runtime representation of classes and the
48 // system dictionary, are roots of garbage collection, and provides iterators
49 // for root tracing and other GC operations.
50
51 class ClassLoaderData;
52 class JNIMethodBlock;
53 class JNIHandleBlock;
54 class Metadebug;
55
80 static void loaded_classes_do(KlassClosure* klass_closure);
81 static void classes_unloading_do(void f(Klass* const));
82 static bool do_unloading(BoolObjectClosure* is_alive);
83
84 // CMS support.
85 static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
86 static GrowableArray<ClassLoaderData*>* new_clds();
87
88 static void dump_on(outputStream * const out) PRODUCT_RETURN;
89 static void dump() { dump_on(tty); }
90 static void verify();
91
92 #ifndef PRODUCT
93 // expensive test for pointer in metaspace for debugging
94 static bool contains(address x);
95 static bool contains_loader_data(ClassLoaderData* loader_data);
96 #endif
97
98 #if INCLUDE_TRACE
99 private:
100 static Ticks _class_unload_time;
101 static void class_unload_event(Klass* const k);
102 #endif
103 };
104
105 // ClassLoaderData class
106
107 class ClassLoaderData : public CHeapObj<mtClass> {
108 friend class VMStructs;
109 private:
110 class Dependencies VALUE_OBJ_CLASS_SPEC {
111 objArrayOop _list_head;
112 void locked_add(objArrayHandle last,
113 objArrayHandle new_dependency,
114 Thread* THREAD);
115 public:
116 Dependencies() : _list_head(NULL) {}
117 Dependencies(TRAPS) : _list_head(NULL) {
118 init(CHECK);
119 }
120 void add(Handle dependency, TRAPS);
|