Reference.reachabilityFence
Paul Sandoz
paul.sandoz at oracle.com
Fri Dec 4 13:47:55 UTC 2015
> On 3 Dec 2015, at 22:33, Mandy Chung <mandy.chung at oracle.com> wrote:
>
>
>> On Nov 26, 2015, at 8:22 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
>>
>> Hi,
>>
>> I have updated the patches:
>>
>> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8133348-reachability-fence-jdk/webrev/
>> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8133348-reachability-fence-hotspot/webrev/
>>
>> There is now more documentation on Reference (copied and suitable rearranged from 166 Fences.java). The method name remains the same.
>>
>
> I think the addition to the Reference class specification should belong to the reachabilityFence method specification. Any reason why not?
I thought it would be more visible in the JavaDoc, as it’s there upfront. The api note may get larger if we include some additional real world examples. I don’t have a strong opinion on this, if yours is stronger i will move it :-)
>
> I suggest to change this (occurs in the class spec and the method spec):
> <em>strongly reachable</em> (as defined in the {@link java.lang.ref} package documentation),
>
> to
> <a href=“package-summary.html#reachability”><em>strongly reachable</em></a>
>
Good point. I also linked to the referred section in the JLS.
> Should the reachabilityFence method throw NPE if ref is null?
>
I am ok with it doing nothing, it’s a performance sensitive method. It means no null checks/de-opts are required and (hand-waving here...) might make it more amenable to optimization see https://bugs.openjdk.java.net/browse/JDK-8130398).
Updated:
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8133348-reachability-fence-jdk/webrev/
reachabilityFence is now annotated with @DontInline (to be pushed real soon now) and the HotSpot changes are no longer needed.
Paul.
More information about the core-libs-dev
mailing list