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

Aleksey Shipilev aleksey.shipilev at oracle.com
Wed Feb 3 12:32:05 UTC 2016


On 02/03/2016 02:21 PM, Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/8137049/webrev.00/

Thanks! The benchmark from the bug works as expected now.

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;

Cheers,
-Aleksey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160203/8e7fd757/signature.asc>


More information about the hotspot-compiler-dev mailing list