RFR(S): 8205574: Loop predication "assert(f <= 1 && f >= 0) failed Incorrect frequency"

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Nov 8 01:08:01 UTC 2018


I would suggest to add wrapper method:

void set_rounding(int mode)  { NOT_WINDOWS(fesetround(mode);) }

And remove asserts - they only test if fesetround() works correctly.

Vladimir

On 11/7/18 8:13 AM, Roland Westrelin wrote:
> 
> http://cr.openjdk.java.net/~roland/8205574/webrev.00/
> 
> Loop predicates needs to compute the frequencies of paths in a loop. To
> sanity check that logic (make sure one path is not counted twice for
> instance), the code that computes frequencies verifies they are kept
> between 0 and 1. Because rounding can send a correctly computed
> frequency above 1, the code adjust fp rounding to always round
> down. There were a few occurence on windows where an assert finds a
> frequency above 1 in spite of the rounding mode changes. I looked at one
> and found that fesetround() is broken on windows. Right after the call
> to:
> 
> fesetround(FE_UPWARD)
> 
> the mxcsr value is 3f80 which is round toward -infinity. Actually using
> FE_DOWNWARD sets mxcsr to round toward +infinity.
> 
> Anyway, adjusting rounding is not required for correctness and the most
> reasonable way to fix this seems to be to not do sanity checking on
> windows.
> 
> Roland.
> 


More information about the hotspot-compiler-dev mailing list