< prev index next >
src/share/vm/runtime/advancedThresholdPolicy.cpp
Print this page
rev 9644 : 8145096: Undefined behaviour in HotSpot
Summary: Fix some integer overflows
Reviewed-by: duke
@@ -131,11 +131,12 @@
bool AdvancedThresholdPolicy::is_old(Method* method) {
return method->invocation_count() > 50000 || method->backedge_count() > 500000;
}
double AdvancedThresholdPolicy::weight(Method* method) {
- return (method->rate() + 1) * ((method->invocation_count() + 1) * (method->backedge_count() + 1));
+ return (double)(method->rate() + 1) *
+ (method->invocation_count() + 1) * (method->backedge_count() + 1);
}
// Apply heuristics and return true if x should be compiled before y
bool AdvancedThresholdPolicy::compare_methods(Method* x, Method* y) {
if (x->highest_comp_level() > y->highest_comp_level()) {
< prev index next >