It's not clear what "loader" means in the API Klass::is_loader_alive(). At first look, it would mean:
is the oop Klass::class_loader() alive?
but it actually means
is the oop Klass::klass_holder() alive?
In most cases, these two have the same meaning. However, that's not true for non-STRONG hidden classes, where Klass::is_loader_alive() means only the latter.
Perhaps we should rename it to is_holder_alive to avoid the ambiguity.
We should add docs to describe:
+ What's the exact meaning of this function
+ What does a return value of false mean for the Klass
I think it means that the Klass is unloaded, or about to be unloaded
+ How to avoid race conditions when calling this function
The return value of this function may change from true to false in a safepoint. So the caller of this function must ensure that a safepoint doesn't happen when interpreting the return value
is the oop Klass::class_loader() alive?
but it actually means
is the oop Klass::klass_holder() alive?
In most cases, these two have the same meaning. However, that's not true for non-STRONG hidden classes, where Klass::is_loader_alive() means only the latter.
Perhaps we should rename it to is_holder_alive to avoid the ambiguity.
We should add docs to describe:
+ What's the exact meaning of this function
+ What does a return value of false mean for the Klass
I think it means that the Klass is unloaded, or about to be unloaded
+ How to avoid race conditions when calling this function
The return value of this function may change from true to false in a safepoint. So the caller of this function must ensure that a safepoint doesn't happen when interpreting the return value