mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8210233: Prepare Klass::is_loader_alive() for concurrent class unloading
Reviewed-by: coleenp, pliden
This commit is contained in:
parent
a602e0b80c
commit
842bc09b01
3 changed files with 9 additions and 3 deletions
|
@ -336,6 +336,8 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||||
bool claimed() const { return _claimed == 1; }
|
bool claimed() const { return _claimed == 1; }
|
||||||
bool claim();
|
bool claim();
|
||||||
|
|
||||||
|
// Computes if the CLD is alive or not. This is safe to call in concurrent
|
||||||
|
// contexts.
|
||||||
bool is_alive() const;
|
bool is_alive() const;
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
|
@ -377,6 +379,9 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||||
inline oop class_loader() const;
|
inline oop class_loader() const;
|
||||||
|
|
||||||
// Returns true if this class loader data is for a loader going away.
|
// Returns true if this class loader data is for a loader going away.
|
||||||
|
// Note that this is only safe after the GC has computed if the CLD is
|
||||||
|
// unloading or not. In concurrent contexts where there are no such
|
||||||
|
// guarantees, is_alive() should be used instead.
|
||||||
bool is_unloading() const {
|
bool is_unloading() const {
|
||||||
assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded");
|
assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded");
|
||||||
return _unloading;
|
return _unloading;
|
||||||
|
|
|
@ -470,7 +470,7 @@ public:
|
||||||
void do_cld (ClassLoaderData* cld) {
|
void do_cld (ClassLoaderData* cld) {
|
||||||
|
|
||||||
// We do not display unloading loaders, for now.
|
// We do not display unloading loaders, for now.
|
||||||
if (cld->is_unloading()) {
|
if (!cld->is_alive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -656,8 +656,9 @@ protected:
|
||||||
virtual MetaspaceObj::Type type() const { return ClassType; }
|
virtual MetaspaceObj::Type type() const { return ClassType; }
|
||||||
|
|
||||||
// Iff the class loader (or mirror for unsafe anonymous classes) is alive the
|
// Iff the class loader (or mirror for unsafe anonymous classes) is alive the
|
||||||
// Klass is considered alive. Has already been marked as unloading.
|
// Klass is considered alive. This is safe to call before the CLD is marked as
|
||||||
bool is_loader_alive() const { return !class_loader_data()->is_unloading(); }
|
// unloading, and hence during concurrent class unloading.
|
||||||
|
bool is_loader_alive() const { return class_loader_data()->is_alive(); }
|
||||||
|
|
||||||
// Load the klass's holder as a phantom. This is useful when a weak Klass
|
// Load the klass's holder as a phantom. This is useful when a weak Klass
|
||||||
// pointer has been "peeked" and then must be kept alive before it may
|
// pointer has been "peeked" and then must be kept alive before it may
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue