We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d9a438 commit d802fd0Copy full SHA for d802fd0
src/hotspot/share/ci/ciMethod.cpp
@@ -914,8 +914,14 @@ int ciMethod::scale_count(int count, float prof_factor) {
914
method_life = counter_life;
915
}
916
if (counter_life > 0) {
917
- count = (int)((double)count * prof_factor * method_life / counter_life + 0.5);
918
- count = (count > 0) ? count : 1;
+ double count_d = (double)count * prof_factor * method_life / counter_life + 0.5;
+ if (count_d >= static_cast<double>(INT_MAX)) {
919
+ // Clamp in case of overflowing int range.
920
+ count = INT_MAX;
921
+ } else {
922
+ count = int(count_d);
923
+ count = (count > 0) ? count : 1;
924
+ }
925
} else {
926
count = 1;
927
0 commit comments