< prev index next >
src/hotspot/share/classfile/classLoaderData.hpp
Print this page
*** 81,94 ****
static bool _metaspace_oom;
static volatile size_t _num_instance_classes;
static volatile size_t _num_array_classes;
! static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
static void post_class_unload_events();
public:
! static ClassLoaderData* find_or_create(Handle class_loader, TRAPS);
static void purge();
static void clear_claimed_marks();
// oops do
static void oops_do(OopClosure* f, bool must_claim);
static void keep_alive_oops_do(OopClosure* blk, bool must_claim);
--- 81,94 ----
static bool _metaspace_oom;
static volatile size_t _num_instance_classes;
static volatile size_t _num_array_classes;
! static ClassLoaderData* add(Handle class_loader, bool anonymous);
static void post_class_unload_events();
public:
! static ClassLoaderData* find_or_create(Handle class_loader);
static void purge();
static void clear_claimed_marks();
// oops do
static void oops_do(OopClosure* f, bool must_claim);
static void keep_alive_oops_do(OopClosure* blk, bool must_claim);
*** 149,162 ****
static int resize_if_needed();
static bool has_metaspace_oom() { return _metaspace_oom; }
static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
! static void dump_on(outputStream * const out) PRODUCT_RETURN;
! static void dump() { dump_on(tty); }
static void verify();
- static void print_creation(outputStream* out, Handle loader, ClassLoaderData* cld, TRAPS);
static bool unload_list_contains(const void* x);
// instance and array class counters
static inline size_t num_instance_classes();
--- 149,161 ----
static int resize_if_needed();
static bool has_metaspace_oom() { return _metaspace_oom; }
static void set_metaspace_oom(bool value) { _metaspace_oom = value; }
! static void print_on(outputStream * const out) PRODUCT_RETURN;
! static void print() { print_on(tty); }
static void verify();
static bool unload_list_contains(const void* x);
// instance and array class counters
static inline size_t num_instance_classes();
*** 179,204 ****
// ClassLoaderData class
class ClassLoaderData : public CHeapObj<mtClass> {
friend class VMStructs;
- private:
- class Dependencies VALUE_OBJ_CLASS_SPEC {
- objArrayOop _list_head;
- void locked_add(objArrayHandle last,
- objArrayHandle new_dependency,
- Thread* THREAD);
- public:
- Dependencies() : _list_head(NULL) {}
- Dependencies(TRAPS) : _list_head(NULL) {
- init(CHECK);
- }
- void add(Handle dependency, TRAPS);
- void init(TRAPS);
- void oops_do(OopClosure* f);
- };
class ChunkedHandleList VALUE_OBJ_CLASS_SPEC {
struct Chunk : public CHeapObj<mtClass> {
static const size_t CAPACITY = 32;
oop _data[CAPACITY];
--- 178,189 ----
// ClassLoaderData class
class ClassLoaderData : public CHeapObj<mtClass> {
friend class VMStructs;
+ private:
class ChunkedHandleList VALUE_OBJ_CLASS_SPEC {
struct Chunk : public CHeapObj<mtClass> {
static const size_t CAPACITY = 32;
oop _data[CAPACITY];
*** 217,230 ****
~ChunkedHandleList();
// Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock().
// However, multiple threads can execute oops_do concurrently with add.
oop* add(oop o);
! #ifdef ASSERT
! bool contains(oop* p);
! #endif
void oops_do(OopClosure* f);
};
friend class ClassLoaderDataGraph;
friend class ClassLoaderDataGraphKlassIteratorAtomic;
friend class ClassLoaderDataGraphKlassIteratorStatic;
--- 202,215 ----
~ChunkedHandleList();
// Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock().
// However, multiple threads can execute oops_do concurrently with add.
oop* add(oop o);
! bool contains(oop p);
void oops_do(OopClosure* f);
+
+ int count() const;
};
friend class ClassLoaderDataGraph;
friend class ClassLoaderDataGraphKlassIteratorAtomic;
friend class ClassLoaderDataGraphKlassIteratorStatic;
*** 235,246 ****
static ClassLoaderData * _the_null_class_loader_data;
oop _class_loader; // oop used to uniquely identify a class loader
// class loader or a canonical class path
- Dependencies _dependencies; // holds dependencies from this class loader
- // data to others.
Metaspace * volatile _metaspace; // Meta-space where meta-data defined by the
// classes in the class loader are allocated.
Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup.
bool _unloading; // true if this class loader goes away
--- 220,229 ----
*** 259,268 ****
--- 242,253 ----
// To avoid applying oop closure more than once.
// Has to be an int because we cas it.
ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which
// have the same life cycle of the corresponding ClassLoader.
+ NOT_PRODUCT(volatile int _dependency_count;) // number of class loader dependencies
+
Klass* volatile _klasses; // The classes defined by the class loader.
PackageEntryTable* volatile _packages; // The packages defined by the class loader.
ModuleEntryTable* volatile _modules; // The modules defined by the class loader.
ModuleEntry* _unnamed_module; // This class loader's unnamed module.
Dictionary* _dictionary; // The loaded InstanceKlasses, including initiated by this class loader
*** 287,297 ****
TRACE_DEFINE_TRACE_ID_FIELD;
void set_next(ClassLoaderData* next) { _next = next; }
ClassLoaderData* next() const { return _next; }
! ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies);
~ClassLoaderData();
// The CLD are not placed in the Heap, so the Card Table or
// the Mod Union Table can't be used to mark when CLD have modified oops.
// The CT and MUT bits saves this information for the whole class loader data.
--- 272,282 ----
TRACE_DEFINE_TRACE_ID_FIELD;
void set_next(ClassLoaderData* next) { _next = next; }
ClassLoaderData* next() const { return _next; }
! ClassLoaderData(Handle h_class_loader, bool is_anonymous);
~ClassLoaderData();
// The CLD are not placed in the Heap, so the Card Table or
// the Mod Union Table can't be used to mark when CLD have modified oops.
// The CT and MUT bits saves this information for the whole class loader data.
*** 339,357 ****
Mutex* metaspace_lock() const { return _metaspace_lock; }
bool is_anonymous() const { return _is_anonymous; }
! static void init_null_class_loader_data() {
! assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
! assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
!
! // We explicitly initialize the Dependencies object at a later phase in the initialization
! _the_null_class_loader_data = new ClassLoaderData(Handle(), false, Dependencies());
! ClassLoaderDataGraph::_head = _the_null_class_loader_data;
! assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be");
! }
bool is_the_null_class_loader_data() const {
return this == _the_null_class_loader_data;
}
bool is_system_class_loader_data() const;
--- 324,334 ----
Mutex* metaspace_lock() const { return _metaspace_lock; }
bool is_anonymous() const { return _is_anonymous; }
! static void init_null_class_loader_data();
bool is_the_null_class_loader_data() const {
return this == _the_null_class_loader_data;
}
bool is_system_class_loader_data() const;
*** 395,419 ****
JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; }
void set_jmethod_ids(JNIMethodBlock* new_block) { _jmethod_ids = new_block; }
void print() { print_on(tty); }
! void print_on(outputStream* out) const;
void print_value() { print_value_on(tty); }
void print_value_on(outputStream* out) const;
- void dump(outputStream * const out) PRODUCT_RETURN;
void verify();
! const char* loader_name();
OopHandle add_handle(Handle h);
void remove_handle(OopHandle h);
void init_handle_locked(OopHandle& pd, Handle h); // used for concurrent access to ModuleEntry::_pd field
void add_class(Klass* k, bool publicize = true);
void remove_class(Klass* k);
bool contains_klass(Klass* k);
! void record_dependency(const Klass* to, TRAPS);
! void init_dependencies(TRAPS);
PackageEntryTable* packages() { return _packages; }
ModuleEntry* unnamed_module() { return _unnamed_module; }
ModuleEntryTable* modules();
bool modules_defined() { return (_modules != NULL); }
--- 372,394 ----
JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; }
void set_jmethod_ids(JNIMethodBlock* new_block) { _jmethod_ids = new_block; }
void print() { print_on(tty); }
! void print_on(outputStream* out) const PRODUCT_RETURN;
void print_value() { print_value_on(tty); }
void print_value_on(outputStream* out) const;
void verify();
! const char* loader_name() const;
OopHandle add_handle(Handle h);
void remove_handle(OopHandle h);
void init_handle_locked(OopHandle& pd, Handle h); // used for concurrent access to ModuleEntry::_pd field
void add_class(Klass* k, bool publicize = true);
void remove_class(Klass* k);
bool contains_klass(Klass* k);
! void record_dependency(const Klass* to);
PackageEntryTable* packages() { return _packages; }
ModuleEntry* unnamed_module() { return _unnamed_module; }
ModuleEntryTable* modules();
bool modules_defined() { return (_modules != NULL); }
*** 422,433 ****
void add_to_deallocate_list(Metadata* m);
static ClassLoaderData* class_loader_data(oop loader);
static ClassLoaderData* class_loader_data_or_null(oop loader);
! static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS);
! static void print_loader(ClassLoaderData *loader_data, outputStream *out);
TRACE_DEFINE_TRACE_ID_METHODS;
};
// An iterator that distributes Klasses to parallel worker threads.
--- 397,407 ----
void add_to_deallocate_list(Metadata* m);
static ClassLoaderData* class_loader_data(oop loader);
static ClassLoaderData* class_loader_data_or_null(oop loader);
! static ClassLoaderData* anonymous_class_loader_data(Handle loader);
TRACE_DEFINE_TRACE_ID_METHODS;
};
// An iterator that distributes Klasses to parallel worker threads.
< prev index next >