RFR: 8216403: Allocate fewer EnumSets in JavacFileManager#list

Claes Redestad claes.redestad at oracle.com
Wed Jan 9 11:54:27 UTC 2019

On 2019-01-09 11:38, Remi Forax wrote:
> List.of() (with no argument) doesn't need to be stored in a static final given it's already a value stored in a static final 

True, but a static final likely doesn't hurt, either, especially not
during startup/warmup.

> and i'm not sure that in this case List.of(oneSingleValue) will be allocated due to escape analysis.

That's assuming it's hot enough to reach C2 *and* get sufficiently
inlined for EA to kick in. I don't doubt the speed-up as seen in the
bug report is real. :-)


> Rémi
> ----- Mail original -----
>> De: "Claes Redestad" <claes.redestad at oracle.com>
>> À: "Liam Miller-Cushon" <cushon at google.com>, "compiler-dev" <compiler-dev at openjdk.java.net>, "Ron Shapiro"
>> <ronshapiro at google.com>
>> Envoyé: Mercredi 9 Janvier 2019 10:48:12
>> Objet: Re: RFR: 8216403: Allocate fewer EnumSets in JavacFileManager#list
>> Hi,
>> not really a langtools reviewer, but I generally avoid using raw
>> static EnumSets due their mutable nature (not saying there's a bug
>> here - just that we should consider all possible futures and treat them
>> kindly).
>> Set.of() / Set.of(FOLLOW_LINKS) is a compact, performant and safer
>> alternative.
>> Thanks!
>> /Claes
>> On 2019-01-09 02:44, Liam Miller-Cushon wrote:
>>> Hi,
>>> Please consider this trivial performance improvement, which moves a
>>> couple of allocations out of JavacFileManager#list.
>>> bug: https://bugs.openjdk.java.net/browse/JDK-8216403
>>> webrev: http://cr.openjdk.java.net/~cushon/8216403/webrev.00/
>>> Thanks,
>>> Liam

More information about the compiler-dev mailing list