RFR(S): 8137049: Code quality: reducing an trivial integer loop does not produce an optimal code

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Feb 3 17:45:04 UTC 2016


Good.

Thanks,
Vladimir

On 2/3/16 4:36 AM, Roland Westrelin wrote:
>>> http://cr.openjdk.java.net/~roland/8137049/webrev.00/
>>
>> Thanks! The benchmark from the bug works as expected now.
>
> Thanks for looking at this.
>
>> I think this micro-optimization garbles the intent:
>>
>>   int init_idx = maybe_swapped ? 2 : 1;
>>   int limit_idx = 3 - init_idx;
>>
>> This seems cleaner:
>>
>>   int init_idx  = maybe_swapped ? 2 : 1;
>>   int limit_idx = maybe_swapped ? 1 : 2;
>
> You’re probably right about that. I’ll follow your suggestion.
>
> Roland.
>


More information about the hotspot-compiler-dev mailing list