mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8198313: Wrap holder object for ClassLoaderData in a WeakHandle
Use WeakHandle for ClassLoaderData::_holder so that is_alive closure is not needed Reviewed-by: rehn, kbarrett
This commit is contained in:
parent
21f636f3cf
commit
d187884156
13 changed files with 273 additions and 48 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "memory/metaspace.hpp"
|
||||
#include "memory/metaspaceCounters.hpp"
|
||||
#include "oops/oopHandle.hpp"
|
||||
#include "oops/weakHandle.hpp"
|
||||
#include "runtime/mutex.hpp"
|
||||
#include "trace/traceMacros.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
|
@ -113,7 +114,7 @@ class ClassLoaderDataGraph : public AllStatic {
|
|||
static void packages_unloading_do(void f(PackageEntry*));
|
||||
static void loaded_classes_do(KlassClosure* klass_closure);
|
||||
static void classes_unloading_do(void f(Klass* const));
|
||||
static bool do_unloading(BoolObjectClosure* is_alive, bool clean_previous_versions);
|
||||
static bool do_unloading(BoolObjectClosure* is_alive_closure, bool clean_previous_versions);
|
||||
|
||||
// dictionary do
|
||||
// Iterate over all klasses in dictionary, but
|
||||
|
@ -219,8 +220,9 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
|||
|
||||
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
|
||||
WeakHandle<vm_class_loader_data> _holder; // The oop that determines lifetime of this class loader
|
||||
oop _class_loader; // The instance of java/lang/ClassLoader associated with
|
||||
// this ClassLoaderData
|
||||
|
||||
ClassLoaderMetaspace * volatile _metaspace; // Meta-space where meta-data defined by the
|
||||
// classes in the class loader are allocated.
|
||||
|
@ -286,7 +288,8 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
|||
|
||||
void unload();
|
||||
bool keep_alive() const { return _keep_alive > 0; }
|
||||
oop holder_phantom();
|
||||
|
||||
oop holder_phantom() const;
|
||||
void classes_do(void f(Klass*));
|
||||
void loaded_classes_do(KlassClosure* klass_closure);
|
||||
void classes_do(void f(InstanceKlass*));
|
||||
|
@ -308,7 +311,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
|||
bool claimed() const { return _claimed == 1; }
|
||||
bool claim();
|
||||
|
||||
bool is_alive(BoolObjectClosure* is_alive_closure) const;
|
||||
bool is_alive() const;
|
||||
|
||||
// Accessors
|
||||
ClassLoaderMetaspace* metaspace_or_null() const { return _metaspace; }
|
||||
|
@ -348,7 +351,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
|||
// method will allocate a Metaspace if needed.
|
||||
ClassLoaderMetaspace* metaspace_non_null();
|
||||
|
||||
oop class_loader() const { return _class_loader; }
|
||||
oop class_loader() const { return _class_loader; }
|
||||
|
||||
// The object the GC is using to keep this ClassLoaderData alive.
|
||||
oop keep_alive_object() const;
|
||||
|
@ -364,6 +367,8 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
|||
void inc_keep_alive();
|
||||
void dec_keep_alive();
|
||||
|
||||
void initialize_holder(Handle holder);
|
||||
|
||||
inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); }
|
||||
|
||||
void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue