RFR: JDK-8227831: Avoid using volatile for write-once, read-many class field

Aleksey Shipilev shade at redhat.com
Wed Jul 17 07:49:08 UTC 2019


On 7/17/19 8:48 AM, Kazunori Ogata wrote:
> Webrev: http://cr.openjdk.java.net/~ogatak/8227831/webrev/

Note this is generally not safe: it introduces data race on langReflectAccess field access. It has
to be proved that everything that implements LangReflectAccess interface makes this data race
benign: e.g. all fields that are accessed via those implementation are final, read once, etc. And
briefly looking at that, I am not sure it is the case for the actual accessor generators.

I'd cautiously leave "volatile" here.

-- 
Thanks,
-Aleksey



More information about the core-libs-dev mailing list