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

Roland Westrelin roland.westrelin at oracle.com
Wed Feb 3 12:36:25 UTC 2016


>> 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