# HG changeset patch # User coleenp # Date 1501632952 0 # Node ID 0f11e65a02bf28f75d30ae2591b38261424f87a5 # Parent d68a77b4ccc41e9960a0919e5ccebc1bbab6c412# Parent 89569d6a77c0b3d351045e66c72a0619d9444671 Merge diff -r d68a77b4ccc4 -r 0f11e65a02bf hotspot/src/share/vm/classfile/classLoaderData.cpp --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Tue Aug 01 22:40:38 2017 +0000 +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Wed Aug 02 00:15:52 2017 +0000 @@ -469,7 +469,8 @@ 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 @@ 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 @@ _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 diff -r d68a77b4ccc4 -r 0f11e65a02bf hotspot/src/share/vm/runtime/compilationPolicy.cpp --- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp Tue Aug 01 22:40:38 2017 +0000 +++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp Wed Aug 02 00:15:52 2017 +0000 @@ -313,7 +313,7 @@ // 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();