RFR(S): 8072753 Nondeterministic wrong answer on arithmetic

Igor Veresov igor.veresov at oracle.com
Mon Feb 16 20:09:07 UTC 2015

Thanks, Vladimir!


> On Feb 16, 2015, at 11:57 AM, Vladimir Kozlov <vladimir.kozlov at oracle.com> wrote:
> Good. Thank you for performance testing.
> Thanks,
> Vladimir
> On 2/16/15 11:43 AM, Igor Veresov wrote:
>> Sometimes when we try to do the counter loop detection during OSRs we get a non-canonical loop shape (while-do), in which case we would try to invert it (convert it to do-while). Specifically the following transformation takes place:
>>     i = init; while(i < limit) { i+= stride; }
>>     is converted to
>>     i = init; do {  i+= stride; } while(i < limit+stride);
>> Note that the loop condition check occurs _after_ the induction variable is incremented. And, as a result, (i + stride) can overflow.
>> There are two solutions possible:
>> - check the type of init, which in most cases will be tight enough to make a proper decision (also the check is only require when the inversion takes place).
>> - insert extra predicate to guard for the condition.
>> Since the described case is rare (OSR only) and the fix needs to be backported down to 6 (which doesn’t have predicates) I decided to go the first route for now. The benchmark runs didn’t show any change in performance.
>> Webrev: http://cr.openjdk.java.net/~iveresov/8072753/webrev.00/
>> Thanks,
>> igor

More information about the hotspot-compiler-dev mailing list