RFR: 8202184: Reduce time blocking the ClassSpecializer cache creating SpeciesData

Claes Redestad claes.redestad at oracle.com
Wed Apr 25 08:06:35 UTC 2018


Hi Peter,


On 2018-04-25 08:36, Peter Levart wrote:
> Hi Claes,
>
> Nice play with CHM and safe publication.

thanks, I was curious how you'd react to this. :-)

>
> If findSpecies() is on a hot concurrent path, [...]

It'd be surprising if it was: findSpecies is typically called once for a 
specific SpeciesData,
and sometimes every now and then during setup of certain method handles 
(in particular
the static speciesData_L* methods in jli.BoundMethodHandle are begging 
to be turned
into lazy constants).

Besides, CHM.computeIfAbsent has a non-synchronizing fast-path for when 
the key exists,
lines 1731-1734:

             else if (fh == h    // check first node without acquiring lock
                      && ((fk = f.key) == key || (fk != null && 
key.equals(fk)))
                      && (fv = f.val) != null)
                 return fv;

.. so I'm not sure we'd gain much from wrapping the preface with a get 
even if it was
hot and contended.

/Claes


More information about the core-libs-dev mailing list