RFR: 8261407: ReflectionFactory.checkInitted() is not thread-safe [v9]

liach duke at openjdk.java.net
Mon Feb 21 16:38:04 UTC 2022


On Sat, 19 Feb 2022 16:06:35 GMT, liach <duke at 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/)
>
> liach has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:
> 
>  - Merge branch 'master' into 8261407-reflectionfactory
>  - Whitespace issues
>  - Refine docs, pull members out of the config record
>  - The fast path should always come first. good lesson learned!
>    restore config field comments
>  - Try making the config a record and see if it works
>  - Make config a pojo, move loading code into config class
>  - use peter's model of separate data object
>  - Merge branch 'master' into 8261407-reflectionfactory
>  - Include the stable annotation
>  - Merge branch 'master' into 8261407-reflectionfactory
>  - ... and 3 more: https://git.openjdk.java.net/jdk/compare/36cbf968...e97ea278

peter and mandy, would you mind review again today?

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

PR: https://git.openjdk.java.net/jdk/pull/6889


More information about the core-libs-dev mailing list