8210321: Create NO_KEEPALIVE CLD holder accessor

Reviewed-by: coleenp, kbarrett
This commit is contained in:
Erik Österlund 2018-09-10 13:07:42 +02:00
parent 842bc09b01
commit c8be228513
3 changed files with 12 additions and 2 deletions

View File

@ -671,6 +671,15 @@ oop ClassLoaderData::holder_phantom() const {
}
}
// Let the GC read the holder without keeping it alive.
oop ClassLoaderData::holder_no_keepalive() const {
if (!_holder.is_null()) { // NULL class_loader
return _holder.peek();
} else {
return NULL;
}
}
// Unloading support
bool ClassLoaderData::is_alive() const {
bool alive = keep_alive() // null class loader and incomplete unsafe anonymous klasses.

View File

@ -307,8 +307,9 @@ class ClassLoaderData : public CHeapObj<mtClass> {
void accumulate_modified_oops() { if (has_modified_oops()) _accumulated_modified_oops = true; }
void clear_accumulated_modified_oops() { _accumulated_modified_oops = false; }
bool has_accumulated_modified_oops() { return _accumulated_modified_oops; }
private:
oop holder_no_keepalive() const;
private:
void unload();
bool keep_alive() const { return _keep_alive > 0; }

View File

@ -34,7 +34,7 @@
inline oop ClassLoaderData::class_loader() const {
assert(!_unloading, "This oop is not available to unloading class loader data");
assert(_holder.is_null() || _holder.peek() != NULL , "This class loader data holder must be alive");
assert(_holder.is_null() || holder_no_keepalive() != NULL , "This class loader data holder must be alive");
return _class_loader.resolve();
}