RFR: 8256517: (ref) Reference.clear during reference processing may lose notification [v2]

Kim Barrett kbarrett at openjdk.java.net
Tue Nov 24 03:05:19 UTC 2020


On Mon, 23 Nov 2020 12:50:31 GMT, Per Liden <pliden at openjdk.org> wrote:

> Looks good. Just want to request that you also remove the following comment in zReferenceProcessor.cpp, as it's no longer true.
> 
> ```
> --- a/src/hotspot/share/gc/z/zReferenceProcessor.cpp
> +++ b/src/hotspot/share/gc/z/zReferenceProcessor.cpp
> @@ -184,12 +184,6 @@ bool ZReferenceProcessor::should_discover(oop reference, ReferenceType type) con
>  }
>  
>  bool ZReferenceProcessor::should_drop(oop reference, ReferenceType type) const {
> -  // This check is racing with a call to Reference.clear() from the application.
> -  // If the application clears the reference after this check it will still end
> -  // up on the pending list, and there's nothing we can do about that without
> -  // changing the Reference.clear() API. This check is also racing with a call
> -  // to Reference.enqueue() from the application, which is unproblematic, since
> -  // the application wants the reference to be enqueued anyway.
>    const oop referent = reference_referent(reference);
>    if (referent == NULL) {
>      // Reference has been cleared, by a call to Reference.enqueue()
> ```

Done.

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

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


More information about the core-libs-dev mailing list