RFR: 8251397: Add release fence to ClassValueMap constructor

Galder Zamarreño github.com+50187+galderz at openjdk.java.net
Sat Sep 12 12:11:00 UTC 2020


* Release fence guarantees that cacheArray field will published with a non-null value.
* Without this fix, CacheValueMap.cacheArray can sometimes be seen as null.

This is a follow up to @PaulSandoz's feedback
[here](https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-August/068248.html) for the first attempt to fix
[JDK-8251397](https://bugs.openjdk.java.net/browse/JDK-8251397).

In this update, the fence has been moved to `initializeMap()` and added Paul's suggested comment.

Annotating `classValueMap` with `@Stable` is outside the scope of this issue.

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

Commit messages:
 - 8251397: Add release fence to ClassValueMap constructor

Changes: https://git.openjdk.java.net/jdk/pull/94/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=94&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8251397
  Stats: 14 lines in 1 file changed: 12 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/94.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/94/head:pull/94

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


More information about the core-libs-dev mailing list