On Sun, 19 Dec 2021 03:21:55 GMT, liach <d...@openjdk.java.net> wrote:
> Upon review of [8261407](https://bugs.openjdk.java.net/browse/JDK-8261407), > by design, duplicate initialization of ReflectionFactory should be safe as it > performs side-effect-free property read actions, and the suggesting of making > the `initted` field volatile cannot prevent concurrent initialization either; > however, having `initted == true` published without the other fields' values > is a possibility, which this patch addresses. > > This simulates what's done in `CallSite`'s constructor for > `ConstantCallSite`. Please feel free to point out the problems with this > patch, as I am relatively inexperienced in this field of fences and there are > relatively less available documents. (Thanks to > https://shipilev.net/blog/2014/on-the-fence-with-dependencies/) This pull request has now been integrated. Changeset: 7feabee4 Author: liach <li...@users.noreply.github.com> Committer: Mandy Chung <mch...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/7feabee4265787ea820c1925c0c531933cb0da50 Stats: 125 lines in 1 file changed: 72 ins; 36 del; 17 mod 8261407: ReflectionFactory.checkInitted() is not thread-safe Co-authored-by: Peter Levart <plev...@openjdk.org> Reviewed-by: dholmes, mchung, plevart ------------- PR: https://git.openjdk.java.net/jdk/pull/6889