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

2020-01-13 Thread John Rose
On Jan 13, 2020, at 1:23 PM, Claes Redestad wrote: > > On 2020-01-13 22:18, Paul Sandoz wrote: >> That’s fine, it was really for informational purposes in case it comes in >> handy later on. > > Got it. > >> Speculating: if we had such a public method (with minimal dependencies) I >> suspect

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

2020-01-13 Thread Claes Redestad
On 2020-01-13 22:18, Paul Sandoz wrote: That’s fine, it was really for informational purposes in case it comes in handy later on. Got it. Speculating: if we had such a public method (with minimal dependencies) I suspect we would reach for it in this case even if overkill. It reduces the

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

2020-01-13 Thread Paul Sandoz
> On Jan 13, 2020, at 1:12 PM, Claes Redestad wrote: > > 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

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

2020-01-13 Thread Claes Redestad
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

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

2020-01-13 Thread John Rose
On Jan 13, 2020, at 11:49 AM, Paul Sandoz wrote: > > 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 >>>

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

2020-01-13 Thread Paul Sandoz
Looks good. 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() ? -- For information purposes: an alternative salt might be to use mix32 from Splittable random: /** *

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

2020-01-13 Thread Claes Redestad
Hi, I included John's suggested salt improvement, reverted to use an EMPTY object marker rather than 'this', and removed the extraneous blank line Roger pointed out: http://cr.openjdk.java.net/~redestad/8236850/open.01/ /Claes On 2020-01-11 04:19, John Rose wrote: On Jan 10, 2020, at 6:48 PM,

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

2020-01-12 Thread John Rose
On Jan 11, 2020, at 3:59 AM, fo...@univ-mlv.fr wrote: > In my opinion, it's better to introduce an annotation @TrueScottmanFinal > instead of using @Stable in a way it was not designed to be used. And even better than that is fixing “final” so it’s really final. But @TrueScottmanFinal is

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

2020-01-11 Thread Claes Redestad
0 02:23:50 *Objet: *Re: RFR: 8236850: Operations on constant List/Set.of(element) instances does not consistently constant fold On Jan 10, 2020, at 10:47 AM, Remi Forax mailto:fo...@univ-mlv.fr>> wrote: Seem to be a JIT bug to me, the fields of Set12 are declare

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

2020-01-11 Thread forax
> De: "John Rose" > À: "Remi Forax" > Cc: "Claes Redestad" , "core-libs-dev" > > Envoyé: Samedi 11 Janvier 2020 02:23:50 > Objet: Re: RFR: 8236850: Operations on constant List/Set.of(element) instances > does not consisten

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

2020-01-10 Thread John Rose
On Jan 10, 2020, at 6:48 PM, Claes Redestad wrote: > > Yes. The XOR seems pointless with this approach, but some shifting > might be good. A single multiply mixes the bits of its inputs. If one input is “random” or “white” (50% 1’s irregularly spaced) then the output will probably look

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

2020-01-10 Thread Claes Redestad
Hi, On 2020-01-11 02:23, John Rose wrote: On Jan 10, 2020, at 10:47 AM, Remi Forax > wrote: Seem to be a JIT bug to me, the fields of Set12 are declared final not @Stable (even if the field storing the instanceof of Set&2 itself is marked @Stable) so there is no

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

2020-01-10 Thread John Rose
On Jan 10, 2020, at 10:47 AM, Remi Forax wrote: > Seem to be a JIT bug to me, > the fields of Set12 are declared final not @Stable (even if the field storing > the instanceof of Set&2 itself is marked @Stable) so there is no reason not > not let the constant folding happen. It’s part of the

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

2020-01-10 Thread Remi Forax
t; À: "core-libs-dev" > Envoyé: Vendredi 10 Janvier 2020 18:01:40 > Objet: RFR: 8236850: Operations on constant List/Set.of(element) instances > does not consistently constant fold > Hi, > > this patch ensures operations on constant (static final) single-element >

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

2020-01-10 Thread Roger Riggs
Hi Claes, Looks fine. ImmutableCollections.java: 418  looks like an extra blank line Thanks, Roger On 1/10/20 12:01 PM, Claes Redestad wrote: Hi, this patch ensures operations on constant (static final) single-element lists and sets created via List.of(foo) and Set.of(bar) to constant fold

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

2020-01-10 Thread Claes Redestad
Hi, this patch ensures operations on constant (static final) single-element lists and sets created via List.of(foo) and Set.of(bar) to constant fold properly. Bug:https://bugs.openjdk.java.net/browse/JDK-8236850 Webrev: http://cr.openjdk.java.net/~redestad/8236850/open.00 On micros that