RFR: 8290079: Reduce interaction with volatile in static initializer of BigInteger

Сергей Цыпанов duke at openjdk.org
Tue Jul 12 09:02:46 UTC 2022


On Tue, 12 Jul 2022 08:35:50 GMT, Raffaello Giulietti <duke at openjdk.org> wrote:

>> `BigInteger.powerCache` is volatile and should be assigned only once in static initializer.
>
> (Not a reviewer) While the change doesn't hurt, I doubt that access to a (static) volatile in a static initializer is ever contended.

@rgiulietti AFAIK volatile access is more expensive than plain one regardless contention

-------------

PR: https://git.openjdk.org/jdk/pull/9451


More information about the core-libs-dev mailing list