Skip to content

Commit

Permalink
Merge pull request #14064 from klangman/PR145269
Browse files Browse the repository at this point in the history
Prevent FPE in scaleSizeBasedOnBlockFrequency() float to int32 cast
  • Loading branch information
zl-wang committed Dec 3, 2021
2 parents 3cbebb1 + eec1c59 commit eba5fd4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/compiler/optimizer/InlinerTempForJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4144,7 +4144,8 @@ int32_t TR_MultipleCallTargetInliner::scaleSizeBasedOnBlockFrequency(int32_t byt
int adjFrequency = frequency ? frequency : 1;

float factor = (float)adjFrequency / (float)maxFrequency;
bytecodeSize = (int32_t)((float)bytecodeSize / (factor*factor));
float weight = (float)bytecodeSize / (factor*factor);
bytecodeSize = (weight > 0x7fffffff) ? 0x7fffffff : ((int32_t)weight);

heuristicTrace(tracer(),"exceedsSizeThreshold: Scaled up size for call from %d to %d", oldSize, bytecodeSize);
}
Expand Down

0 comments on commit eba5fd4

Please sign in to comment.