8179527: Ineffective use of volatile hurts performance of Charset.atBugLevel()
Alan.Bateman at oracle.com
Tue Jun 27 07:01:25 UTC 2017
On 27/06/2017 07:50, Langer, Christoph wrote:
> Hi Ogata,
> I'm redirecting this RFR to core-libs-dev and nio-dev as it potentially affects all platforms and should be discussed there.
> As for your proposal: I can generally understand that using volatile at this place hurts performance on the power platform and this should be improved. I however don't fully oversee if just removing the volatile qualifier is the only thing to do here. Maybe one should implement some double checked locking pattern around the static field bugLevel and its initialization from system properties? I guess during VM initialization multiple threads can got to this place and the volatile qualifier was added for synchronizing access to "bugLevel".
It could be changed to be a final field in a holder class. It might be
better if we can just remove the test from Charset.checkName as I think
that dates back to an incompatible change going from JDK 1.4 to JDK 5
that should no longer be a concern.
More information about the nio-dev