review(XS): 6988308: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if

Igor Veresov igor.veresov at oracle.com
Tue Apr 12 21:37:51 PDT 2011


The problem can occur in Parse::dynamic_branch_prediction(), where cnt 
can become negative if the block count is larger than max int. This is 
because the "sum" variable is an int and Block::count() returns uint, 
which if large enough will make "sum" become negative, causing in turn 
"cnt" to become negative.

I treated this problem by making the "sum" a float. Also, added guards 
to detect overflows of "taken" and "not_taken", protecting therefore 
against overflowing an int twice when they are added together.

Webrev: http://cr.openjdk.java.net/~iveresov/6988308/webrev.00/

Thanks!
igor


More information about the hotspot-compiler-dev mailing list