RFR: 8236850: Operations on constant List/Set.of(element) instances does not consistently constant fold

Claes Redestad claes.redestad at oracle.com
Mon Jan 13 21:12:25 UTC 2020


On 2020-01-13 20:49, Paul Sandoz wrote:
> Looks good.

Thanks!

> 
>    78     private static final Object[] EMPTY;
> 
> Is there a specific reason related to archiving that this is Object[] and not Object and instead assigned a value of new Object() ?

No, this was part of an experiment I did to have EMPTY_LIST etc use the
EMPTY backing array, but that didn't pan out to anything but more code.
I thought I backed out all changes, but must've slipped.

> 
> --
> 
> For information purposes: an alternative salt might be to use mix32 from Splittable random:
> 
> /**
>   * Returns the 32 high bits of Stafford variant 4 mix64 function as int.
>   */
> private static int mix32(long z) {
>      z = (z ^ (z >>> 33)) * 0x62a9d9ed799705f5L;
>      return (int)(((z ^ (z >>> 28)) * 0xcb24d0a5c88c35b3L) >>> 32);
> }
> 
> as in:
> 
> SALT = mix32(System.nanoTime());

Interesting - but as John points out we don't need a _really_ good salt
for this, and I don't want to pull in SplittableRandom since we'd
distort the bootstrap sequence if we did so here.

/Claes


More information about the core-libs-dev mailing list