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

Christian Thalinger christian.thalinger at oracle.com
Wed Apr 13 00:52:57 PDT 2011


On Apr 13, 2011, at 6:37 AM, Igor Veresov wrote:
> 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/

The change looks good and I have a question:  how often does the overflow of taken and not_taken counts happen?  

-- Christian


More information about the hotspot-compiler-dev mailing list