mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-27 22:02:25 +00:00
8185590: ShouldNotReachHere from ClassLoaderData::try_get_next_class()
Counting number of instanceKlass code didn't work. Reviewed-by: shade, zgu, jiangli
This commit is contained in:
parent
10f79d42ef
commit
8b8f59294c
@ -469,7 +469,8 @@ class ClassLoaderDataGraphKlassIteratorStatic {
|
||||
InstanceKlass* try_get_next_class() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
|
||||
int max_classes = InstanceKlass::number_of_instance_classes();
|
||||
for (int i = 0; i < max_classes; i++) {
|
||||
assert(max_classes > 0, "should not be called with no instance classes");
|
||||
for (int i = 0; i < max_classes; ) {
|
||||
|
||||
if (_current_class_entry != NULL) {
|
||||
Klass* k = _current_class_entry;
|
||||
@ -477,7 +478,9 @@ class ClassLoaderDataGraphKlassIteratorStatic {
|
||||
|
||||
if (k->is_instance_klass()) {
|
||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||
// Only return loaded classes
|
||||
i++; // count all instance classes found
|
||||
// Not yet loaded classes are counted in max_classes
|
||||
// but only return loaded classes.
|
||||
if (ik->is_loaded()) {
|
||||
return ik;
|
||||
}
|
||||
@ -495,9 +498,9 @@ class ClassLoaderDataGraphKlassIteratorStatic {
|
||||
_current_class_entry = _current_loader_data->klasses();
|
||||
}
|
||||
}
|
||||
// should never be reached: an InstanceKlass should be returned above
|
||||
ShouldNotReachHere();
|
||||
return NULL; // Object_klass not even loaded?
|
||||
// Should never be reached unless all instance classes have failed or are not fully loaded.
|
||||
// Caller handles NULL.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// If the current class for the static iterator is a class being unloaded or
|
||||
|
||||
@ -313,7 +313,7 @@ void CounterDecay::decay() {
|
||||
// at this point and hence SystemDictionary_lock is also not needed.
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "can only be executed at a safepoint");
|
||||
int nclasses = InstanceKlass::number_of_instance_classes();
|
||||
double classes_per_tick = nclasses * (CounterDecayMinIntervalLength * 1e-3 /
|
||||
int classes_per_tick = nclasses * (CounterDecayMinIntervalLength * 1e-3 /
|
||||
CounterHalfLifeTime);
|
||||
for (int i = 0; i < classes_per_tick; i++) {
|
||||
InstanceKlass* k = ClassLoaderDataGraph::try_get_next_class();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user